Failure when Configuring UART2 in the STM32C031C6
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-04-11 12:22 AM
When configuring UART2 in the STM32C0316-DK, the emulator is locked.
Error in executing 'step' command ...
Target is not responding, retrying...
Code is running here (stm32c0xx_hal_msp.c line 272):
/**USART2 GPIO Configuration
PA8 ------> USART2_TX
PA13 ------> USART2_RX
*/
GPIO_InitStruct.Pin = GPIO_PIN_8;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
GPIO_InitStruct.Alternate = GPIO_AF1_USART2;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
GPIO_InitStruct.Pin = GPIO_PIN_13;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
GPIO_InitStruct.Alternate = GPIO_AF4_USART2;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
Need you help.
Tim
Solved! Go to Solution.
- Labels:
-
STM32C0 Series
-
UART-USART
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-04-11 12:36 AM
Hello @tpeng.1​ ,
this is quite common mistake, you reconfigured one of your pins used for debug (PA13). You should use other pins for the USART2, when you want to use SWD.
BR,
Jaroslav
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-04-11 12:36 AM
Hello @tpeng.1​ ,
this is quite common mistake, you reconfigured one of your pins used for debug (PA13). You should use other pins for the USART2, when you want to use SWD.
BR,
Jaroslav
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-04-11 12:57 AM
Thank you very much for your quick response!
Now I understand that PA13 is used for debug.
Br,
Tim
