travisgoodspeed / goodwatch

Replacement board for Casio Calculator Watches using the CC430F6147
504 stars 55 forks source link

Simulator #10

Closed travisgoodspeed closed 6 years ago

travisgoodspeed commented 6 years ago

Because flashing a wrist-watch takes time, and because minor mistakes in power management can quickly murder our CR2016 battery, we will need an accurate simulator to test the firmware. We can build this either on msp430simu (Python) or mspsim (Java).

In the short term, a bit of unit testing and maybe an LCD display simulator might be sufficient. In the long term, we will want accurate models of the clocks and power management, with some mechanism for estimating power drain and comparing the power consumption of separate CPU branches.

Neighbor @cr has volunteered to tackle this issue.

travisgoodspeed commented 6 years ago

Some notes on the firmware follow.

The firmware begins by initializing the LCD (in lcd_init()) and WDT (WatchDogTimer) (in main()) peripherals, then dropping to a low power mode where it spins forever.

screenshot_20170923_115034

At this point, the main thread does no more work, and all work is performed in the watchdog timer's interrupt handler. This interrupt handler just calls lcd_wdt() to blink the display, then allows the '430 to go back to sleep.

screenshot_20170923_115842

cr commented 6 years ago

Yeah, probably for the better. I won't get around to contributing anything. Sorry for not being more vocal bout that.

travisgoodspeed commented 6 years ago

No worries, neighbor.