Page 1 of 2
STM32L496 USB error
Posted: Fri Oct 12, 2018 10:10 pm
by lilvinz
Hi Giovanni,
i am seeing usb errors on STM32L496.
if the error occurs or not depends on the usb host port i am plugging in.
I have not found a pattern yet but this smells like a timing triggered issue.
Maybe it is related to
viewtopic.php?t=3439This is running into an assertion "already transmitting" during setup:
https://github.com/ChibiOS/ChibiOS/blob ... usb.c#L830Any ideas on how to proceed tracking this down?
Thanks and best regards
Vinz
Re: STM32L496 USB error
Posted: Fri Oct 12, 2018 11:13 pm
by lilvinz
Maybe it is good to know that this chip has the version 0x4F54320AU which means no special handling in ST library's usb driver.
Re: STM32L496 USB error
Posted: Fri Oct 12, 2018 11:22 pm
by lilvinz
Enabling or disabling the L476 workaround doesn't seem to make any difference.
Re: STM32L496 USB error
Posted: Sat Oct 13, 2018 5:05 am
by Giovanni
That problem was about getting an interrupt in an unexpected state of the driver state machine, this seems to be the same, not sure if it is the same problem.
What version are you using? host?
Giovanni
Re: STM32L496 USB error
Posted: Sat Oct 13, 2018 10:35 am
by lilvinz
Giovanni wrote:What version are you using? host?
Host: Linux Mint 19
4.15.0-34-generic #37-Ubuntu SMP Mon Aug 27 15:21:48 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
ChibiOS 18.2.1
Compiler: arm-none-eabi-gcc (GNU Tools for Arm Embedded Processors 7-2018-q2-update) 7.3.1 20180622 (release) [ARM/embedded-7-branch revision 261907]
Flags: -O2 -flto -specs=nano.specs -ggdb -fomit-frame-pointer -falign-functions=16 -falign-loops=16
Re: STM32L496 USB error
Posted: Sat Oct 13, 2018 12:19 pm
by Giovanni
Could you give a try to trunk code? there is a significant difference in the OTGv1 driver.
Giovanni
Re: STM32L496 USB error
Posted: Sat Oct 13, 2018 2:52 pm
by lilvinz
Giovanni wrote:Could you give a try to trunk code? there is a significant difference in the OTGv1 driver.
Giovanni
Did test against trunk. Same behavior.
Vinz
Re: STM32L496 USB error
Posted: Sun Oct 14, 2018 5:19 pm
by lilvinz
Trace of failure:
Code: Select all
...
lld_serve_interrupt(sts = 0x00000008 /* GINTSTS_SOF */)
lld_serve_interrupt(sts = 0x00000008 /* GINTSTS_SOF */)
lld_serve_interrupt(sts = 0x00000008 /* GINTSTS_SOF */)
lld_serve_interrupt(sts = 0x00080000 /* GINTSTS_OEPINT */)
OEPINT(src = 0x00010000)
otg_epout_handle(epint = 0x00008008 /* DOEPINT_SETUP_RCVD | DOEPINT_STUP */)
_usb_ep0setup(ep = 0)
default_handler(ep = 0)
usbStartTransmit(ep = 0)
usb_lld_start_in(ep = 0)
lld_serve_interrupt(sts = 0x00040000 /* GINTSTS_IEPINT */)
IEPINT(src = 0x00000001)
otg_epin_handler(ep = 0)
lld_serve_interrupt(sts = 0x00000010 /* GINTSTS_RXFLVL */)
otg_rxfifo_handler(sts = 0x01cc0080 /* ep = 0, cnt = 8, /* GRXSTSP_SETUP_DATA */)
lld_serve_interrupt(sts = 0x00000010 /* GINTSTS_RXFLVL */)
otg_rxfifo_handler(sts = 0x01cc0080 /* ep = 0, cnt = 8, /* GRXSTSP_SETUP_DATA */)
lld_serve_interrupt(sts = 0x00000010 /* GINTSTS_RXFLVL */)
otg_rxfifo_handler(sts = 0x01cc0080 /* ep = 0, cnt = 8, /* GRXSTSP_SETUP_DATA */)
lld_serve_interrupt(sts = 0x00000008 /* GINTSTS_SOF */)
lld_serve_interrupt(sts = 0x00000010 /* GINTSTS_RXFLVL */)
otg_rxfifo_handler(sts = 0x01ec0080 /* ep = 0, cnt = 8, /* GRXSTSP_SETUP_DATA */)
lld_serve_interrupt(sts = 0x00000010 /* GINTSTS_RXFLVL */)
otg_rxfifo_handler(sts = 0x01e80000 /* ep = 0, cnt = 0, /* GRXSTSP_SETUP_COMP */)
lld_serve_interrupt(sts = 0x00080000 /* GINTSTS_OEPINT */)
OEPINT(src = 0x00010000)
otg_epout_handle(epint = 0x00008008 /* DOEPINT_SETUP_RCVD | DOEPINT_STUP */)
_usb_ep0setup(ep = 0)
default_handler(ep = 0)
usbStartTransmit(ep = 0)
HALT
Maybe this helps getting an idea of whats going wrong.
Btw. i enabled the L4 workaround for the stm32l496.
When i find some time, i will redo the trace on a host port which doesn't show the error.
Then maybe i can see the diff.
Cheers
Vinz
Re: STM32L496 USB error
Posted: Sun Oct 14, 2018 5:33 pm
by lilvinz
Trace of different error on different host port:
Code: Select all
...
lld_serve_interrupt(sts = 0x00000008 /* GINTSTS_SOF */)
lld_serve_interrupt(sts = 0x00000008 /* GINTSTS_SOF */)
lld_serve_interrupt(sts = 0x00000008 /* GINTSTS_SOF */)
lld_serve_interrupt(sts = 0x00000010 /* GINTSTS_RXFLVL */)
otg_rxfifo_handler(sts = 0x01ec0080 /* ep = 0, cnt = 8, /* GRXSTSP_SETUP_DATA */)
lld_serve_interrupt(sts = 0x00000010 /* GINTSTS_RXFLVL */)
otg_rxfifo_handler(sts = 0x01e80000 /* ep = 0, cnt = 0, /* GRXSTSP_SETUP_COMP */)
lld_serve_interrupt(sts = 0x00080000 /* GINTSTS_OEPINT */)
OEPINT(src = 0x00010000)
otg_epout_handle(epint = 0x00008008 /* DOEPINT_SETUP_RCVD | DOEPINT_STUP */)
_usb_ep0setup(ep = 0)
default_handler(ep = 0)
usbStartTransmit(ep = 0)
usb_lld_start_in(ep = 0)
lld_serve_interrupt(sts = 0x00040000 /* GINTSTS_IEPINT */)
IEPINT(src = 0x00000001)
otg_epin_handler(ep = 0)
lld_serve_interrupt(sts = 0x00040000 /* GINTSTS_IEPINT */)
IEPINT(src = 0x00000001)
otg_epin_handler(ep = 0)
_usb_ep0in(ep = 0)
usbStartReceiveI(ep = 0)
usb_lld_start_out(ep = 0)
lld_serve_interrupt(sts = 0x00000010 /* GINTSTS_RXFLVL */)
otg_rxfifo_handler(sts = 0x01e50000 /* ep = 0, cnt = 0, /* GRXSTSP_OUT_DATA */)
lld_serve_interrupt(sts = 0x00000010 /* GINTSTS_RXFLVL */)
otg_rxfifo_handler(sts = 0x01e70000 /* ep = 0, cnt = 0, /* GRXSTSP_OUT_COMP */)
lld_serve_interrupt(sts = 0x00080000 /* GINTSTS_OEPINT */)
OEPINT(src = 0x00010000)
otg_epout_handle(epint = 0x00002011 /* DOEPINT_13?? | DOEPINT_OTEPDIS | DOEPINT_XFRC */)
_usb_ep0out(ep = 0)
lld_serve_interrupt(sts = 0x00000010 /* GINTSTS_RXFLVL */)
otg_rxfifo_handler(sts = 0x01ec0080 /* ep = 0, cnt = 8, /* GRXSTSP_SETUP_DATA */)
lld_serve_interrupt(sts = 0x00000010 /* GINTSTS_RXFLVL */)
otg_rxfifo_handler(sts = 0x01e80000 /* ep = 0, cnt = 0, /* GRXSTSP_SETUP_COMP */)
lld_serve_interrupt(sts = 0x00080000 /* GINTSTS_OEPINT */)
OEPINT(src = 0x00010000)
otg_epout_handle(epint = 0x00008008 /* DOEPINT_SETUP_RCVD | DOEPINT_STUP */)
_usb_ep0setup(ep = 0)
default_handler(ep = 0)
Hitting this: https://github.com/ChibiOS/ChibiOS/blob/stable_18.2.x/os/hal/src/hal_usb.c#L800
Re: STM32L496 USB error
Posted: Sun Oct 14, 2018 8:02 pm
by lilvinz
DOEPINT_13 seems to be "nak":
https://www.intel.com/content/www/us/en ... 93052.htmlMaybe this makes sense to you.