Debug not working when using USB CDC serial on Nucleo-L412 #2924
-
|
When using CDC USB serial as main Serial object, it is impossible to start a debug session. I tested this several times back and forth, and also chose OpenOCD SWD as upload method, which fails as well when USB CDC is activated. The sketch works fine in both configurations, there is serial output on the corresponding port (STLink serial or CDC serial) but debug is only possible without CDC serial. I only tested with Nucleo-L412 and a custom STM32L412KBUx board. this is the GDB console output when debug fails This is the output of the OpenOCD-STLink upload trial: |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 2 replies
-
|
I have the same behaviour for a STM32L4R5ZITxP custom board |
Beta Was this translation helpful? Give feedback.
-
|
Hi @PerennialNovice But PA13 is used by the debug. So when it is initialized the debug connection is lost. You can redefined this array on top of your sketch without PA13 |
Beta Was this translation helpful? Give feedback.
-
|
Hi @fpistm, gave it a try, although I now can start a debug session, the CDC serial is not recognized by Windows . Is this something related to timing when the device comes up after reset? |
Beta Was this translation helpful? Give feedback.
-
|
Oh, what I previously wrote is not always true! |
Beta Was this translation helpful? Give feedback.
Hi @PerennialNovice
When you select USB, this array is parsed and all pin are initialised; ex for the Nucleo L412KB
Arduino_Core_STM32/variants/STM32L4xx/L412K(8-B)(T-U)_L422KB(T-U)/PeripheralPins.c
Lines 243 to 248 in 739acb7
But PA13 is used by the debug. So when it is initialized the debug connection is lost.
You can redefined this array on to…