[Avrora] Avrora event dispatch bug?

Mac Brown macbrowny at yahoo.com
Mon Jan 4 23:47:29 PST 2010

Hi ,

I am trying to fix some bugs in Avrora emulation of dataflash in Mica2 nodes((www.atmel.com/dyn/resources/prod_documents/doc3595.pdf). It looks like the bug might be incorrect dispatch of events by the scheduler.

Avrora's mica2 data flash emulator didn't correctly insert delays for operations that keeps the device busy. Without the delay, the device is always ready and hence it would work (records data into memory). However, it will violate timing properties exhibited on real motes and also, report incorrect energy usage values. 

To fix this bug, I inserted correct delay values as specified in the manual for AT45db041d (www.atmel.com/dyn/resources/prod_documents/doc3595.pdf). With the new delay values inserted, the device stopped functioning. When I dug into it, I noticed that the CPU(TinyOS) checks the device status few hundred clock cycles( ~35us) after it issued a page erase write command which would take more than 100,000 cycles. Finding the device busy, CPU(TinyOS) issues no more commands and flash stopped working from that point on. I am not sure why the CPU(TinyOS) didn't keep polling.

To reproduce the bug, modify the line in src/avrora/sim/platform/ExternalFlash.java
 dfDelay = clock.millisToCycles(delay / 1000); to 
 dfDelay = clock.millisToCycles(delay);

The TinyOS 1.x device driver code for Mica2 flash is in
tos/platform/mica/PageEEPROMM.nc and works correctly on Mica2 motes
as well as in Atemu. Since the TinyOS device driver works correctly on motes and in Atemu, I suspect that Avrora miscalculates the next event (check status register) and fires it much early. 

Can it be possible the bug is in Avrora event queue or scheduler? Please help!



More information about the Avrora mailing list