Skip to main content
NSing.5
Associate III
March 24, 2023
Question

STM32F030F4Px USART problem

  • March 24, 2023
  • 3 replies
  • 3516 views

i'm using STM32F030F4Px for MODBUS Master Slave communication based on USART (RS485 communication). i'm using 9600 baud rate, 8bit 1 stop bit communication with DMA and HAL.

Master is transmitting 8 bytes to slave after 10 or 20 msec which are received at slave end perfectly.

However, when slave responds to master, the slave stops receiving data from master.

This topic has been closed for replies.

3 replies

Karl Yamashita
Principal
March 24, 2023

1st thing, post your code

If a reply has proven helpful, click on Accept as Solution so that it'll show at top of the post.CAN Jammer an open source CAN bus hacking toolCANableV3 Open Source
NSing.5
NSing.5Author
Associate III
March 26, 2023

as suggested, the main file is attached here. i would like to share, that when i'm using STM32F730 (as a slave) with same program it is working perfectly. However, in that case the master (STM32F0) is not receiving response.

Regard

NSing.5
NSing.5Author
Associate III
March 30, 2023

sir are you able to diagnose it?

NSing.5
NSing.5Author
Associate III
March 26, 2023

as suggested, the main file is attached here. i would like to share, that when i'm using STM32F730 (as a slave) with same program it is working perfectly. However, in that case the master (STM32F0) is not receiving response.

Regards

Karl Yamashita
Principal
March 30, 2023

When you call HAL_UARTEx_ReceiveToIdle_DMA you don't check for HAL status to be sure the interrupts were enable again.

Check this post where i share some code on how to check HAL status and set a flag if not successful. I check the flag in polling routine and try to enable the interrupt again. The same goes for transmitting, though I'm using HAL_UART_Transmit_IT instead of HAL_UART_Transmit_DMA, but checking HAL status would still be the same.

https://community.st.com/s/question/0D53W00002CeLaOSAV/cannot-receive-full-string-on-uart-receive-st32h745-disco-board

If a reply has proven helpful, click on Accept as Solution so that it'll show at top of the post.CAN Jammer an open source CAN bus hacking toolCANableV3 Open Source
Pavel A.
March 26, 2023

Have you tried to debug the master? When the master "is not receiving response", maybe it has crashed?

NSing.5
NSing.5Author
Associate III
March 30, 2023

I'VE CHECKED IT. The master is continuously transmitting to slave after a fixed duration. but not receiving response from slave (stm32f730)