STM32L496 USB error Topic is solved

Report here problems in any of ChibiOS components. This forum is NOT for support.
User avatar
lilvinz
Posts: 130
Joined: Sat Dec 21, 2013 2:56 pm
Has thanked: 1 time
Been thanked: 6 times

STM32L496 USB error

Postby lilvinz » Fri Oct 12, 2018 10:10 pm

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=3439

This is running into an assertion "already transmitting" during setup:
https://github.com/ChibiOS/ChibiOS/blob ... usb.c#L830

Any ideas on how to proceed tracking this down?

Thanks and best regards

Vinz

User avatar
lilvinz
Posts: 130
Joined: Sat Dec 21, 2013 2:56 pm
Has thanked: 1 time
Been thanked: 6 times

Re: STM32L496 USB error

Postby lilvinz » Fri Oct 12, 2018 11:13 pm

Maybe it is good to know that this chip has the version 0x4F54320AU which means no special handling in ST library's usb driver.

User avatar
lilvinz
Posts: 130
Joined: Sat Dec 21, 2013 2:56 pm
Has thanked: 1 time
Been thanked: 6 times

Re: STM32L496 USB error

Postby lilvinz » Fri Oct 12, 2018 11:22 pm

Enabling or disabling the L476 workaround doesn't seem to make any difference.

User avatar
Giovanni
Site Admin
Posts: 14455
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: STM32L496 USB error

Postby Giovanni » Sat Oct 13, 2018 5:05 am

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

User avatar
lilvinz
Posts: 130
Joined: Sat Dec 21, 2013 2:56 pm
Has thanked: 1 time
Been thanked: 6 times

Re: STM32L496 USB error

Postby lilvinz » Sat Oct 13, 2018 10:35 am

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

User avatar
Giovanni
Site Admin
Posts: 14455
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: STM32L496 USB error

Postby Giovanni » Sat Oct 13, 2018 12:19 pm

Could you give a try to trunk code? there is a significant difference in the OTGv1 driver.

Giovanni

User avatar
lilvinz
Posts: 130
Joined: Sat Dec 21, 2013 2:56 pm
Has thanked: 1 time
Been thanked: 6 times

Re: STM32L496 USB error

Postby lilvinz » Sat Oct 13, 2018 2:52 pm

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

User avatar
lilvinz
Posts: 130
Joined: Sat Dec 21, 2013 2:56 pm
Has thanked: 1 time
Been thanked: 6 times

Re: STM32L496 USB error

Postby lilvinz » Sun Oct 14, 2018 5:19 pm

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

User avatar
lilvinz
Posts: 130
Joined: Sat Dec 21, 2013 2:56 pm
Has thanked: 1 time
Been thanked: 6 times

Re: STM32L496 USB error

Postby lilvinz » Sun Oct 14, 2018 5:33 pm

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


User avatar
lilvinz
Posts: 130
Joined: Sat Dec 21, 2013 2:56 pm
Has thanked: 1 time
Been thanked: 6 times

Re: STM32L496 USB error

Postby lilvinz » Sun Oct 14, 2018 8:02 pm

DOEPINT_13 seems to be "nak":
https://www.intel.com/content/www/us/en ... 93052.html

Maybe this makes sense to you.


Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 20 guests