Arduino serial transmit block limited step time
2 views (last 30 days)
I´m sending data from my Arduino Mega 2560 to my computer using matlab 2013a and the simulink support package. As a guide I used this: http://www.mathworks.de/de/help/simulink/ug/configure-serial-communications.html#bthsi0o
The setup is very simple with a poti at an analog input as source. The analog input block detects the values and a header and a terminator are added. Then the serial transmit block is used to send the data. This model is built and laoded on to the arduino:
To read the data I´m using another simulink model which is running on my computer. It inlcudes a serial recieve and a serial configuration block.
As long as i set the step-size of both models to a value higher than 20 milliseconds everything is working fine and I recieve data in "real time" so there shouldn´t be a problem with the port or something like that.
But if I reduce the step-size to 10 milliseconds it seems like something is too slow. I still recieve data but it is dalyed and the delay gets bigger until the model hangs.
I tried to run the model for 20 seconds with different step-size and baud rate:
So there is no dependence on the baud rate but if the step-size is decreased there is not enough data transmitted.
Does anyone know about a limitation for the step-size when using the serial transmit block or what else could be the problem? If you need more information about something please ask. Thanks!
Ajay Joseph on 30 Jan 2018
Where do you find those green blocks? Is it only for Arduino Mega 2560 package? I have been searching for the Header and Terminator for a long time. Also, the one in the middle is missing from my library. What am I missing? Any help will be much appreciated.
Sudeshna Bhattacharya on 2 Feb 2018
The issue happened in MATLAB R2013a. The Arduino Serial blocks have been enhanced to support array, multiple datatypes, etc. in R2016b and R2017a. Try checking in the latest release. If the issue still persists in newer release then provide the model.