Closed wonderfulnx closed 3 years ago
This is because TSCH_SCHEDULE_AND_YIELD()
switches the context in Cooja to another mote and puts the current mote in a sort of sleep. Cooja motes are scheduled with the granularity of a millisecond. Therefore, the minimum sleep time is one millisecond, which corresponds to 1000 Cooja mote rtimer clock ticks.
It's possible to change this minimum sleep time in the source code of the Cooja (under cooja/contikimote
), but the simulation will become slower.
Thank you! I finally managed to change the sleep time in cooja/contikimote/interfaces/ContikiClock.java
and it works exactly as you say now.
Using the example of 6tisch/simple-node, if set CCA with
#define TSCH_CONF_CCA_ENABLED 1
, the node will miss the deadline of transmitting. I added the following code intsch-slot-operation.c
to show the time offset of every statge.It seems that
RTIMER_BUSYWAIT_UNTIL_ABS()
function waits for 1000 ticks instead of 128 for the CCA process. It's wired since this function works well everywhere else.