2010-03-23 18:46:36     Simple Parity Checking Question

Document created by Aaronwu Employee on Aug 21, 2013
Version 1Show Document
  • View in full screen mode

2010-03-23 18:46:36     Simple Parity Checking Question

David Kasper (UNITED STATES)

Message: 87629   

 

Termios supports parity configuration.  However, is it possible for a user space application to get parity status of received data (i.e. via ioctl)?

 

Thanks,

 

David Kasper

QuoteReplyEditDelete

 

 

2010-03-23 19:21:45     Re: Simple Parity Checking Question

Mike Frysinger (UNITED STATES)

Message: 87630   

 

i believe the only way to do it is to configure the port via the normal termios functions to pass up the parity data inline.  see IGNPAR and PARMRK and such.

QuoteReplyEditDelete

 

 

2010-04-05 22:24:12     Re: Simple Parity Checking Question

David Kasper (UNITED STATES)

Message: 88109   

 

Mark,

 

I am still unable to detect input parity errors with the following settings:

 

    IGNPAR = RESET

    PARMRK = SET

    INPCK = SET

 

My terminal settings are as follows:

 

root:/> stty -a </dev/ttyBF1

speed 19200 baud; rows 24; columns 80;

intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V;

flush = ^O; min = 0; time = 0;

parenb parodd cs8 hupcl -cstopb cread clocal -crtscts

-ignbrk -brkint -ignpar parmrk inpck -istrip -inlcr -igncr -icrnl -ixon -ixoff -iuclc -ixany -imaxbel

-opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0

-isig -icanon -iexten -echo echoe echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke

root:/>

 

 

Also, my setup code is listed below.  I am running 2008R1.5-RC3.  Let me know if I have missed anything.

 

Thanks,

 

Dave

 

// Get current terminal settings

 

tcgetattr(m_iFid, &m_tmbuf);

 

// Copy current settings so we can restore them later

 

m_tmsave = m_tmbuf;

 

// Local modes - turn off echoing, canocal, extended functions

 

// and signal chars

 

m_tmbuf.c_lflag &= ~(ECHO|ICANON|IEXTEN|ISIG);

 

// Non-blocking

 

m_tmbuf.c_cc[VMIN] = 0;

 

m_tmbuf.c_cc[VTIME] = 0;

 

// Input modes - turn off canonical, extended functions and signal chars

 

m_tmbuf.c_iflag &= ~(BRKINT|ICRNL|INPCK|ISTRIP|IXON);

 

//Enable parity checking

 

m_tmbuf.c_iflag |= (INPCK|PARMRK);

 

 

 

// Output modes - turn off post processing

 

m_tmbuf.c_oflag &= ~(OPOST);

 

// Configure 8 bits per character

 

m_tmbuf.c_cflag |= (CS8);

 

//Check if parity is enabled

 

if (m_nParity == ODD_PARITY)

 

{

 

m_tmbuf.c_cflag |= (PARENB|PARODD);

 

}

 

// Configure input/output baud rate

 

cfsetispeed(&m_tmbuf, m_nBaud);

 

cfsetospeed(&m_tmbuf, m_nBaud);

 

// Apply new settings now after flushing

 

tcsetattr(m_iFid, TCSAFLUSH, &m_tmbuf);

QuoteReplyEditDelete

 

 

2010-04-05 23:35:34     Re: Simple Parity Checking Question

Sonic Zhang (CHINA)

Message: 88111   

 

Are you sure you generate the parity error on serial line?

 

Could you tconfigure bfin serial driver into PIO mode and try again?

QuoteReplyEditDelete

 

 

2010-04-06 00:51:20     Re: Simple Parity Checking Question

David Kasper (UNITED STATES)

Message: 88115   

 

Sonic,

 

I am not sure what you meant by tconfigure.  Do I have to rebuild the kernel or do I invoke a command at the Linux prompt or from my program.

 

Thanks,

 

Dave

QuoteReplyEditDelete

 

 

2010-04-06 01:25:50     Re: Simple Parity Checking Question

Sonic Zhang (CHINA)

Message: 88117   

 

rebuild the kernel.

QuoteReplyEditDelete

 

 

2010-04-06 21:00:51     Re: Simple Parity Checking Question

David Kasper (UNITED STATES)

Message: 88154   

 

Sonic,

 

Thanks for your help.  The kernel works.  I found a test setup issue for my parity error generator.

 

Dave

Attachments

    Outcomes