Serial port timeout- 10 seconds, but getting less samples than expected/desired

8 visualizaciones (últimos 30 días)
Dear Sir/Madam,
I have the following error while trying to access serial port data sent from Nios II UART: The specified amount of data was not returned within the Timeout period or A timeout occurred before the Terminator was reached.
The above error occurs when I set the timeout to be smaller than 10 seconds, say 2 seconds, or 6 or 8 etc.
set(s,'BaudRate',115200,'timeout',10); %timeout is in seconds.
If I set the timeout to be as '10' or larger, I did not get the timeout error, however, with this timeout, the sample rate is 0.067Hz and the total number of samples I can obtain is only 493 in 120 minutes which is far too less. In similar system with timeout set to 2 seconds, we can get 46253 samples in 120 minutes with sample rate= 5Hz. (this worked previously when no Nios system is used, just FPGA)
What I think: I am getting so less samples because the Matlab needs to wait longer now compared to previous system where no Nios is used.
What I dont know and need your opinion: how to increase the number of samples to be received? how to increase the sample rate?
What is in my system (in C Code) : In main, the main calls for function "uart_multiple", I have 12 sets of data to be sent to the serial port, each set of data has 10 elements ('n' represents 10 bytes, one element is ONE byte), so I transmit one set of data one by one.
I suspect this could be the cause of low sample rate, but I am not sure.
Do you think we can transmit all 12 sets at the same time to avoid this issue?
If it is, what should I do to transmit all 12 sets at the same time?
int main () { uart_multiple (&txdata1, n);
uart_multiple (&txdata2, n);
uart_multiple (&txdata3, n);
uart_multiple (&txdata4, n);
uart_multiple (&txdata5, n);
uart_multiple (&txdata6, n);
uart_multiple (&txdata7, n); uart_multiple (&txdata8, n);
uart_multiple (&txdata9, n);
uart_multiple (&txdata10, n);
uart_multiple (&txdata11, n);
uart_multiple (&txdata12, n);}
Thank you in advance

Respuestas (1)

Michael Du
Michael Du el 18 de Dic. de 2019
I have similar questions. Matlab seems to set an upper limit to the serial port timeout of ~20ms and the serial input size of 2kB. So there is an issue if one wants to use the serial port to transmit data larger than the specified size.

Categorías

Más información sobre MATLAB Coder en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by