3

I am homebuilding a USB driver on STM32. I have managed to get the device to enumerate which is awesome, but only when I disable all the strings (set all ID's to 0). Right now, when I set iManufacturer to 1 in the device descriptor, I am getting this continual bounce back. When I cache all the setup requests, this is what it looks like after a few rounds:

enter image description here

I have absolutely no idea what is wrong. I am getting ZLP's after every packet, I am using the same memory reading and writing techniques as I am for the rest of the driver, but the strings just don't work. I have even verified that the memory is being written correctly. Here is the code for my two strings (0 and 1):

const uint8_t String_0_LANGID[4] =
{
        4, 3,
        9, 4, // 0x0409 English strings only
};

const uint8_t String_1_ManufacturerID[18] =
{
        18, // Length
        3, // String descriptor
        'a', 0,
        'b', 0,
        'c', 0,
        'd', 0,
        'e', 0,
        'f', 0,
        'g', 0,
        'h', 0,
};

Are there hidden rules for what can go in a string? Length? Characters? my VID and PID are both 0x00, 0x00. Thanks!

Edit: I have tried on MacOS and it works fine! Here's the enurmation list:

enter image description here

4
  • Everything seems correct to me in your post. We will need to see more code. You may try few experiments. Try change language 9, 4 to some other language and see if 1033 in wValue changes (it should). In that way you can check that at least lang descriptor works well. When I was implementing driver, I also included terminating null at end of string (and included it in length)- Not sure if it is mandatory but that is only difference I noticed when briefly looking my code. It is also good idea to test connecting USB device to Linux machine and run dmesg log to see USB enumeration errors. Commented Nov 7 at 19:06
  • 1
    @Misaz interesting! I’ll give the null termination a go. I tried other language codes and the host then requested strings in those languages so I can tell it received them properly. Commented Nov 8 at 11:09
  • @Misaz I just tried with Mac OS this morning and it worked fine! Go figure? I am trying to get a UAC1.0 device up and running so it's obviously a difference in drivers. Commented Nov 10 at 21:48
  • Btw. I just notice that you set VID and PID both zero. You should not do that. Maybe some OS treat this devices in special way. Unless you want to buy VID range, if your device is open hardware, you can request free by following guidance at pid.codes/howto. And for testing you can try switcing temporarity to 0x1234 which is overused milion times accors world, because it is listed in various tutorials. Commented Nov 11 at 1:11

1 Answer 1

0

This seems to have occurred due to the configuration descriptor not being constructed correctly. It seems as though the descriptor was good enough to get past the "device unrecognised" stage, but incorrect enough to not be able to proceed. Once I set up the configuration descriptor correctly, I haven't had this issue.

Using Windows ETW for USB along with Wireshark helped me confirm this problem, as I could see what was being transferred and received correctly, giving me confidence in tracking down the problem.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.