Prev: Genetic Algorithms in MATLAB
Next: 3D ROI
From: Mark on 27 May 2010 18:40 Hello World! I am using MATLAB to write data to an Arduino. In MATLAB, I use the function fwrite to send 10 x 512 bytes of data and transmit this via the Arduino with an NRF24L01 like this: for i = 1:10 data = (vector containing 512 bytes of data) fwrite(s,data) end However, this seems to fail, since only 25% of the data reaches the Arduino correctly. When I use the same Baud rate with the following code, it works properly: for i = 1:5120 data = (1 byte of data) fwrite(s,data) end Can anyone tell me why the first code fails? The problem must lie in the time between bytes, since the duration of sending 1 byte is always the same. Why should the time between bytes matter?
From: Walter Roberson on 27 May 2010 18:50 Mark wrote: > I am using MATLAB to write data to an Arduino. In MATLAB, I use the > function fwrite to send 10 x 512 bytes of data and transmit this via the > Arduino with an NRF24L01 like this: > > for i = 1:10 > data = (vector containing 512 bytes of data) > fwrite(s,data) > end > > However, this seems to fail, since only 25% of the data reaches the > Arduino correctly. When I use the same Baud rate with the following > code, it works properly: > > for i = 1:5120 > data = (1 byte of data) > fwrite(s,data) > end What is your flow control set to? Hardware flow control, one hopes. > Can anyone tell me why the first code fails? The problem must lie in the > time between bytes, since the duration of sending 1 byte is always the > same. Why should the time between bytes matter? The NRF24L01 appears to be a packet-oriented device, and is going to need time to transmit each packet. The device has only a 32 byte RX and TX buffer. http://www.nordicsemi.no/files/Prod_brief_RFSilicon_nRF24L01.pdf
|
Pages: 1 Prev: Genetic Algorithms in MATLAB Next: 3D ROI |