USART and PIO configuration

Hi.

I am working on a project with USART and Due and I am in the dark. What I am trying to accomplish goes something like that:

Enable Serial
Send some data over Serial
Disable Serial
Enable PIO
Bit bang custom interface
Disable PIO

Problem is, that I do not know how to adjust message length on Serial (USART) interface, so I have to bit bang 14 bits of data to the controller. It is not plausible for me, to break down 14bits to 2 bytes because of the risk of losing data and I do not want add more complexity to whole thing.
Serial works, problem is with bit banging. When used without controller on the other side, bit banging works. But when controller is connected, nothing happens. What I am asking you guys is how to set up PIO to resemble USART configuration or in other words what happens with the PIO when USART is enabled (Pull-Ups?, high impedance?,...)? I was looking into SAM3X8 datasheet and did not find any answers (or I am too tired for datasheets right now...).
This is how I configure PIO right now:

PIOA->PIO_PER = PIO_PA13;
PIOA->PIO_OER = PIO_PA13;

And I use these for controlling the PIO:

PIOA->PIO_CODR = PIO_PA13; // clear PIO
PIOA->PIO_SODR = PIO_PA13; // set PIO

Alternative solution would be to change message length of USART...

Are you saying that there is a device in this world that requires 14-bit words over async serial?

Can you provide a link to it?

If you want to know: LIN devices have something called Synch Break, which is 13bit of dominant state and then 1bit recessive. You can use uC's USART to connect to devices with LIN transceivers. I can name 2 of those transceivers: MCP2021 and TJA1021. There goes your argument and sarcasm with it...

But right now LIN is not a problem. I usually bit bang those 14bits mentioned above and then go over to USART. That is where I am coming from with this problem - I know it can be done but I do not know how it should be done on DUE.

I also know that the easiest way is to break 14bit data into 2 bytes. But I am looking for more elegant solution where I am not at risk of losing data. Breaking data apart is plan Z at the moment.

Found a problem. I did not clear PIO configurations before starting Serial and everything just went bezerk. This helped me out.

Sory Graynomad for being rude to you. :wink:

:slight_smile: