Skip to content

Conversation

@kfoltman
Copy link
Collaborator

@kfoltman kfoltman commented Oct 7, 2025

This change reduces the overall impact of Modbus communication by only waiting for the TX FIFO at the start of the message and then sending the remaining characters from an interrupt handler as the previous characters leave the FIFO.

The drawback is that the interrupt handler may be called during time-sensitive parts of the processing of Ethernet packets. However, in practice, this produces much less impact than using blocking writes - the time wasted waiting for the UART to send the data is much greater than the time it takes to send the characters when there's space in the TX buffer. And the Modbus protocol itself is time sensitive, too - the end of the message is determined by a break in the transmission.

The change has been tested quite extensively using a 2.2kW Fuling inverter. The support for the Weiken inverter (WK600) is still a work in progress. Huanyang inverters should work, but IIRC I haven't tested it after making the changes. There might be some timing nuances that might require further adjustments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants