apache / nuttx

Apache NuttX is a mature, real-time embedded operating system (RTOS)
https://nuttx.apache.org/
Apache License 2.0
2.5k stars 1.06k forks source link

USB HID Keyboard causes crash #8491

Open TimJTi opened 1 year ago

TimJTi commented 1 year ago

SAMA5D2 processor.

With the USB HID Keyboard driver enabled, a sequence of 2 or 3 attach-detach cycles causes a crash. Other USB host drivers (e.g. Mass Storage) behave OK.

This is the first stack dump crash I've encountered, and happy to investigate further with a bit of guidance, or maybe someone knows right away what the issue is? I have half a suspicion that it is the OHCI Monitor based on a message I saw once.

up_dump_register: R0: 6000005f R1: 00400416 R2: 00000000  R3: 20058c00
up_dump_register: R4: 00000000 R5: 00000000 R6: 00000008  R7: 00000000
up_dump_register: R8: 2005462c SB: 00000008 SL: ffffff80  FP: 00000000
up_dump_register: IP: 00000000 SP: 20064028 LR: 2001e5e0  PC: 2001e624
up_dump_register: CPSR: 200000df
show_tasks:    PID   PRI    STACKBASE STACKSIZE   COMMAND
show_tasks:   ----   ---   0x20055000      1024   irq
dump_task:      0      0   0x2005ca40      1000   Idle Task
dump_task:      1    192   0x2005e2b8      1992   hpwork 0x200573dc
dump_task:      2    192   0x2005eec8      1992   hpwork 0x200573dc
dump_task:      3    100   0x2005fad8       968   lpwork 0x20057400
dump_task:      4    100   0x200602e8       968   lpwork 0x20057400
dump_task:      5    100   0x20060b08       968   lpwork 0x20057400
dump_task:      6    100   0x20061318       968   lpwork 0x20057400
dump_task:      8    110   0x20062d30      2000   FUSB302 Monitor
dump_task:      9    100   0x20063960      2000   OHCI Monitor
dump_task:     10    100   0x20064570      2000   EHCI Monitor
dump_task:     11    100   0x200722a8      4056   nsh
acassis commented 1 year ago

@TimJTi Did you test it on STM32F4Discovery board to confirm the issue is not in your arch driver?

TimJTi commented 1 year ago

@acassis - I only have sama5 boards[1] and not sure if my eval boards are still usable! My thinking was that since the USB memory stick works 100% reliably and I can plug/unplug many times without issue it was unlikely to be the SAMA5 usb code - but it is possible. I think one is ohci and the other ehci so i will investigate further. After all, I did find an issue with the SAMA5 device driver so further issues are I guess rather likely.

I did trace the connect, enumeration, and detach events and they superficially seemed to make sense. the keyboard actually works the first time, and it "feels" perhaps like a big chunk of memory is not being released.

What I've not got a good handle on is debugging full blown crashes as the screenful's of register dumps seem rather pointless!

[1] Edit: just remembered I have a samv71 eval board: I'll try that.

ldube commented 1 year ago

@TimJTi Check and see if #8879 fixes this problem.

TimJTi commented 1 year ago

@TimJTi Check and see if #8879 fixes this problem.

I have a hardware problem on my development board it seems and I can't quickly test this...and I'm about to go on holiday for 2 weeks. I will check it out when I'm back - sorry not to be able to do this now.

ldube commented 6 months ago

@TimJTi Please close this issue.

TimJTi commented 6 months ago

@ldube With apologies, I haven't been able to verify it yet for various reasons. I can close if wanted but if I may end up reopening if it's still an issue.

What would your prefer - wait, pending me checking in the next month or so, or close it with the potential of it being re-opened?

ldube commented 6 months ago

What would your prefer - wait, pending me checking in the next month or so, or close it with the potential of it being re-opened?

Wait.