STM32 USB OTG SV#6, misplaced @p chSysLockFromISR().. Topic is solved

Report here problems in any of ChibiOS components. This forum is NOT for support.
Post Reply
User avatar
barthess
Posts: 861
Joined: Wed Dec 08, 2010 7:55 pm
Been thanked: 7 times

STM32 USB OTG SV#6, misplaced @p chSysLockFromISR()..

Post by barthess »

I use latest trunk with STM32F767 on custom board with HS USB phy.
I have added device qualifier descriptor to my usbcfg.c to be able to
pass USB2CV tests.

Code: Select all

/*
 * @define  Device Descriptor size.
 */
#define USB_DEVICE_QUALIFIER_SIZE       10U

/**
 * @brief   Device Descriptor helper macro.
 */
#define USB_DEVICE_QUALIFIER(bcdUSB, bDeviceClass, bDeviceSubClass,         \
                             bDeviceProtocol, bMaxPacketSize,               \
                             bNumConfigurations, bReserved)                 \
  USB_DESC_BYTE(USB_DEVICE_QUALIFIER_SIZE),                                 \
  USB_DESC_BYTE(USB_DESCRIPTOR_DEVICE_QUALIFIER),                           \
  USB_DESC_BCD(bcdUSB),                                                     \
  USB_DESC_BYTE(bDeviceClass),                                              \
  USB_DESC_BYTE(bDeviceSubClass),                                           \
  USB_DESC_BYTE(bDeviceProtocol),                                           \
  USB_DESC_BYTE(bMaxPacketSize),                                            \
  USB_DESC_BYTE(bNumConfigurations),                                        \
  USB_DESC_BYTE(bReserved)


/*
 * USB Device Descriptor.
 */
static const uint8_t vcom_device_qualifier_data[USB_DEVICE_QUALIFIER_SIZE] = {
  USB_DEVICE_QUALIFIER  (0x0200,        /* bcdUSB (2.0).                    */
                         0x00,          /* bDeviceClass (http://www.usb.org/developers/defined_class).     */
                         0x00,          /* bDeviceSubClass.                 */
                         0x00,          /* bDeviceProtocol.                 */
                         0x40,          /* bMaxPacketSize.                  */
                         0,             /* bNumConfigurations.              */
                         0)             /* bReserved.                       */
};

/*
 * Device Descriptor wrapper.
 */
static const USBDescriptor vcom_device_qualifier_descriptor = {
  sizeof vcom_device_qualifier_data,
  vcom_device_qualifier_data
};

And have panic from usbDisableEndpointsI function:

Code: Select all

Thread [1] (Suspended: Signal 'SIGTRAP' received. Description: Trace/breakpoint trap.)   
   12 uav_panic_handler() fault_handlers.c:148 0x00214cbc   
   11 chSysHalt() chsys.c:203 0x002008a4   
   10 _dbg_check_lock_from_isr() chdebug.c:179 0x00200a48   
   9 chSysLockFromISR() chsys.h:418 0x002065ee   
   8 osalSysLockFromISR() osal.h:515 0x00206646   
   7 usbDisableEndpointsI() hal_usb.c:420 0x00206dba   
   6 default_handler() hal_usb.c:152 0x002068c4   
   5 _usb_ep0setup() hal_usb.c:769 0x002071ea   
   4 otg_epout_handler() hal_usb_lld.c:416 0x00209b7a   
   3 usb_lld_serve_interrupt() hal_usb_lld.c:621 0x0020a0bc   
   2 Vector174() hal_usb_lld.c:667 0x0020a130   
   1 <symbol is not available> 0xffffffec   

When I commented out lock/unlock calls on lines #420 and #427 in hal_usb.c than code
works as expected and passed USB2CV tests.

It looks like trivial bug but I am not sure because USB code in HAL is too complex for me.
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: STM32 USB OTG SV#6, misplaced @p chSysLockFromISR()..

Post by Giovanni »

You were right, thanks.

Fixed as bug #811.

Giovanni
Post Reply