Delay in Packet Output under Real-Time Windows Target
2 ビュー (過去 30 日間)
古いコメントを表示
I tried to verify the real time capability of the Real Time Windows Target. I built a Simulink model that send out a data from a laptop to an Arduino through the USB port. The Arduino immediate sent back the data. The model was run at a real time windows target. It read a one-byte signal through Packet input and sends a one-byte signal through Packet Output to an USB com port. The Packet Input is executed ahead of Packet Output. The execution order is enforced by setting the priority property.
I recorded the outputs of Packet Input and the input of Packet Output blocks. I expect to see one-step delay between them.
The test shows that the serial communication was not executed in real time in the Windows Target. Data seems to be stuck in the buffer of the UART chip some time. Once in a while, Rx Data Ready became false when the sampling period is 0.01 s. The signal is delayed one more step every time this happens. This is not acceptable for real time control.
The problem will not occur when the sampling time is larger, e.g., 0.02 s and happen more often with small sampling period.
Is this normal and unavoidable? Is there a way to clear the transmit buffer at the laptop to eliminate the accumulative delays?
1 件のコメント
Vittorio Lippi
2016 年 2 月 25 日
編集済み: Vittorio Lippi
2016 年 2 月 25 日
I had the same problem, actually the reason was trivial. The baudrate set for the serial communication was 9600, too slow for the amount of data that i was producing. maybe your packet was slightly above 96 bits (it is not a lot... 3 int32 are already enough..)hence with 100Hz you were exceeding the baudrate, while with 50 Hz you were not.
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Target Computer Setup についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!