Inverted Serial on pyboard

The official pyboard running MicroPython.
This is the reference design and main target board for MicroPython.
You can buy one at the store.
Target audience: Users with a pyboard.
Post Reply
Sokrates
Posts: 15
Joined: Mon Dec 14, 2015 11:24 pm

Inverted Serial on pyboard

Post by Sokrates » Thu Dec 17, 2015 8:07 pm

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!

User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: Inverted Serial on pyboard

Post by dhylands » Thu Dec 17, 2015 8:49 pm

I took a quick look through the datasheet and I don't see anything in the registers which would do that.

Sokrates
Posts: 15
Joined: Mon Dec 14, 2015 11:24 pm

Re: Inverted Serial on pyboard

Post by Sokrates » Thu Dec 17, 2015 9:19 pm

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 :)

Damien
Site Admin
Posts: 647
Joined: Mon Dec 09, 2013 5:02 pm

Re: Inverted Serial on pyboard

Post by Damien » Fri Dec 18, 2015 9:11 am

You could always bit bang it :) Or if you need efficiency synthesis it using SPI.

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: Inverted Serial on pyboard

Post by pythoncoder » Fri Dec 18, 2015 10:33 am

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 ;)
Peter Hinch
Index to my micropython libraries.

User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: Inverted Serial on pyboard

Post by Roberthh » Sat Dec 19, 2015 9:24 am

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.

Sokrates
Posts: 15
Joined: Mon Dec 14, 2015 11:24 pm

Re: Inverted Serial on pyboard

Post by Sokrates » Sat Dec 19, 2015 4:18 pm

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?

User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: Inverted Serial on pyboard

Post by dhylands » Sat Dec 19, 2015 4:58 pm

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.

Sokrates
Posts: 15
Joined: Mon Dec 14, 2015 11:24 pm

Re: Inverted Serial on pyboard

Post by Sokrates » Sat Dec 19, 2015 6:52 pm

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!

blmorris
Posts: 348
Joined: Fri May 02, 2014 3:43 pm
Location: Massachusetts, USA

Re: Inverted Serial on pyboard

Post by blmorris » Sat Dec 19, 2015 8:10 pm

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

Post Reply