TG9541 / stm8ef-modbus

A lightweight framework for MODBUS RTU nodes in STM8 eForth that can do more than just I/O
https://github.com/TG9541/stm8ef/wiki/Board-C0135
MIT License
32 stars 12 forks source link

First transmission after reset may release the bus too early #45

Closed TG9541 closed 2 years ago

TG9541 commented 2 years ago

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

TG9541 commented 2 years ago

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.