machine/rp2040: wait for 1000 us after flash reset to avoid issues with busy USB bus

Signed-off-by: deadprogram <ron@hybridgroup.com>
Этот коммит содержится в:
deadprogram 2023-07-04 21:44:20 +02:00 коммит произвёл Ron Evans
родитель fffad84a63
коммит c83f712c17

Просмотреть файл

@ -3,6 +3,7 @@
package machine
import (
"device/arm"
"device/rp"
)
@ -87,6 +88,7 @@ func hw_enumeration_fix_force_ls_j() {
rp.USBCTRL_REGS.USB_MUXING.Set(rp.USBCTRL_REGS_USB_MUXING_TO_DIGITAL_PAD | rp.USBCTRL_REGS_USB_MUXING_SOFTCON)
// LS_J is now forced but while loop here just to check
waitCycles(125000)
// if timer pool disabled, or no timer available, have to busy wait.
hw_enumeration_fix_finish()
@ -109,3 +111,10 @@ func hw_enumeration_fix_finish() {
// Restore the pad ctrl value
padsBank0.io[dp].Set(padCtrlPrev)
}
func waitCycles(n int) {
for n > 0 {
arm.Asm("nop")
n--
}
}