2024-01-18 06:07 AM
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.
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.
So can I connect to pin 8 at the same time a quartz and a trace for SWCLK ?
Solved! Go to Solution.
2024-01-18 07:00 AM - edited 2024-01-18 07:11 AM
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 :
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.
2024-01-18 06:30 AM
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.
2024-01-18 06:47 AM
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 ?
2024-01-18 07:00 AM - edited 2024-01-18 07:11 AM
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 :
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.
2024-01-18 07:19 AM - edited 2024-01-18 07:24 AM
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,
2024-01-18 07:25 AM
Yes, SWCLK is used for flashing as well as debugging.
2024-01-18 07:43 AM - edited 2024-01-18 07:44 AM
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.