2018-04-19 12:10 AM
Hi,
I'm working on STM32F407VG board. Try to get USB Host CDC working. I'm able to get enumeration working. The data can be sent to device. But the data is wrong. For example, 'Hello'(
48 65 6C 6C 6F
) is send from Host. But the device received '00 00 00 00 A7'.Here is the GPIO init:
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9 | GPIO_Pin_11 | GPIO_Pin_12;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF; GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL ; GPIO_Init(GPIOA, &GPIO_InitStructure); GPIO_PinAFConfig(GPIOA,GPIO_PinSource9,GPIO_AF_OTG1_FS) ; GPIO_PinAFConfig(GPIOA,GPIO_PinSource11,GPIO_AF_OTG1_FS) ; GPIO_PinAFConfig(GPIOA,GPIO_PinSource12,GPIO_AF_OTG1_FS) ;/* Configure ID pin */ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10; GPIO_InitStructure.GPIO_OType = GPIO_OType_OD; GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP ; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz; GPIO_Init(GPIOA, &GPIO_InitStructure); GPIO_PinAFConfig(GPIOA,GPIO_PinSource10,GPIO_AF_OTG1_FS) ;RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE);
RCC_AHB2PeriphClockCmd(RCC_AHB2Periph_OTG_FS, ENABLE) ;Here is the HSE:
#define HSE_VALUE ((uint32_t)8000000)
Here are the PLL:
#define PLL_M 8
#define PLL_Q 7
#define PLL_N 336
#define PLL_P 2I attached the project.
Please help!
Many Thanks! I really appreciate it!
2018-04-19 06:58 AM
Hello
kbian
,I'd highly recommend you to refer to 'CDC_Standalone' application under the
firmware package. It's is a typical application on how to use the STM32F4xx USB OTG Host peripheral to operate with an USB CDC device application. You may found it under the path below: STM32Cube_FW_F4_V1.0\Projects\STM324xG_EVAL\Applications\USB_HostKhouloud.
2018-04-19 12:09 PM
Hi Khouloud G,
Thank you so much for your reply.
The reason we're not using CubeMx is because our existing product uses SPL(peripheral library, stm32f4xx_*.c). We just want to add USB Host CDC ability in our existing product. I'm not sure if CubeMx can co-exist with SPL because they are different in architecture wise.
Is it possible for ST to try to use SPL in the STM32F407VG board to get USB Host CDC working? The fact is, we can send some data by using SPL. However the data is wrong. I think we are really close to succeed in communication. If ST can help look into the issue, it'll be great. It maybe related to PLL, clock or line coding? If you or someone in your team can help, I'd really appreciate it!
Please help!
Thanks again!