I am performing a control analysis on an Arduino board.
As such, I want to minimize the board cycle duration.
(Faster board = faster controller).
Introduction:
I use Mathworks Matlab/Simulink to program the board.
I created a model in Simulink,
and embedded this model into my Arduino Mega 2650.
The model includes an Arduino Serial Transmit block.
I am therefore able to use Matlab software on my PC to request
serial transmission from the Arduino board to Matlab.
The Arduino Mega 2650 has the following serial constraints:
- Maximum output buffer: 64 [byte]
- Maximum baud frequency: ~115,000 [bit/s]
Problem:
To perform my control analysis,
I want to minimize the board cycle duration, and
I want to read several signals simultaneously.
The time it takes to read all signals sent
(as dictated by the baud rate)
is the primary obstacle in reducing my board cycle duration.
Requested Information:
Is it possible to reduce the board cycle duration
without reducing the duration in which
the serial transmission must be completed.
For example,
what if I run my board at 0.001 [s],
but I can only send all of my signals in 0.010 [s],
what will happen during my reads?
If I read every 0.001 [s], obviously I will not receive all of the data,
as this is not feasible in the time that I am allotting.
My concern is regarding what will happen if I read every 0.010 [s]:
- Will the passing of several board cycles before the read completes affect the read?
- Is there a method to lock the serial output buffer while reading
(such that the data does not change midread)? - How long does it typically take to refill the serial output buffer with the next set of data?
Conclusion:
Ultimately, I would like to run the board as fast as possible,
since I believe that this could significantly improve my controller's performance,
despite not being able to read these additional cycles.