cetic / 6lbr

A deployment-ready 6LoWPAN Border Router solution based on Contiki
github.com/cetic/6lbr/wiki
Other
338 stars 196 forks source link

SLIP timeout on cc13xx #302

Open arurke opened 7 years ago

arurke commented 7 years ago

Using a sniffer, I happened to notice my GW sometimes transmitted several bursts of DIOs at each interval instead of the expected single burst. Digging into the 6lbr.log (see bottom) it seems the 6lbr sends the DIO to SLIP, however it does not receive an ACK within the timeout (0.2 seconds), which triggers a packet timeout and re-transmission of the DIO to the SLIP. The ACK for the first burst is received shortly after, indicating the SLIP is functional - just a bit too slow.

I wonder if this could this be related to the updated timings on the cc13xx platform https://github.com/contiki-os/contiki/pull/1931 ? According to my calculations, transmitting a broadcast with STROBE_TIME and CCAs takes ~190 ms. So if we add serialization on the serial line and some processing we are awfully close to the 0.2 second timeout (from log snippet below, ACK is received after ~210 ms). I have not had the opportunity to test using earlier software yet, but I am pretty certain I have not seen this before.

Have I understood the mechanisms between SLIP and GW correctly? And if so, I guess the simple solution is to increase the timeout?

6lbr 1.4.1 Vanilla contiki SLIP (460800 baudrate) on cc1310

22:12:38.616183: PACKET: PF: bridge_output: Sending packet to Broadcast
22:12:38.616800: PACKET: PF: wireless_output: sending packet
22:12:38.617121: PACKET: PF: eth_output: broadcast
22:12:38.617526: PACKET: BR-RDC: write: 80 (sid: 2, cb: 1)
22:12:38.617760: DUMP: BR-RDC: 
(omitted)    
22:12:38.625210: PACKET: SLIP: write: 111
22:12:38.625431: DUMP: SLIP: 
(omitted)
22:12:38.816921: ERROR: BR-RDC: br-rdc: send failed, slip ack timeout (2)
22:12:38.826152: PACKET: SLIP: read: 5
22:12:38.826609: DUMP: SLIP: 
(omitted)
22:12:38.827303: TRACE: SCMD: Got configuration message of type R
22:12:38.827528: PACKET: SCMD: Packet data report for sid:2 st:0 tx:1
22:12:38.827752: PACKET: BR-RDC: sid ack: 2 (0, 1)
22:12:38.827972: ERROR: BR-RDC: br-rdc: ack received for unknown packet (2)
22:12:39.050141: PACKET: BR-RDC: write: 80 (sid: 3, cb: 1)
22:12:39.050622: DUMP: BR-RDC: 
(omitted)
laurentderu commented 7 years ago

Indeed, the slip timeout is now 200ms instead of the previous 2 seconds. As you receive an ACK of an unknown packet it is clearly a too short timeout.

Now the 2 seconds timeout was way too long, but on the other hand I may have been too harsh with setting it to 200ms, I will change it to 250 or a bit more.