cancel
Showing results for 
Search instead for 
Did you mean: 

STM32C011J4M6 conflict on pin

Pierre75
Associate II

Hello everyone,

I have a question about the STM32C011J4M6 in S08N package.

I am developping a PCB with this MCU and want to use an LSE like in the picture below.

Pierre75_0-1705586401952.png

Then I also want to program and debug my MCU with an stlinkv3 and will use the SWD debug so the 2 wire SWCLK and SWDIO will be connected to PA13 and PA14.

The problem is that in the pinout view below, PA14 and OSCX_OUT are on the same pin.

Pierre75_1-1705586566297.png

So can I connect to pin 8 at the same time a quartz and a trace for SWCLK ?

 

1 ACCEPTED SOLUTION

Accepted Solutions
Pierre_Paris
ST Employee

Hello @Pierre75,

You cannot use the RCC_OSC_OUT and the DEBUG_SWCLK at the same time. Indeed, there is a conflict.

You have two choices :

  • Change your STM32C011J4M6 to another such as STM32C011D6Y3TR (check on MCU selector)
  • Create 2 projects :
    • The first which use PA14 as OSCX_OUT (but you will not be able to debug)
    • The second which use PA14 as SWCLK (but you will not be able to debug with the LSE, you have to use an other internal CLK)

If you choose the second option, you need a jumper or hardware solution to switch from one configuration to another. Be careful of the resonator behavior...

Q1 : Do you know what is the default function of the pin ? I suppose the PA14 for SWCLK ?

A1 : The PA14 pin can be configured as Boot0 input or as a GPIO.
To configure PA14 as a GPIO, set the USE_BOOT0_OPT bit of the FLASH option bytes.
Following this, PA14 is configured by default as serial wire debug (SWD) interface clock
input (SWCLK).

Q2 :  how do I switch to the OSCX_OUT function ?

A2 : Due to the limited number of pins on SO8 package, multiple GPIOs are connected to I/O
pins. The SYSCFG_CFGR3 register allows selecting which of them is active, to prevent
conflicts. 

You can read more here on the chapter 6 GPIO of RM0490.

Best Regards,

Pierre

 

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

View solution in original post

6 REPLIES 6
TDK
Guru

You can't use SWD to debug while the crystal is active, no. You can hook them both up, but you can only use one function of the physical pin at a given time.

If you feel a post has answered your question, please click "Accept as Solution".

Ok thank you for your answer.

Do you know what is the default function of the pin ? I suppose the PA14 for SWCLK ?

If it is the case, after flashing my program, how do I switch to the OSCX_OUT function ?

 

 

Pierre_Paris
ST Employee

Hello @Pierre75,

You cannot use the RCC_OSC_OUT and the DEBUG_SWCLK at the same time. Indeed, there is a conflict.

You have two choices :

  • Change your STM32C011J4M6 to another such as STM32C011D6Y3TR (check on MCU selector)
  • Create 2 projects :
    • The first which use PA14 as OSCX_OUT (but you will not be able to debug)
    • The second which use PA14 as SWCLK (but you will not be able to debug with the LSE, you have to use an other internal CLK)

If you choose the second option, you need a jumper or hardware solution to switch from one configuration to another. Be careful of the resonator behavior...

Q1 : Do you know what is the default function of the pin ? I suppose the PA14 for SWCLK ?

A1 : The PA14 pin can be configured as Boot0 input or as a GPIO.
To configure PA14 as a GPIO, set the USE_BOOT0_OPT bit of the FLASH option bytes.
Following this, PA14 is configured by default as serial wire debug (SWD) interface clock
input (SWCLK).

Q2 :  how do I switch to the OSCX_OUT function ?

A2 : Due to the limited number of pins on SO8 package, multiple GPIOs are connected to I/O
pins. The SYSCFG_CFGR3 register allows selecting which of them is active, to prevent
conflicts. 

You can read more here on the chapter 6 GPIO of RM0490.

Best Regards,

Pierre

 

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Okay, thanks Pierre_P for your answer.

I think I will do the second option and use a 0 ohm resistor.

Correct me if I am wrong, SWCLK is also used to flash the program not only for debugging ?

Best regards,

 

Yes, SWCLK is used for flashing as well as debugging.

If you feel a post has answered your question, please click "Accept as Solution".
Pierre_Paris
ST Employee

Q: SWCLK is also used to flash the program not only for debugging ?

A: Yes that's true.

The device-embedded flash memory can be programmed using in-circuit programming or in-application programming.
The in-circuit programming (ICP) method is used to update the entire contents of the flash memory, using SWD protocol or the supported interfaces by the system boot loader, to load the user application for the CPU, into the microcontroller.

The embedded boot loader is located in the System memory, programmed by ST during production. It is used to reprogram the Flash memory using one of the following serial
interfaces:
• USART1
• I2C1
For further details, refer to the device data sheets and the application note AN2606.

Best Regards,

Pierre

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.