Skip to main content
Visitor II
January 18, 2024
Solved

STM32C011J4M6 conflict on pin

  • January 18, 2024
  • 3 replies
  • 2537 views

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 ?

 

    This topic has been closed for replies.
    Best answer by Pierre_Paris

    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

     

    3 replies

    Super User
    January 18, 2024

    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.

    Pierre75Author
    Visitor II
    January 18, 2024

    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 ?

     

     

    ST Employee
    January 18, 2024

    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

     

    Pierre75Author
    Visitor II
    January 18, 2024

    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,

     

    Super User
    January 18, 2024

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

    ST Employee
    January 18, 2024

    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