Issues trying to get USART writing to a console.
It only works when I have stlink connected. As soon as I disconnect stlink the output stops.
The output does seem to go through USART2_TX (PA9) as disconnecting it stops the output
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-05-01 5:19 AM
I am using STM32L010F4 20 pin on a simple breakout board.
I am running STM32CubeIde and using a STM32Lc100-disco as my programmer via SYS_SWCLK (PA14), SYS_SWDIO (PA13) and NRST.
All works well can get SPI etc running no problem.
I mapped USART2_RX to PA10 and USART2_TX to PA9 and connect this to a serial to USB converter.
Config below
huart2.Instance = USART2;
huart2.Init.BaudRate = 115200;
huart2.Init.WordLength = UART_WORDLENGTH_8B;
huart2.Init.StopBits = UART_STOPBITS_1;
huart2.Init.Parity = UART_PARITY_NONE;
huart2.Init.Mode = UART_MODE_TX_RX;
huart2.Init.HwFlowCtl = UART_HWCONTROL_NONE;
huart2.Init.OverSampling = UART_OVERSAMPLING_16;
huart2.Init.OneBitSampling = UART_ONE_BIT_SAMPLE_DISABLE;
huart2.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_NO_INIT;
Just cannot get output without the stlink connected.
Tried orders of plugging in, restarting, booting desktop, etc. does not work.
Solved! Go to Solution.
- Labels:
-
STM32L0 Series
-
UART-USART
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-05-02 4:34 AM
Thanks for your reply. I did re-check the above thanks.
FYI I managed to resolve this.
This turned out to be an issue with the ground between the host pc and the stm32. (Issue on the host side or cable)
Picked it up when I connected the oscilloscope and suddenly everything worked.
Once you disconnect the probe ground pin the issue would occur again.
Never mind what I did ground wise I could not get them to consistently talk.
Resolved/worked around it by putting a raspberry pi in between to communicate to the stm32 via it's UART pins.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-05-01 5:30 AM
Make sure BOOT0 is pulled to ground.
Double check all RCC, GPIO and USART clocks/pins are explicitly enabled. ie not left to assumption
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-05-02 4:34 AM
Thanks for your reply. I did re-check the above thanks.
FYI I managed to resolve this.
This turned out to be an issue with the ground between the host pc and the stm32. (Issue on the host side or cable)
Picked it up when I connected the oscilloscope and suddenly everything worked.
Once you disconnect the probe ground pin the issue would occur again.
Never mind what I did ground wise I could not get them to consistently talk.
Resolved/worked around it by putting a raspberry pi in between to communicate to the stm32 via it's UART pins.
