Page 1 of 1

Inverted Serial on pyboard

Posted: Thu Dec 17, 2015 8:07 pm
by Sokrates
Hi all. I'm wondering if there is a way to have an inverted serial on the pyboard without using an external circuit.

Thanks to everyone that could help on this!

Re: Inverted Serial on pyboard

Posted: Thu Dec 17, 2015 8:49 pm
by dhylands
I took a quick look through the datasheet and I don't see anything in the registers which would do that.

Re: Inverted Serial on pyboard

Posted: Thu Dec 17, 2015 9:19 pm
by Sokrates
dhylands wrote:I took a quick look through the datasheet and I don't see anything in the registers which would do that.
thanks for checking. No many option then :)

Re: Inverted Serial on pyboard

Posted: Fri Dec 18, 2015 9:11 am
by Damien
You could always bit bang it :) Or if you need efficiency synthesis it using SPI.

Re: Inverted Serial on pyboard

Posted: Fri Dec 18, 2015 10:33 am
by pythoncoder
This is a real hack. It will only work if the baudrate is relatively low, but you could feed the UART tx line to another pin and set up an interrupt callback on any state change which outputs the inverse on another pin. Likewise for the rx data.

I told you it was a hack ;)

Re: Inverted Serial on pyboard

Posted: Sat Dec 19, 2015 9:24 am
by Roberthh
If it's not only inverting, but level aligning too, then an external buffer/driver is required anyhow. And in any case the external inverter would protect PyBoard from damage.

Re: Inverted Serial on pyboard

Posted: Sat Dec 19, 2015 4:18 pm
by Sokrates
thanks guys.
I'm going to start with the external inverter (that I have already got). My project is at the very early stage and I want to speed up the prototyping using what I already have available. In the second stage I will deal with optimizations like this one.

Could you confirm that all the UART are 5v tolerant? Looking at the data sheet I understand that only pins X5 and X6 are not 5v tolerant. Is that right?

Re: Inverted Serial on pyboard

Posted: Sat Dec 19, 2015 4:58 pm
by dhylands
My understanding is that all of the pins are 5v tolerant when in a digital mode. When in an analog mode (i.e. being used as an ADC) then they are only 3.3v tolerant. It looks like X5 & X6 are always tied to the ADC which is why they're not 5V tolerant.

Re: Inverted Serial on pyboard

Posted: Sat Dec 19, 2015 6:52 pm
by Sokrates
dhylands wrote:My understanding is that all of the pins are 5v tolerant when in a digital mode. When in an analog mode (i.e. being used as an ADC) then they are only 3.3v tolerant. It looks like X5 & X6 are always tied to the ADC which is why they're not 5V tolerant.
Thanks a million!

Re: Inverted Serial on pyboard

Posted: Sat Dec 19, 2015 8:10 pm
by blmorris
If you are going to use an RS232 level shifter that runs on 5V, do be careful that the out-going buffer will accept the 3.3V output from the pyboard as a logic high. I was about to hack something together this week using some MAX232N's that I had sitting around, only to look up the data sheet and discover that its logic-high input threshold was 3.5V; even though the pyboard logic is 5V tolerant, it can't produce 5V logic levels as outputs.

There are level shifters that can be powered from a single 3.3V supply; I have used the MAX3227 for this, and it provides output levels of roughly +/- 5.5 - 6V, which is sufficient for RS232.

-Bryan