USB stall error

Discussions and support about ChibiOS/HAL, the MCU Hardware Abstraction Layer.
Viljami
Posts: 15
Joined: Tue Apr 05, 2022 3:32 pm
Has thanked: 13 times

Re: USB stall error

Postby Viljami » Fri Aug 26, 2022 12:49 pm

Hello again Giovanni!

Giovanni wrote:Hi,

Is it possible your descriptor is wrong somehow? it happens after the host retrieves it.

Giovanni


Do you mean especially (USB) device descriptor or configuration one or what?

BR

Viljami

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: USB stall error

Postby Giovanni » Fri Aug 26, 2022 12:59 pm

The one sent by USB_REQ_GET_DESCRIPTOR but you should check anything is exchanged before the stall.

Giovanni

Viljami
Posts: 15
Joined: Tue Apr 05, 2022 3:32 pm
Has thanked: 13 times

Re: USB stall error

Postby Viljami » Fri Aug 26, 2022 3:23 pm

Hello again Giovanni!

I checked, debugged etc. my code.

USB_REQ_GET_DESCRIPTOR requests USB_DESCRIPTOR_DEVICE_QUALIFIER; I added handling for that.

The following is from default_handler (hal_usb.c):

Code: Select all

  .
  .
  case (uint32_t)USB_RTYPE_RECIPIENT_DEVICE | ((uint32_t)USB_REQ_GET_DESCRIPTOR << 8):
  case (uint32_t)USB_RTYPE_RECIPIENT_INTERFACE | ((uint32_t)USB_REQ_GET_DESCRIPTOR << 8):
    /* Handling descriptor requests from the host.*/
    dp = usbp->config->get_descriptor_cb(usbp, usbp->setup[3],
                                         usbp->setup[2],
                                         get_hword(&usbp->setup[4]));
    if (dp == NULL) {
      return false;
    }
    /*lint -save -e9005 [11.8] Removing const is fine.*/
    usbSetupTransfer(usbp, (uint8_t *)dp->ud_string, dp->ud_size, NULL);
    /*lint -restore*/
    return true;
    .
    .


After adding of USB_DESCRIPTOR_DEVICE_QUALIFIER the program running here returns true but still USB stalls.

There is no any handling for USB_DESCRIPTOR_DEVICE_QUALIFIER in my earlier ChibiOS code. It's possible that I have to go through my USB descriptors.

BR

Viljami


Return to “ChibiOS/HAL”

Who is online

Users browsing this forum: No registered users and 3 guests