Re: xPC Binary Fifo Problem



I hadn't considered ignoring that. That would make most of
the headers a single byte long (the "command being
acknowledged" byte) with a few being 2 bytes long rather
than all of them being 2 bytes long. The concern now would
be whether data being returned as part of one command's
packet could trigger the code to think that it was the
header of a different command. I will experiment with this
to see if it works with the data streams we need to handle.

Thank you,
Walter

Gordon Weast <gweast@xxxxxxxxxxxxx> wrote in message
<fnqkfl$7ti$1@xxxxxxxxxxxxxxxxxx>...
Is the two character pattern 0xee, 0x11 sufficiently
unique? That is, just skip the null byte in the search
pattern. That would work as long as the null isn't in
the middle of the pattern.

The null will be skipped over and not returned out the
receive port of the fifo read if you do this.

Just remember to reduce the length you expect by one if
you do this.

The block uses the well tested strncmp() C library routine
to check for the pattern. This routine stops when it finds
a null in either string.

Gordon Weast
xPC Target Development
The MathWorks

Walter Collins wrote:
I'm trying to communicate with a device over the serial
port. The device returns acknowledge packets for every
command issued. The packets are a binary structure
consisting of:
<data length in bytes><byte representing the command being
acknowledged><data bytes if any><check sum byte>

For most commands, there is no data returned in the
acknowledge so it's simply returning 0x00 0xee 0x11 (if, for
example, the command it's acknowledging is command code
0xee.

I'm running Matlab R2006a with the associated Simulink and
xPC versions that go along with it.

The problem I'm encountering is that the binary header FIFO
under the serial system has problems with headers that start
with 00. Firstly, they will latch onto any packet that
starts with 00, regardless of whether the remaining bytes of
the header are correctly. Secondly, any packet it does pass
always comes out the first port of the FIFO.

To test this, I modified the xpcserialbinarytest.mdl demo. I
set the FIFO settings as follows:
Header:
{char([40,66,190]), char([40,68,188])}
Message Lengths:
[3 3]
Output behavior: Zero output if no data
Enable input (unchecked)
Maximum read size:
40
Sample Time:
trun

This behaves as it should. If I send a packet of 0x28 0x42
0xbe, one output of the FIFO spits the packet out. If I send
a packet of 0x28 0x44 0xbc, the other output of the FIFO
spits the packet out. (My apologies for the hex and
decimal.)

Now if I change the headers in the FIFO block to:
{char([00,66,190]), char([00,68,188])}
Sending 0x00 0x42 0xbe sends the packet out on the first
output of the FIFO. Sending 0x00 0x44 0xbc sends this packet
out on the first output of the FIFO. Sending 0x00 0x01 0x02
will even send this packet out on the first output of the
FIFO, even though this packet is clearly neither of the
headers specified.

Is this a known bug that's been fixed in a more recent
release or is there a simple work-around?

Thanks,
Walter

.



Relevant Pages

  • Re: xPC Binary Fifo Problem
    ... In general you'll be looking for one of the headers ... packet could trigger the code to think that it was the ... header of a different command. ... The problem I'm encountering is that the binary header FIFO ...
    (comp.soft-sys.matlab)
  • Re: xPC Binary Fifo Problem
    ... Is the two character pattern 0xee, ... The problem I'm encountering is that the binary header FIFO ... any packet it does pass ... Now if I change the headers in the FIFO block to: ...
    (comp.soft-sys.matlab)
  • xPC Binary Fifo Problem
    ... <byte representing the command being ... The problem I'm encountering is that the binary header FIFO ... any packet it does pass ... Now if I change the headers in the FIFO block to: ...
    (comp.soft-sys.matlab)
  • [PATCH 19-rc2] Fix misc .c/.h comment typos
    ... Implements an interface for i2c compatible eeproms to run under linux. ... Changed struct initializer syntax to the currently preferred notation ... ** Packet is an actual packet structure to be filled in with the packet ... -** as the command processore doesn't process the command packet in any way. ...
    (Linux-Kernel)
  • Re: tool to interpret packets? and Qs about lineout!
    ... > not as far as packet format and types are concerned. ... Referring to an input command which 'could' have been issued to ... the server which end with a request for the ... it is possible to implement the Kermit protocol itself in a Kermit ...
    (comp.protocols.kermit.misc)