Parsing data from Nordic Serial Interface Board using Matlab

I am using two nRF24L01+ transceivers for a project: one with a microcontroller to gather data, and another with the Nordic serial interface board to receive data. I am running into issues with using the interface board. I am trying to use Matlab to change the nRF24L01+ receiver config and to parse the received data. The resulting parsed data that I store in a text file is different from what I expect.

I have my transmitter sending groups of 4 bytes (because the serial interface board receives in groups of 4). The first two bytes contain my gathered data (0x00 to 0xFF), and the second two bytes are 0x05 and 0x06 (arbitrarily chosen; I originally used these bytes to keep track of time, but now am using them to try to troubleshoot my problems).

Here is the Matlab code that I used for my Nordic serial interface board receiver:

%parsing 4 byes at a time from the nordic serial interface board
s = serial('COM9');
s.InputBufferSize = 10000;
s.BaudRate = 9600;
fopen(s);
fileID = fopen('airtest3.txt','wt');

total = 0;

pause on;
pause(5);               %wait for interface to init and do its 1500ms pause
fprintf(s, int2str(33)) %write to autoack register. 0x21 = 33
fprintf(s, int2str(63)) %enable autoacks. 0b00111111 = 63

while 1
   total = total + s.BytesAvailable;
   while total >= 4
        out = fread(s,4,'uint8')
        fprintf(fileID,'%u\t%u\t%u\t%u\n',out);
        total = total - 4;
   end
end

fclose(s)
delete(s)
clear s
fclose(fileID)
fclose(instrfind)

This is what is saved in my text file output:

206	126	130	207
121	130	207	121
130	205	119	130
205	119	130	205
etc.

I expected at least some sort of 4-byte pattern, but the output repeats every 3 bytes. I don’t think I’m dealing with data types correctly here, but I’m stumped about what to do next.

I don’t think that my problem originates from the transceiver. I scoped the SPI pins and they seem normal (commands are fine, MISO is sending back the status register, sclk is clocking).

What do other people use to talk with the serial interface board?

Thanks!

Solved – not using MATLAB to read data anymore