2018-10-27 07:50 PM
I have some problem about STM32429zi-disc1 card usart2 periph. I'm sending data via usb to rs232 conv but data is wrong. In my opinion, boud rate is different from my choice. probably, its derive from PLL. How can I fix it ? Pc always receive 0x00 or similar data
My PLL setting is following:
************************* PLL Parameters *************************************/
/* PLL_VCO = (HSE_VALUE or HSI_VALUE / PLL_M) * PLL_N */
#define PLL_M 8
/* USB OTG FS, SDIO and RNG Clock = PLL_VCO / PLLQ */
#define PLL_Q 7
#if defined (STM32F40_41xxx)
#define PLL_N 336
/* SYSCLK = PLL_VCO / PLL_P */
#define PLL_P 2
#endif /* STM32F40_41xxx */
#if defined (STM32F427_437xx) || defined (STM32F429_439xx)
#define PLL_N 360
/* SYSCLK = PLL_VCO / PLL_P */
#define PLL_P 2
#endif /* STM32F427_437x || STM32F429_439xx */
#if defined (STM32F401xx)
#define PLL_N 336
/* SYSCLK = PLL_VCO / PLL_P */
#define PLL_P 4
#endif /* STM32F401xx */
and my usart code is following:
USART_InitStruct.USART_BaudRate = 115200;
USART_InitStruct.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
USART_InitStruct.USART_Mode = USART_Mode_Rx|USART_Mode_Tx;
USART_InitStruct.USART_Parity = USART_Parity_No;
USART_InitStruct.USART_StopBits = USART_StopBits_1;
USART_InitStruct.USART_WordLength = USART_WordLength_8b;
USART_Init(USART2,&USART_InitStruct);
USART_Cmd(USART2,ENABLE);
InitGPIO( sGPIOD,
GPIO_Mode_AF,
GPIO_OType_PP,
GPIO_Speed_100MHz,
GPIO_PuPd_UP,
GPIO_Pin_5|GPIO_Pin_6);
GPIO_PinAFConfig(GPIOD,GPIO_PinSource5,GPIO_AF_USART2);
GPIO_PinAFConfig(GPIOD,GPIO_PinSource6,GPIO_AF_USART2);
main loop is :
while(1){
while(!USART_GetFlagStatus(USART2, USART_FLAG_TXE));
USART2->DR = 0x0002;
_delay_ms(1000);
}//EOF Loop
My usart converter is profilic and ch34. Ist work another my desktop app