2014-04-13 09:23 AM
Hi all,
I have problem about setting baud rate of USART1 to 3200000 or 3686400 or 4000000. To be able to setthe higher baudrates, I revised my RCC_Configuration() as:ErrorStatus HSEStartUpStatus; /* RCC system reset(for debug purpose) */ RCC_DeInit(); /* Enable HSE */ RCC_HSEConfig(RCC_HSE_ON); /* Wait till HSE is ready */ HSEStartUpStatus = RCC_WaitForHSEStartUp(); if(HSEStartUpStatus == SUCCESS) { // HCLK = SYSCLK RCC_HCLKConfig(RCC_SYSCLK_Div1); RCC_PCLK2Config(RCC_HCLK_Div1); RCC_PCLK1Config(RCC_HCLK_Div1); FLASH_SetLatency(FLASH_Latency_2); FLASH_PrefetchBufferCmd(FLASH_PrefetchBuffer_Enable); // PLLCLK = 8MHz * 9 = 72 MHz RCC_PLLConfig(RCC_PLLSource_HSE_Div1, RCC_PLLMul_9); RCC_PLLCmd(ENABLE); while(RCC_GetFlagStatus(RCC_FLAG_PLLRDY) == RESET) { } // Select PLL as system clock source RCC_SYSCLKConfig(RCC_SYSCLKSource_PLLCLK); // Wait till PLL is used as system clock source while(RCC_GetSYSCLKSource() != 0x08) { } } RCC_AHBPeriphClockCmd ( RCC_AHBPeriph_DMA1 , ENABLE); RCC_APB2PeriphClockCmd( RCC_APB2Periph_ALL , ENABLE); RCC_APB1PeriphClockCmd( RCC_APB1Periph_ALL , ENABLE);This code works fine with baudrate=921600. But if I set the baudrate to 3200000 or higher,doesn't work properly.Pls help me if I have any mistake.Thanks2014-04-13 10:07 AM
Higher baud rates are more difficult to hit accurately based on the nature of the divider chain. For example the 3200000 will have an error in the order of 3%. Can the connected device handle this, and have you reviewed the signal with an oscilloscope?
2014-04-13 11:08 AM
Yes I know 3200000 is not accurate but 3686400 is more accurate. What can I do to use this baudrate?
The connected device can easily handle this baud rate, no problem. The problem is I can't use 36864000 bps. 921600 is OK but 3686400 is problem.2014-04-13 02:24 PM
Beyond 1 MBps, I'd honestly look at something other that async serial, also be conscious that there are some RS232 line drivers that filter at high rates.
3200000 72000000 / 22 = 3272727 2.27 % error
3200000 72000000 / 23 = 3130434 2.17 % error
3686400 72000000 / 19 = 3789473 2.80 % error
3686400 72000000 / 20 = 3600000 2.34 % error
4000000 72000000 / 18 = 4000000 0.00 % error
2014-04-14 09:18 AM
Thanks for your reply.