EP0 state machine hard assertions

Report here problems in any of ChibiOS components. This forum is NOT for support.
User avatar
russian
Posts: 368
Joined: Mon Oct 29, 2012 3:17 am
Location: Jersey City, USA
Has thanked: 16 times
Been thanked: 14 times

EP0 state machine hard assertions

Postby russian » Fri Mar 14, 2025 4:55 pm

We are hitting one of _usb_ep0out "EP0 state machine" assertions which halts/reboots firmware which is not the best user experience.

Steps to reproduce unknown. We have recently added code to log reports about reason for reboot on the SD card, and finally got one convincingly looking error report

Code: Select all

Last error type HardFault
type: 0x00000003 addr: 0x00000000 CSFR: 0x00000000
r0 0x08091de4
r1 0x08091a28
r2 0x000000c9
r3 0x00000000
r12 0x2002b738
lr (thread) 0x0020b141
pc 0x0027740a
xpsr 0x01000053


.elf mentions 0x08091de4 at the bottom of _usb_ep0out probably "EP0 state machine invalid state"?

Code: Select all

0020efa0 <_usb_ep0out>:
  20efa0:   b510         push   {r4, lr}
  20efa2:   4604         mov   r4, r0
  20efa4:   f890 304c    ldrb.w   r3, [r0, #76]   ; 0x4c
  20efa8:   2b15         cmp   r3, #21
  20efaa:   d83f         bhi.n   20f02c <_usb_ep0out+0x8c>
  20efac:   e8df f003    tbb   [pc, r3]
  20efb0:   3e3e3e2a    .word   0x3e3e3e2a
  20efb4:   3e2d3e3e    .word   0x3e2d3e3e
  20efb8:   2a2a2a3e    .word   0x2a2a2a3e
  20efbc:   3e3e3e3e    .word   0x3e3e3e3e
  20efc0:   3e3e3e3e    .word   0x3e3e3e3e
  20efc4:   0b1f         .short   0x0b1f
  20efc6:   230b         movs   r3, #11
  20efc8:   f880 304c    strb.w   r3, [r0, #76]   ; 0x4c
  20efcc:   2320         movs   r3, #32
  20efce:   f383 8811    msr   BASEPRI, r3
  20efd2:   f7fd fdbd    bl   20cb50 <_dbg_check_lock_from_isr>
  20efd6:   2300         movs   r3, #0
  20efd8:   461a         mov   r2, r3
  20efda:   4619         mov   r1, r3
  20efdc:   4620         mov   r0, r4
  20efde:   f7ff fdef    bl   20ebc0 <usbStartTransmitI>
  20efe2:   f7fd fde5    bl   20cbb0 <_dbg_check_unlock_from_isr>
  20efe6:   2300         movs   r3, #0
  20efe8:   f383 8811    msr   BASEPRI, r3
  20efec:   e01d         b.n   20f02a <_usb_ep0out+0x8a>
  20efee:   68c3         ldr   r3, [r0, #12]
  20eff0:   699b         ldr   r3, [r3, #24]
  20eff2:   685b         ldr   r3, [r3, #4]
  20eff4:   b9cb         cbnz   r3, 20f02a <_usb_ep0out+0x8a>
  20eff6:   6d83         ldr   r3, [r0, #88]   ; 0x58
  20eff8:   b103         cbz   r3, 20effc <_usb_ep0out+0x5c>
  20effa:   4798         blx   r3
  20effc:   2300         movs   r3, #0
  20effe:   f884 304c    strb.w   r3, [r4, #76]   ; 0x4c
  20f002:   e012         b.n   20f02a <_usb_ep0out+0x8a>
  20f004:   480b         ldr   r0, [pc, #44]   ; (20f034 <_usb_ep0out+0x94>)
  20f006:   f7fc f893    bl   20b130 <chSysHalt>
  20f00a:   2100         movs   r1, #0
  20f00c:   f7fa ff18    bl   209e40 <usb_lld_stall_in>
  20f010:   2100         movs   r1, #0
  20f012:   4620         mov   r0, r4
  20f014:   f7fa ff0c    bl   209e30 <usb_lld_stall_out>
  20f018:   6863         ldr   r3, [r4, #4]
  20f01a:   681b         ldr   r3, [r3, #0]
  20f01c:   b113         cbz   r3, 20f024 <_usb_ep0out+0x84>
  20f01e:   2106         movs   r1, #6
  20f020:   4620         mov   r0, r4
  20f022:   4798         blx   r3
  20f024:   2306         movs   r3, #6
  20f026:   f884 304c    strb.w   r3, [r4, #76]   ; 0x4c
  20f02a:   bd10         pop   {r4, pc}
  20f02c:   4801         ldr   r0, [pc, #4]   ; (20f034 <_usb_ep0out+0x94>)
  20f02e:   f7fc f87f    bl   20b130 <chSysHalt>
  20f032:   bf00         nop
  20f034:   08091de4    .word   0x08091de4
   ...


we are still on chibi 20 but looks like no changed in hal_usb.c since 20?

our issue https://github.com/rusefi/rusefi/issues/7623
Last edited by russian on Fri Mar 14, 2025 5:01 pm, edited 1 time in total.

User avatar
russian
Posts: 368
Joined: Mon Oct 29, 2012 3:17 am
Location: Jersey City, USA
Has thanked: 16 times
Been thanked: 14 times

Re: EP0 state machine hard assertions

Postby russian » Fri Mar 14, 2025 5:00 pm


User avatar
Giovanni
Site Admin
Posts: 14704
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1146 times
Been thanked: 960 times

Re: EP0 state machine hard assertions

Postby Giovanni » Fri Mar 14, 2025 7:03 pm

Hi,

The OTG driver received improvements in trunk, you should give it a try.

Giovanni

User avatar
Giovanni
Site Admin
Posts: 14704
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1146 times
Been thanked: 960 times

Re: EP0 state machine hard assertions

Postby Giovanni » Tue Jul 01, 2025 9:48 am

Any news on this?

Giovanni


Return to “Bug Reports”

Who is online

Users browsing this forum: Bing [Bot] and 8 guests