Hi Matt, guys,

I've been trying to migrate 18f4550_slip_poll.jal sample to use USB serial
instead of serial hardware as the carrier. I had to do several
modifications, and now have questions what I should expect to get when
sending/receiving SLIP packet.

But first, I had to put the "send SLIP packet" under a CDC line status check
logic:


var bit has_sent_packet = FALSE
-- your main loop
forever loop
   usb_serial_flush()
   if usb_cdc_line_status() !=  0x00 then
      if !has_sent_packet then
         send_slip_packet()
         has_sent_packet = TRUE
      end if
   else
      has_sent_packet = FALSE
   end if
   slip_poll() -- poll to receive slip data
   -- do other stuff but don't take too long
end loop


It seems CDC requires the serial port to be opened before any communication.
There isn't any kind of buffer: if I put the send_slip_packet() while CDC
status isn't ok, I don't receive anything. And when I put it before the
forever loop, while device is being configured (CDC status becomes OK at
this time), it's been called but I don't receive anything either later. Is
it right to say there's no buffering when using CDC ?

Now, about SLIP comms, here's what I have:

 1. I connect to the device (/dev/ttyACM0) using a python script.

 2. since the port is opened, CDC status is OK and I receive a SLIP packet.
In sample, test_data = {1,2,3,0xC0,5,6,0xDB,8,9,10}, and I receive: {0xc0,
1, 2, 3, 0xdb, 0xdc, 5, 6, 0xdb', 0xdd, 8, 9, 0xc0}.
    - So far so good, but: why does it start with a SLIP END char ?

 3. now I send back the same packet: {1,2,3,0xC0,5,6,0xDB,8,9,10}. Since the
code is supposed to echoed the data back, I would have expected to
get  {0xc0, 1, 2, 3, 0xdb, 0xdc, 5, 6, 0xdb', 0xdd, 8, 9, 0xc0}, as before.
But I have: {'A', 'T', '+', 'G', 'C', 'A', 'P', '\r', '\n', 'A', '\x00',
'\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00',
'\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x01', '\x02',
'\x03', '\xc0', '\x05', '\x06', '\xdb', '\x08', '\t'}
     - packet size is 36, which is greater than MTU (10).
     - I really don't understand where those first chars comes from
     - it seems there's some kind of padding with 0x00

 4. If I send the packet again, I now receive {'\x01', '\x02', '\x03',
'\xc0', '\x05', '\x06', '\xdb', '\x08', '\x09'}
     - why SLIP END appears again in the middle, after 3 ?


Do you have any idea what I'm doing wrong ? Attached is my sample...

And, does anyone know a program under Linux to talk in SLIP ?



Cheers,
Seb

-- 
You received this message because you are subscribed to the Google Groups 
"jallib" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/jallib?hl=en.

Attachment: jaluino_medium_slip_poll.jal
Description: Binary data

Reply via email to