cancel
Showing results for 
Search instead for 
Did you mean: 

UART parity check

lima
Associate II
Posted on September 03, 2005 at 06:03

UART parity check

3 REPLIES 3
lima
Associate II
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

caolei7255
Associate II
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.

lima
Associate II
Posted on September 03, 2005 at 06:03

Thank you,

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