Skip to main content
Visitor II
September 3, 2005
Question

UART parity check

  • September 3, 2005
  • 3 replies
  • 900 views
Posted on September 03, 2005 at 06:03

UART parity check

    This topic has been closed for replies.

    3 replies

    limaAuthor
    Visitor II
    August 29, 2005
    Posted on August 29, 2005 at 07:04

    Hi, I have some problem with parity check on bytes received by UART. The settings for UART are :

    UART_OnOffConfig(UART0, ENABLE);

    UART_FifoConfig (UART0, DISABLE);

    UART_FifoReset(UART0, UART_RxFIFO);

    UART_FifoReset(UART0, UART_TxFIFO);

    UART_LoopBackConfig(UART0, DISABLE);

    UART_ItConfig(UART0, UART_ParityError, ENABLE);

    UART_Config(UART0, 9600, UART_EVEN_PARITY, UART_1_StopBits,UARTM_8D_P);

    UART_RxConfig(UART0, ENABLE);

    I try to receive bytes from device with both even and odd parity (i'm sure in the correct way checking with oscilloscope) but when i check the parity of received byte with

    while(!(UART_FlagStatus(UART0) & UART_RxBufFull));

    UART_ByteReceive(UART0,(u8 *)&str_viewr[i], 0xFF);

    if((UART_FlagStatus(UART0) & UART_ParityError) ==UART_ParityError)uart_errors++;

    my counter uart_errors is always 0. I try also to make this with uart0 interrupt:

    Set_IRQ(UART0_IRQChannel,1);

    extern u8 uart_errors;

    void UART0_IRQHandler(void) __arm

    {

    if((UART_FlagStatus(UART0) & UART_ParityError) == UART_ParityError)uart_errors++;

    }

    but the result is the same.

    I think someone have any advice

    Thanks

    Visitor II
    August 31, 2005
    Posted on August 31, 2005 at 03:52

    after: UART_ByteReceive(UART0,(u8 *)&str_viewr[i], 0xFF); etc after read rev buffer,the Parity flag is reset.

    limaAuthor
    Visitor II
    September 3, 2005
    Posted on September 03, 2005 at 06:03

    Thank you,

    I try to make parity check before Recv Buffer reading and it work!