TG9541/stm8ef-modbus

First transmission after reset may release the bus too early

Closed this issue · 1 comments

While working on #44 it turned out that, under certain conditions, a MODBUS Server releases the bus after the second to last byte. The last byte won't be sent on the bus.

The following trace shows the UART TX in D1 and the RS485 transceiver direction in D2:

image

The problem has been identified: RM0016 22.7.1 states that the TC flag has to be cleared by first reading UART_SR and then writing UART_DR. This condition is met - by accident - after the first transmission.

I'm working on a solution that fixes the problem and also takes advantage of >REL.