Page 1 of 1

SysHalt on USB when halting with SWD?

Posted: Fri Feb 19, 2016 11:24 am
by Korken
Hi all,

I have a strange thing happening that I am unable to explain with the USB (Serial).
If I halt the system with the debugger and then continue, everything continues as it should.
But it I halt the system, send data at the same time over USB (from the computer to ChibiOS), and then continue I get a SysHalt in usbStartTransmitI.

I have not seen this before, so I loaded an old firmware from 3.0 and then this does not happen (running 16.1.4 now).
Is this a sign that I am doing something wrong or is it by design something that 3.0 did not catch?

EDIT:
To clarify, it still works after starting the program again.
But the first USB packet that comes after the program was started again causes the SysHalt.

Re: SysHalt on USB when halting with SWD?

Posted: Fri Feb 19, 2016 12:23 pm
by Giovanni
Hi,

It is possible that the CPU is unable the USB request in time because halted, there is a finite time to empty the USB queues. Then an error is triggered, could you inspect the error message?

Giovanni

Re: SysHalt on USB when halting with SWD?

Posted: Fri Feb 19, 2016 3:37 pm
by Korken
Hi Giovanni!

This are the 2 messages + backtrace from GDB:
(gdb) p kfly_assert_errors.function
$6 = 0x800d760 <__func__.8351> "usbStartTransmitI"
(gdb) p kfly_assert_errors.reason
$7 = 0x800d708 "already transmitting"
(gdb) backtrace
#0 0x08000e46 in chSysHalt (reason=reason@entry=0x800d760 <__func__.8351> "usbStartTransmitI")
at ./ChibiOS/os/rt/src/chsys.c:181
#1 0x080042f4 in usbStartTransmitI (usbp=usbp@entry=0x20001478 <USBD1>, ep=ep@entry=0 '\000',
buf=0x200014c4 <USBD1+76> "", n=2) at ./ChibiOS/os/hal/src/usb.c:462
#2 0x08004668 in _usb_ep0setup (usbp=0x20001478 <USBD1>, ep=<optimized out>)
at ./ChibiOS/os/hal/src/usb.c:765
#3 0x08006bce in otg_epout_handler (usbp=usbp@entry=0x20001478 <USBD1>, ep=ep@entry=0 '\000')
at ./ChibiOS/os/hal/ports/STM32/LLD/OTGv1/usb_lld.c:410
#4 0x08006fee in usb_lld_serve_interrupt (usbp=0x20001478 <USBD1>)
at ./ChibiOS/os/hal/ports/STM32/LLD/OTGv1/usb_lld.c:609
#5 Vector14C () at ./ChibiOS/os/hal/ports/STM32/LLD/OTGv1/usb_lld.c:642

Re: SysHalt on USB when halting with SWD?

Posted: Fri Feb 19, 2016 4:23 pm
by Giovanni
As I thought, that driver is something that should not be halted while a transfer is in progress, the HW requires that FIFOs must be served immediately.

Giovanni

Re: SysHalt on USB when halting with SWD?

Posted: Sun Feb 21, 2016 11:10 am
by Korken
Thanks for checking!
Then I don't need to worry :)