microsoft / uf2-samdx1

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

fix Wait States in samd51 init #113

Closed xeno27 closed 1 year ago

xeno27 commented 1 year ago

The Wait state Config in init samd51 is wrong, we set the clock to 48 MHz we have to set WS to 2 (I add a picture from 125 °C). With WS= 0 (means no wait state) there is a high chance to get serious trouble.

WS_config

The data sheet can be found here : samd51 datasheet

mmoskal commented 1 year ago

Looks good, thank you!

dhalbert commented 1 year ago

In the adafruit fork we set this to use automatic wait states: https://github.com/adafruit/uf2-samdx1/commit/246e826e910f17bf474047bce74f21b87a082b6b#diff-d1412d95682418aecf7991eb199fd1c08e6d1a43cc3d59fef32e4cf8724fe6a5

I thought I had PR'd this change back to upstream here, but apparently not -- sorry! I should do a merge up and down, since we've made a number of other changes.

dhalbert commented 1 year ago

@xeno27 Is there a reason you would choose this fixed wait state over the auto wait state? It would be nice to reconcile the two repos.

xeno27 commented 1 year ago

Hi @dhalbert no there was "no" reason for that. I only like fixed settings, because i know what happen :)