Monday, 12 February 2007

Progress Report 13/02

  • Added a "Set Time" COM port command so that the PC can set the local time on the mote. The mote will update the current time every time it sends an announce packet over the radio. Because there is no power source except the standard batteries, there is no way to store the time when the batteries are taken out. As such, I've had to drop the requirement that the system can continue functioning normally after the batteries are removed. Match data will still be kept on the flash though.
  • Motes now receive announcement packets from other motes over the radio and store the user id and device id in flash, along with a timestamp. At the moment each announcement results in a new entry being made in the flash, which is a bit rubbish because the sector I have allocated for match data can only hold 8192 such matches. A better approach would be to store update a running total in each record for the number announce packets in a row (within a specified time frame) have been receieved from a particular device. This is hard, however, as each bit in a sector can only be written to once without erasing the entire sector and starting again. Hence keeping a running count would be difficult.
  • Had some difficulty in figuring out how to store the current number of matches held in flash. There were a few approaches I considered:
    • Storing the current number of matches in the device config sector of the flash and erasing and re-writing this sector each time a new match is made. Such frequent erasing and re-writing is not good for the flash memory, however.
    • Storing the current number of matches in a sector of its own and erasing that every time a new match is added. Has the same problem as the previous approach, and because the minimum size of a sector is 16k this would be extremely wasteful.
    • Storing the current number of matches in volatile RAM and counting the number of matches currently held in flash only when the device is first started up.
  • I decided to go for the third approach, however I have not yet written the code to count matches in flash. Therefore, at present the match data volume is simply erased every time the device is started and the match count set to zero.
  • The FlashViewer module was interfering with my LED control by setting LED values when various operations I was performing completed, which made debugging even harder than normal. I have disabled it for now. If I need it back then I will wire its LED interface to a dummy LED component.
  • Added a "Get number of matches" COM port message to the system. Seems to work perfectly.
  • Added a "Get match x" COM port message for retreiving match data. Doesn't seem to work properly, need to look at a dump of the flash memory to see if this is because the values are stored incorrectly in the memory or whether they are being transmitted wrong.

No comments: