microsoft / uf2-samdx1

USB Mass Storage bootloader (based on UF2) for SAMD21 and SAMD51
Other
251 stars 309 forks source link

Clear cplay NeoPixels before reset out of bootloader. #15

Closed tannewt closed 7 years ago

tannewt commented 7 years ago

The green neopixels stick around after a successful flash with bossac and MSC. Instead, they should be turned off before restarting.

mmoskal commented 7 years ago

This is rather difficult, since the board runs at 1 MHz at reset, which isn't fast enough to drive the neopixel. We only switch it to 48 MHz when we stay in the bootloader.

Switching to 48MHz right away might potentially cause issues with some application code, expecting the blocks to be set for 1 MHz, as it is at reset.

tannewt commented 7 years ago

We shouldn't need to drive it at 1mhz. I meant that the pixels should be reset before exiting the bootloader when its driven the neopixels. So, if you double tap to stay in the bootloader, then it takes over the neopixels to show red and green. You then flash through bossac or MSC and the board resets into the new code. Before it does that reset it should blank out the neopixels.

For the normal case where it starts at 1 mhz and hands off to the other code, the pixels don't need to be reset because the bootloader hasn't changed them.

mmoskal commented 7 years ago

Oh, right. That should be easy. 

tannewt commented 7 years ago

Perfect! Thanks!

I tried to do it myself but couldn't quite find the ways out of the bootloader.

tannewt commented 7 years ago

This is fixed for MSC but still broken for bossac/Arduino.

mmoskal commented 7 years ago

Thanks, good catch!

tannewt commented 7 years ago

No problem. Thanks for the quick fix!