have you had a look at the SerialTransfer library?
Looks interesting library. Generic for pretty much any communication. However, if I understood the code correctly, it does not have a flow control which means that I cannot really use it. The reason for flow control in my case is the utilization of tasks. One task is for communication and it's execution is not in sync with the other controller. Therefore, when I want to send from another controller data to another, I have to start the communication at sender side, wait until receiver responds and then rest of the payload can be transmitted quickly. Receiver side task needs to run preferably much faster than sender side to prevent long wait times which is no go at sender side since this is not pre-emptive OS but co-operative. I was using FreeRTOS earlier but SPI communication and Modbus/RTU libraries are not thread safe thus both failed to work. Controls are fine and now I could revert back to FreeRTOS at the sender side thus making the communication between Arduinos independent from control tasks. At receiving side it doesn't matter if the task period varies a bit.
Did some measurements and it's pretty fast actually in sending and receiving 36 bytes of data.
- Sending in total (taking us time before and after function call) takes 612 to 620us.
- Receiving is faster. Taking only 276-284us.
- Oscilloscope shows 836us for total transmission. No fluctuation in duration.
Due to other tasks being run and quite a bit of debug info being printed, I have to slow down the sending task to 200ms to avoid zero timeouts. 150ms was quite OK until I started (debug) printing out the content.
This should work just fine for display purposes but not for development where I need to debug print quite a bit for Teleplot (really nice add-on if you didn't know it already). Have to debug print this directly from controls board which slows down the controls period..
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.