Filter löschen
Filter löschen

Virtual Serial Port Data Loss

6 Ansichten (letzte 30 Tage)
Benjamin
Benjamin am 18 Mär. 2013
Here is my problem I am using the serial command to read a virtual usb serial port. I need to read data at about 2 MHZ. However, it seems that matlab is unable to read the data without loss. I am wondering how to fix this problem.
Here are the following things I have tried
data.portObject = serial(portToOpen,'BaudRate',baudRate,'StopBits',1, 'InputBufferSize', 65536,'BytesAvailableFcn', @breakCallBack, 'BytesAvailableFcnMode', 'byte', 'BytesAvailableFcnCount',1024 );
Where break call back is
function breakCallBack(obj, event)
fread(obj, 8196, 'uint8');
I have obviously also tried to use a break interrupt function with no success even though my sending microcontroller was stalling in between data the function was never called.
I have tried switching the different numbers around to different values to see if the input buffer wasn't large enough ect.
I believe that the micro controller is sending 1 bit.
I tried different sorts of flow control and checked the number of data bits.
Does anyone have any insight as to why the communication channel is losing data when read by matlab?
I have checked the transferred data and it appears to be losing about 10% of the data being set.
I am willing to provide more information if neccesary.
  4 Kommentare
Benjamin
Benjamin am 18 Mär. 2013
1) I meant that it is sending one stop bit. 2) I can change it it doesn't make a difference.
Benjamin
Benjamin am 18 Mär. 2013
So i was using the larger number of bytes so that the function was not interrupted by a bytes available command in the middle of processing the input

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Startup and Shutdown finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by