Dear colleagues,
I'm using a SDM-SIO4 connected to a datalloger CR1000 to collect data from 3 distinct sensors: a inertial sensor, a weather station and a current profiler. I'm experimenting data loss from the inertial sensor after a while. I'm wary that the problem consists on the buffers' flushing, which I've written as the CRBasic SDMSIO4() command example. After each data collection from any serial port (command 4), I ask to flush the Rx buffers (command 3) and processed data storage buffer (command 9), as I saw in the CRBasic example. I want to know if the data collected from the SDM-SIO4 by the datalogger is automatically flushed after they are sent to the CR1000. When is the right time to flush the buffers without losing information? Do the commands 3 and 9, sent to the SDM-SIO4 from the datalogger, clean all ports' buffers?
Regards,
Francisco.
The data is always flushed as it is processed or read. If you flush it after reading data and the data is being sent asynchronously, i.e. it is not coming in response to polling the sensor, then you risk flushing the buffers mid-way through receipt of data which will lead to corrupted data.
Generally you only need to flush buffers before sending a poll command so you start with a clean slate.
Thank you for your attention. You've cleared a lot of things.
Regards,
Francisco.