mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-14 07:53:40 +00:00
machine/rp2040: wait for 1000 us after flash reset to avoid issues with busy USB bus
Signed-off-by: deadprogram <ron@hybridgroup.com>
This commit is contained in:
@@ -3,6 +3,7 @@
|
|||||||
package machine
|
package machine
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"device/arm"
|
||||||
"device/rp"
|
"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)
|
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
|
// 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.
|
// if timer pool disabled, or no timer available, have to busy wait.
|
||||||
hw_enumeration_fix_finish()
|
hw_enumeration_fix_finish()
|
||||||
@@ -109,3 +111,10 @@ func hw_enumeration_fix_finish() {
|
|||||||
// Restore the pad ctrl value
|
// Restore the pad ctrl value
|
||||||
padsBank0.io[dp].Set(padCtrlPrev)
|
padsBank0.io[dp].Set(padCtrlPrev)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func waitCycles(n int) {
|
||||||
|
for n > 0 {
|
||||||
|
arm.Asm("nop")
|
||||||
|
n--
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user