0

I am trying to get an additional data bit out of ttyAMA0, which basicly works with edo1's approach (Without the CMSPAR patch, atm). In addition, I'm already running an arbitrary Baud rate of 20,35k, using the BOTHER flag.

Now the problem is that you obviously have to switch the parity on a per Byte basis, but it does not seem to change fast enough, resulting in entire blocks of data carrying the wrong(but same throughout blocks) parity.

Does anyone know what is causing that and/or a way around it?

        #include <unistd.h>
        #include <fcntl.h>
        #include <asm/termios.h>

        void send_byte_with_parity(unsigned char byte, unsigned char parity);

        for(i=0;i<37;i++)
        {
            send_byte_with_parity((unsigned char)tx_buffer[i], (tx_buffer[i] & (1<<8)));
        }

Reading the parity bit on Rx is a different story, but I'm glad for any info on that as well.

mystery
  • 518
  • 2
  • 11
  • Related http://raspberrypi.stackexchange.com/questions/24806/9-data-bits-on-uart-pins – Ghanima May 11 '16 at 06:41
  • I've already tested software solutions, this is about the tty device. – mystery May 11 '16 at 06:49
  • Did the software solutions work? I'm not sure if anyone has demonstrated a working hardware solution on the Pi. – joan May 11 '16 at 08:51
  • They do work using your library but the random jitter(>10us) is a big problem(not your fault, just the OS) – mystery May 11 '16 at 10:10
  • @mystery I wouldn't have expected jitter unless there is a lot of network activity or the Pi is exceptionally busy. Is there much else happening on the Pi? – joan May 11 '16 at 12:21
  • @joan I require the communication to be 100% reliable, no matter whatever is happening, hence the HW UART(<500ns). I have tested no load at all as well as several Benchmarks(FPU,Disk) pushing the pi2 to full utilization; same results. The jitter is usually below 5us, but sometimes spikes to unknown values, which is deadly. – mystery May 11 '16 at 12:59
  • @mystery I'll be interested to see the reliability of both solutions compared for various loads. – joan May 11 '16 at 13:23
  • @joan bridge TX and RX, send cyclic data (just to notice inconsistencies) and write RX data to a file, ideally separated by a delimiter for easier analysis. Then leave it running for a couple of hours under whatever load you are interested in. Tip: write to /shm – mystery Mar 22 '18 at 16:13

0 Answers0