cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F030F4Px USART problem

NSing.5
Senior

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.

7 REPLIES 7

1st thing, post your code

NSing.5
Senior

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

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

Pavel A.
Evangelist II

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

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

sir are you able to diagnose it?

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