Writing to an Arduino using MATLAB

Hello!

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?

Wastora:
Hello!

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?

Never mind, It’s working now.