AnsweredAssumed Answered

Why STM32F407VG USB Host CDC sending wrong data?

Question asked by Pilot B on Apr 19, 2018
Latest reply on Apr 19, 2018 by Pilot B

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     2

 

I attached the project.

 

Please help!

Many Thanks! I really appreciate it!

Attachments

Outcomes