AnsweredAssumed Answered

Change the USART Baudrate !

Question asked by EYIGEL.Levent on Jul 25, 2012
Latest reply on Jul 27, 2012 by EYIGEL.Levent
Hello I want to change the USART baudrate in some conditions but i couldn't do this.

switch( bdstate)
          {
            case 0 :
              DownloadUsartConfig(9600);
              break;
            case 1 :
             DownloadUsartConfig(19200);
              break;
            case 2 :
              DownloadUsartConfig(38400);
              break;
            case 3 :
              DownloadUsartConfig(57600);
              break;
            case 4 :
              DownloadUsartConfig(115200);
              break;
            default:
              break ; 
          
          
          }
the function is :
void DownloadUsartConfig(uint32_t baudrate)
{
  USART_InitStructure.USART_BaudRate = baudrate;
  USART_InitStructure.USART_WordLength = USART_WordLength_8b;
  USART_InitStructure.USART_StopBits = USART_StopBits_1;
  USART_InitStructure.USART_Parity = USART_Parity_No;
  USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
  USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;
  
  /* Configure USART2 */
  USART_Init(DL_USART, &USART_InitStructure);
  
  USART_ITConfig(DL_USART, USART_IT_RXNE, ENABLE);
  /* Enable the USART2 */
  USART_Cmd(DL_USART, ENABLE);
}

it doesn't work 
How can do about the this problem ? Where doing i  make  mistake ?

Outcomes