'Error on UART reception (Matlab), partial reading
I've generated a FFT algorithm running on a Xilinx Artix7. At the end of the fft calculation the algorithm send data to a computer by UART connection. I've checked my output on FPGA board with a debugger , it's look perfectly fine. Still Matlab receive only partial data. If I generate successive slope for instance on 10 slopes 2 or 3 will be fine, during the rest of the time I have something looking like a noice.
If someone have ever encounter this issue, or have good use on Matlab UART com it will be helpful, here is my Matlab code:
s = serial('COM6'); %assigns the object s to serial port
set(s, 'InputBufferSize', 512); %number of bytes in inout buffer: you have the choice between several values : 128,256,512,1024;
set(s, 'FlowControl', 'hardware');
set(s, 'BaudRate', 115200);
set(s, 'Parity', 'none');
set(s, 'DataBits', 8);
set(s, 'StopBit', 1);
set(s, 'Timeout',10);
%clc;
disp(get(s,'Name'));
prop(1)=(get(s,'BaudRate'));
prop(2)=(get(s,'DataBits'));
prop(3)=(get(s, 'StopBit'));
prop(4)=(get(s, 'InputBufferSize'));
disp(['Port Setup Done!!',num2str(prop)]);
fopen(s); %opens the serial port
disp('Running... waiting for datas...put the reset "off"');
x=0;
a =fread(s); %reads the data from the serial port and stores it to the matrix a
x=[a];
disp('Courbe tracée!');
fclose(s); %close the serial porty
plot(a)
%%traitement
a=a';
T = [0,255,0];%find this sequence
out = strfind(a,T)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
