Hi,
I’m writing my own application to control my Velbus setup from a linux environment (Yes, I know this has been done before, but it’s fun to do it myself), and eventually from a web browser using cool AJAX/websocket tricks. I’ve read and re-read the provided documentation (which, I must add, is really great!), but still have some unsolved issues around flow-control.
The VMB1RS (and probably VMB1USB as well) connects to the Velbus at 16.6kbps and towards the computer at 38.4kbps. Since these speeds don’t match, there is a need for flow control (otherwise, the computer would swamp the VMB1RS module). I was happy to see that there is, indeed, a RxBufferFull message defined, but I haven’t been able to figure out how to use this in an efficient way:
The obvious, but painfully slow way to do this is to send the packets one-by-one; waiting an arbitrary time in between for potential RxBufferFull messages, or polling for them after every packet. As already stated, this is painfully slow, and ruins the entire concept of buffering.
The very optimistic approach would be to send packets until on RxBufferFull is received. This does not work, since by the time you processed the RxBufferFull message, the UART will still be sending out packets (which will be lost in the overflowing VMB1RS’s buffer).
What is the correct way to do this flow-control?
PS: I also considered just throttling the output by just waiting a specific time between packets (without regard to RxBufferFull messages), but decided that this would not work: it assumes the VMB1RS will be able to send messages continuously, which is only the case if there is no other bus activity.