2017-11-19 10:29 PM
Hello Clive,
I am implementing USB CDC host on STM32F446, it is connected to GSM module.
I have initialized the USB host, I am still exploring how to send & receive data in CDC host mode & on what event I should read buffer so that I don't end-up reading junk.
USBH_StatusTypeDef USBH_Process(USBH_HandleTypeDef *phost) function is called in while loop.
I get gstate till HOST_DEV_ATTACHED. I never receive the state HOST_ENUMERATION.
Is it because the device is not properly initialized that is why the enumeration is not done?
What should I check can you please suggest?
Regards
Pramod
2017-11-30 04:20 AM
Hello,
The above issue is resolved it was Vbus was not powered.
below are the debug traces.
$DBG001:2 USB: interface started ...0<CR><LF>
$DBG001:2 USB: Init Host USB...<CR><LF>$DBG512:2 Init_HostUSB: Initialise Host USB<CR><LF>$DBG001:2 USB: handle 4 (USR_CONNECTION)<CR><LF>$DBG001:2 MainTask: set mainstate 6<CR><LF>$DBG000:3 USBH_Process: HOST_IDLE<CR><LF>$DBG000:3 USB: Device Attached<CR><LF>$DBG000:3 USB: PID: 1102h<CR><LF>$DBG000:3 USB: VID: 1546h<CR><LF>$DBG000:3 USB: Address (#1) assigned<CR><LF>$DBG000:3 USB: Manufacturer : u-blox<CR><LF>$DBG000:3 USB: Product : u-blox Wireless Module<CR><LF>$DBG000:3 USB: Serial Number : 357520071065649<CR><LF>$DBG000:3 USB: Enumeration done<CR><LF>$DBG000:3 USB: Device has only one configuration<CR><LF>$DBG000:3 USB: Default configuration set<CR><LF>$DBG000:3 USB: Interface: 2/2/1 (if:0/0, 1)<CR><LF>$DBG000:3 USB: Interface: 10/0/0 (if:1/0, 2)<CR><LF>$DBG000:3 USB: Interface: 2/2/1 (if:2/0, 1)<CR><LF>$DBG000:3 USB: Interface: 10/0/0 (if:3/0, 2)<CR><LF>$DBG000:3 USB: Interface: 2/2/1 (if:4/0, 1)<CR><LF>$DBG000:3 USB: Interface: 10/0/0 (if:5/0, 2)<CR><LF>$DBG000:3 USB: Interface: 2/2/1 (if:6/0, 1)<CR><LF>$DBG000:3 USB: Interface: 10/0/0 (if:7/0, 2)<CR><LF>$DBG000:3 USB: Switching to Interface (#0)<CR><LF>$DBG000:3 USB: Class : 2h/2h/1h<CR><LF>$DBG000:3 USB: Using data interface (#1)<CR><LF>$DBG000:3 USB: CDC class started<CR><LF>$DBG001:3 USB: handle 3 (USR_CLASS_SELECTED)<CR><LF>Now the issue is I always receive status as USBH_BUSY in HOST_CLASS_REQUEST state inside USBH_Process() function
.
How to resolve this issue?
Why is the status shown busy?
if I receive ok only then it will change state to HOST_CLASS & communication can be started.
Regards
Pramod
2018-01-05 01:18 AM
Hello All,
The issue is solved it was heap memory issue. I increased the heap size now it is working. I can send & receive data over USB.
$DBG000:3 USBH_Process: HOST_IDLE<CR><LF>
$DBG000:3 USB: Device Attached<CR><LF>$DBG000:3 USB: PID: 1102h<CR><LF>$DBG000:3 USB: VID: 1546h<CR><LF>$DBG000:3 USB: Address (#1) assigned<CR><LF>$DBG000:3 USB: Manufacturer : u-blox<CR><LF>$DBG000:3 USB: Product : u-blox Wireless Module<CR><LF>$DBG000:3 USB: Serial Number : 357520071065649<CR><LF>$DBG000:3 USB: Enumeration done<CR><LF>$DBG000:3 USB: Device has only one configuration<CR><LF>$DBG000:3 USB: Default configuration set<CR><LF>$DBG000:3 USB: Switching to Interface (#0)<CR><LF>$DBG000:3 USB: Class : 2h/2h/1h<CR><LF>@USBH_CDC_ClassInit: CDC_Handle->CommItf.NotifPipe &&&&&&&&&&&&&& 2<CR><LF>$DBG000:3 USB: Using data interface (#1)<CR><LF>$DBG000:3 USB: CDC class started<CR><LF>@USBH_CDC_ClassRequest: HOST_USER_CLASS_ACTIVE status USBH_OK 0<CR><LF>@HOST Class request succesfull<CR><LF>Regards
Pramod
2018-01-05 03:36 AM
Hello All,
How do you find total received & read data.
USBH_CDC_GetLastReceivedDataSize(&USBH_Device);
gives me the last read data. How to find the total remaining data to be read.
Regards
Pramod