energia / EasyLink

EasyLink library for the CC1310 LaunchPad
15 stars 2 forks source link

Rx timeout not respected #4

Open battosai30 opened 7 years ago

battosai30 commented 7 years ago

Hi,

Using the Rx example, I observed that the specified rx timeout is not respected and it seems to be random.

Any idea ?

Regards

robertinant commented 7 years ago

How did you measure the tx timeout? Do you have an example Sketch that shows the issue? In my tests here, the timeout with nobody transmitting is always the set timeout.

battosai30 commented 7 years ago

It's not hard to measure, it's really obvious if I set it to 1000 ms, I clearly see that it's not a second if it doesn't simply hang. The code is the EasyLink RX example

robertinant commented 7 years ago

I just reproduced myLink.receive(&rxPacket); blocking if no TX node is active. Looking into it.

robertinant commented 7 years ago

We figured it out. This was a misinterpretation of the rxTimeout member of rxPacket. The rxTimeout is actually expressed in RAT (Radio Ticks) vs milli seconds.

Replace: rxPacket.rxTimeout = 1000; with rxPacket.rxTimeout = EasyLink_ms_To_RadioTime(1000);

And you should see a 1000 ms timeout.

Robert

battosai30 commented 7 years ago

Ok I will test it in a couple of hours.

I saw this potential problem but I thought that the tick to ms conversion was done in the library.

robertinant commented 7 years ago

It should have been but was not. I will fix it and convert from ms to RAT for txTimeout in the library. I will also add an optional parameter so that setting the .txTimeout is optional but then add an optional parameter with the rxTimeout in ms.

battosai30 commented 7 years ago

I confirm it's okay