cancel
Showing results for 
Search instead for 
Did you mean: 

USB Host CDC: stuck at HOST_CLASS_REQUEST, please help!

Pilot B
Associate II
Posted on April 16, 2018 at 19:26

Hello everyone,

I'm working on STM32F407-DISC board, trying to get USB Host CDC working. I'm using library version 2.2.0.

I managed to get enumeration working by fixing HSE_VALUE to be 8M and PLL_M to be 8(thanks the info from Clive One) .

Now I'm stuck at HOST_CLASS_REQUEST state: it always return USBH_BUSY. Someone mentioned to fix the 'dynamic memory'(

https://community.st.com/message/113699

 ). But that is for Cube library. I'm using the SPL library. Does anyone know how to fix it?

Please let me know if you know anything.

Thanks!

2 REPLIES 2
Pilot B
Associate II
Posted on April 17, 2018 at 02:01

Hello everyone,

I figured the device I used was malfunctioning. I changed another device. Then I received USBH_OK for 

HOST_CLASS_REQUEST state.

However, I found a new issue. Say, I periodically send data 'Hello' from host to the device. But it seems the data received by USB Analyzer is '00 00 00 00 AF' which is wrong.

Here is some log from USB Analyzer:

[D->H]: 00 C2 01 00 00 00 08    (Baudrate 115200, 8N1)

[H->D]: ACK

. . . 

[D->H]: 21 22 00 00 00 00 00 00   (Set control line state)

[H->D]: ACK

[H->D]: 00 00 00 00 AF

I thought it should be '48 65 6C 6C 6F'. Does anyone know why it is wrong? Is it because of line coding? But the testing device is using 115200 8N1. The host read the line coding from the device and set it by using the same line coding.

Please let me know if you know the reason.

Thanks everyone!

Pilot B
Associate II
Posted on April 17, 2018 at 02:14

By the way, is the character size 8 bits or 16 bits in the string? 

The reason I'm asking is because I found the string seems using 16 bits for each character, e.g. I found 'ABC' in enumeration string from USB Analyzer:

. . . 41 00 42 00 43 00 . . .

Does it mean I have to convert my data to 16 bits for each character? Here is the code I use to send data to device:

char data[] = 'Hello';

CDC_SendData(data, strlen(data));  // The length is 5 here, should it be 10? and further convert the data to use 16 bits for each char?

Please let me know how to fix this issue.

Thanks everyone!