Hi! On Fri, 8 May 2009, Leon Steenkamp wrote:
> In tos\lib\net\Deluge\extra\NetProgM.nc there is the following: > > --<SNIP>-- > command error_t NetProg.programImageAndReboot(uint32_t imgAddr) > { > reprogramImgAddr = imgAddr; > return call ReprogramGuard.okToProgram(); > } > > event void ReprogramGuard.okToProgramDone(bool ok) > { > BootArgs bootArgs; > > if (!ok) { > // The voltage is too low. Nothing to do. > return; > } > > atomic { > call IFlash.read(TCAST(uint8_t* > COUNT(sizeof(bootArgs)),TOSBOOT_ARGS_ADDR), &bootArgs, sizeof(bootArgs)); > > bootArgs.imageAddr = reprogramImgAddr; > bootArgs.gestureCount = 0xff; > bootArgs.noReprogram = FALSE; > bootArgs.address = TOS_NODE_ID; > > call IFlash.write(TCAST(uint8_t* > COUNT(sizeof(bootArgs)),TOSBOOT_ARGS_ADDR), &bootArgs, sizeof(bootArgs)); > > // reboot > netprog_reboot(); > } > } > --<SNIP>-- > > I am using TelosB platform and when NetProg.programImageAndReboot is called > not much happens and I guess its because ReprogramGuard.okToProgram() is > called with no argument. ReprogramGuard.okToProgram() is called without any argument because it's a split phase command. The response is the ReprogramGuard.okToProgramDone event. If the ok is false it means the battery voltage is too low so the mote will not reboot. There is another voltage check in the bootloader (tosboot) so if you ignore the ok and initiate a reboot the mote will not reprogram (and you can enter in a loop if you keep rebooting asking for a reprogramming). Sorry for delay. I didn't notice this message until now. :-( Razvan ME > And if (!ok) is always true. > > Am I missing something? or is there a problem with the code? I changed the > "if (!ok)" to "if (ok)", the node now reboots but it does not seem to be > reprogrammed. > > Leon > _______________________________________________ Tinyos-help mailing list Tinyos-help@millennium.berkeley.edu https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help