This is an automated email from the ASF dual-hosted git repository.

kasjer pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git


The following commit(s) were added to refs/heads/master by this push:
     new ef0c191e2 hw/usb/tinyusb/pic32mz: Enable interrupts when OS is not 
started
ef0c191e2 is described below

commit ef0c191e2d5374a488be1018dec52ca9ff6a0c8c
Author: Jerzy Kasenberg <[email protected]>
AuthorDate: Mon Oct 19 22:55:03 2026 +0200

    hw/usb/tinyusb/pic32mz: Enable interrupts when OS is not started
    
    When TinyUSB is started without OS scheduling (e.g. USB DFU in
    bootloader triggered by boot pin) os_start() is never called, so
    interrupts stay globally disabled on PIC32 (Status.IE is 0 after
    reset, unlike Cortex-M where interrupts are enabled out of reset).
    USB interrupt was never serviced, device did not enumerate and
    bootloader was stuck in tud_task() loop.
    
    Enable interrupts in tinyusb_hardware_init() when OS_SCHEDULING is 0.
    
    Assisted-by: Claude:claude-opus-5-5
    Signed-off-by: Jerzy Kasenberg <[email protected]>
---
 hw/usb/tinyusb/pic32mz/src/pic32mz.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/hw/usb/tinyusb/pic32mz/src/pic32mz.c 
b/hw/usb/tinyusb/pic32mz/src/pic32mz.c
index 743f5bf66..981710579 100644
--- a/hw/usb/tinyusb/pic32mz/src/pic32mz.c
+++ b/hw/usb/tinyusb/pic32mz/src/pic32mz.c
@@ -50,4 +50,11 @@ tinyusb_hardware_init(void)
     USBCRCONbits.PHYIDEN = 0;
     USBCRCONbits.USBIDVAL = 1;
     USBCRCONbits.USBIDOVEN = 1;
+#if !MYNEWT_VAL(OS_SCHEDULING)
+    /*
+     * OS is not started (e.g. DFU in bootloader) so interrupts were not
+     * enabled by os_start(). Without them USB interrupt is never serviced.
+     */
+    __builtin_enable_interrupts();
+#endif
 }

Reply via email to