baseboard serial receive fifo
이전 댓글 표시
Hello,
I'm using baseboard serial fifo out block to receive data @ 1kHz from an external device.
The device sends a unique header byte at the beginning of each message packet.
However, message length isn't fixed. For that reason, I decided to use ordinary fifo read block instead of fifo bin read. So, I wrote my own state machine to sync with messages.
The fifo read block is configured as count + uint16 array.
even though it is working without any problem mostly, sometimes it gives some strange values.
for example,
4 39(header) byte1 byte2 checksumbyte is what I'm expecting.
But fifo read block sometime gives me something like : 4 <some integer above 255> byte1 byte 2 checksumbyte or 4 39 <some integer above 255> byte 2
what does that mean when an element of fifo read is greater than 255? Simple decomposition of that uint16 value into two uint8 values just gives some random numbers.
Any help is appreciated.
댓글 수: 8
Walter Roberson
2016년 7월 24일
Please show the line of code you use to read the port.
Gorkem
2016년 7월 24일
Walter Roberson
2016년 7월 24일
Could you give a specific example of expected values and received values?
Gorkem
2016년 7월 24일
Walter Roberson
2016년 7월 24일
The rows that are coming out wrong: what would be the correct values for those rows?
When the rows come out wrong, is the checksum correct for what the data should be, or is it correct for what the data is ?
I notice that you say that the count is the number of bytes in the receive fifo, but your diagram reads uint16. Although it is technically possible for a byte to be 16 bits, in my experience it is very rare for a byte to be anything other than 7 bits (serial transmit only), 8 bits (by far the most common), 9 bits (used in some computers in the late 1970's; also used for serial transmit with parity), or 10 bits (serial transmit only, counting the start bit)
Gorkem
2016년 7월 25일
Walter Roberson
2016년 7월 29일
Because it is not configured as 8 data bits. Your screen snapshot shows you have configured for 16 bit output.
답변 (3개)
카테고리
도움말 센터 및 File Exchange에서 RS-232에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!