AnsweredAssumed Answered

STR912 Partiry bit set Error.

Question asked by yun.yeo_chul on Apr 9, 2014
Latest reply on May 26, 2014 by erwin
hi.dear

i use to IAR compiler, default_form_lib_2.1_iar_5.30 library and jlink.
it is my developer environment.
 my chip is STR912FAW44.

first. i initialize UART2 set None parity bit.
second. i change to UART2 set  Even parity bit.

i check registor by jlink. it is ok changed Even parity bit.
but it was still operationg in non parity bit.

next is my initialize UART1 and baud rate change C code.

void UART1_Initial(void)
{
    /* Enable the UART0 Clock */
    SCU_APBPeriphClockConfig(__UART1, ENABLE);
    SCU_APBPeriphReset(__UART1,ENABLE);
    UART_DeInit(UART1); 
   
    GPIO_StructInit(&GPIO_InitStructure);       //Initialize the GPIO Init Structure parameters
   
    /*Gonfigure UART1_Rx pin GPIO3.2*/
    GPIO_InitStructure.GPIO_Direction = GPIO_PinInput;
    GPIO_InitStructure.GPIO_Pin = GPIO_Pin_2;
    GPIO_InitStructure.GPIO_Type = GPIO_Type_PushPull ;
    GPIO_InitStructure.GPIO_IPInputConnected = GPIO_IPInputConnected_Enable;
    GPIO_InitStructure.GPIO_Alternate = GPIO_InputAlt1  ;
    GPIO_Init(GPIO3, &GPIO_InitStructure);
   
    /*Gonfigure UART1_Tx pin GPIO3.3*/
    GPIO_InitStructure.GPIO_Direction = GPIO_PinOutput;
    GPIO_InitStructure.GPIO_Pin = GPIO_Pin_3;
    GPIO_InitStructure.GPIO_Type = GPIO_Type_PushPull ;
    GPIO_InitStructure.GPIO_IPInputConnected = GPIO_IPInputConnected_Disable;
    GPIO_InitStructure.GPIO_Alternate = GPIO_OutputAlt2  ;
    GPIO_Init(GPIO3, &GPIO_InitStructure); 

    UART_InitStructure.UART_WordLength = UART_WordLength_8D;
    UART_InitStructure.UART_StopBits = UART_StopBits_1;
    UART_InitStructure.UART_Parity = UART_Parity_No ;
    UART_InitStructure.UART_BaudRate = 115200;
    UART_InitStructure.UART_HardwareFlowControl = UART_HardwareFlowControl_None;     // no flow controll
    UART_InitStructure.UART_Mode = UART_Mode_Tx_Rx;
    UART_InitStructure.UART_FIFO = UART_FIFO_Disable;  
   
size 16 bytes, FIFO level 8 bytes */
    UART_Init(UART1, &UART_InitStructure);
    UART_ITConfig(UART1, UART_IT_Receive | UART_IT_Transmit, ENABLE);  
   
    VIC_Config(UART1_ITLine, VIC_IRQ, 5);
    VIC_ITCmd(UART1_ITLine, ENABLE); 
   
    /* Enable the UART0 */
    UART_Cmd(UART1, ENABLE);
}

void uart1_baudrate_set(INT32U baud)
{
    UART_InitStructure.UART_WordLength = UART_WordLength_8D;
    UART_InitStructure.UART_StopBits = UART_StopBits_1;
    UART_InitStructure.UART_Parity = UART_Parity_Even ;
   
    switch(baud)
    {
        case BAUD_RATE_9600:
        case BAUD_RATE_19200:
        case BAUD_RATE_38400:
        case BAUD_RATE_57600:
        case BAUD_RATE_115200:
            UART_InitStructure.UART_BaudRate = baud;
            break;
        default :
            UART_InitStructure.UART_BaudRate = 115200;
            break;
    }
    UART_InitStructure.UART_HardwareFlowControl = UART_HardwareFlowControl_None;  
    UART_InitStructure.UART_Mode = UART_Mode_Tx_Rx;
    UART_InitStructure.UART_FIFO = UART_FIFO_Disable; 
   
    UART_Init(UART1, &UART_InitStructure);
}

Ican notunderstand this situation.

i want to solution.

Outcomes