parallaxinc / cyberbot

Firmware, library, and loader code for cyberbot hardware
MIT License
8 stars 0 forks source link

Improve initialization handshaking to detect micro:bit reset #3

Closed MatzElectronics closed 5 years ago

MatzElectronics commented 5 years ago

The i2c busses are "joined" when both the Propeller and Micro:bit are ready, and either chip can make that happen by driving the line high (D8 on the mb, P23 on the prop). Currently, the Prop takes longer, so it drives p23 high, and that joins the busses. The micro:bit then waits until it gets a successful return from the prop when querying it's i2c address (0x5D).

What could happen is that after the first command is sent from the micro:bit, it also drives the line high, and after that command is received by the prop, it can switch P23 to an input. Should that line then go low, the Prop would know that the micro:bit was reset and that it should shut everything down and start over.

MatzElectronics commented 5 years ago

Should now work, please verify

AndyLindsay commented 5 years ago

Test: Reset plugged in micro:bit with cyber:bot off. Wait a while then turn on cyber:bot board power.
Result: Program starts from beginning.

Test: With microbit programming cable unplugged and batter power connected, Hold micro:bit reset down while turning on PWR.
Result: Program starts even though micro:bit reset is pressed and held.

Test: Have one program run and load another with Mu. Result: Wheels still turn while program loads. At end of program load, new program starts running.

AndyLindsay commented 5 years ago

Any other tests recommended?

MatzElectronics commented 5 years ago

Not that I can think of - it appears that the reset functionality is in software. A really tight loop in the python code will prevent the reset button from working at all.

MatzElectronics commented 5 years ago

Appears to be working, closing.