Warning: Unsuccessful read: The specified amount of data was not returned within the Timeout period.. "
Show older comments
Hi,
I am sending data to Arduino serially, and I want it to read them and return them back to me.
The MATLAB code is
s=serial('COM4','BaudRate',9600);
set(s, 'TimeOut', 10);
fopen(s);
for i = 1:50
fwrite(s, i, 'uint8');
rx(i) = fread(s, 1);
end
fclose(s);
The error message I get is: " Warning: Unsuccessful read: The specified amount of data was not returned within the Timeout period.. "
I have read some possible causes for that problem such as the TimeOut period which I turned to 10. However I still get the same message. Can anyone help please?
Answers (2)
Arpita Agrawal
on 16 Jul 2018
0 votes
Is there a code that is running on Arduino which is sending data over serial. If so, please share that as well. There is a possibility that the timeout occurs even before the hardware is sending the data.
1 Comment
Angeliki Zafeiropoulou
on 6 Aug 2018
Arpita Agrawal
on 7 Aug 2018
0 votes
Hi Angeliki,
This implementation should work. Please verify that the Arduino board is able to send the data over Serial once using the 'DigitalReadSerial' example. If that is working well, probably you can try to increase the timeout value and check once. For further questions on this please contact MathWorks Technical Support.
Thanks Arpita
2 Comments
Angeliki Zafeiropoulou
on 7 Aug 2018
Edited: Angeliki Zafeiropoulou
on 7 Aug 2018
Arpita Agrawal
on 7 Aug 2018
Hi,
You can try configuring the timeout on MATLAB, if you are able to read the data over Arduino Serial Monitor using the Example.
Thanks Arpita
Categories
Find more on MATLAB Support Package for Arduino Hardware in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!