Page 1 of 1

GPIO interfacing, voltage translation

PostPosted: Sat Sep 27, 2014 7:48 am
by yanidubin
I have rebuilt my Parallella FPGA to connect up UART0 via the EMIO to external pins (were assigned to GPIO). I'll have a tutorial up for this process here soon.

The next step for me is interfacing to an external microprocessor (an AVR I use to drive motors) running at a higher voltage domain (5v). So as part of this, I thought it may be helpful to others if I provided an interfacing guide, suggesting how to safely interface the ~2.5-2.9-3.3v (depending on PMIC config / stage of bootup process) IO levels to arbitrary external interfaces using a bi-directional converter.

I intend to use BSS138 MOSFET based convertsion, as described in this app note. The reason I chose this one, apart from its simplicity (no ICs required) and cost is that it does not tie you to fixed levels. This is a very versatile converter to have in your toolbox, allowing you to convert from ~1.2V up to ~10V - I've found differing claims on the exact limits). So you can use it to convert 2v5 to 5v to connect your Parallella to an AVR, and then reuse it to connect either of these to your Beaglebone (2v5 to 3v3, or 3v3 to 5v). The only concern I have is the speed of the circuit, and what effect this will have for various applications.

I have a veroboard prototype of the converter mostly working, and from my DMM measurements (I have no scope at home) it seems to deliver what it promises - once I've connected it via something expendable (like an ARM7 board, or a Raspberry Pi), I'll hook it up to the Parallella. For my project, I intend to build the converter into the PCB carrying the AVR. Not planning to roll a daughterboard - but something which interfaces to the Porcupine - likely cabled for now.

You can order these as separate modules from the likes of adafruit.

Assuming I am able to get something sane happening with my veroboard prototyped converter - it seems fairly sound based on DMM measurements, but I might wait until I can scope it at work next week before I potentially risk my Parallella. Hmmm... I guess I do have a Raspberry Pi lying around with no purpose - perhaps it will make a good canary :)

Obviously there are IC-based solutions which might be more appropriate where high-speed interfaces need translation - like the TXB0108. This provides a similar wide-range of operation, and also bi-directional - but the current driving capacity is minimal, so you can't use it for switching loads.

Anyone used the BSS138 converter before, and familiar with their performance/speed (with/without pullups - since those are only needed for open-drain outputs such as I2C) and want to provide some input? (at whatever voltage you like :)) Or want to suggest any alternatives?

Re: GPIO interfacing, voltage translation

PostPosted: Sat Sep 27, 2014 10:56 am
by patc
It's been a while but based on the Sparkfun reference I've used few times the BSS138:

I don't remember the specifics but it worked as expected, so you should be fine.

Regarding I2C once I designed a vision system with the Toshiba TCM8230 camera for a homemade pick-and-place and I used the TCA9406 for the voltage translation:

Re: GPIO interfacing, voltage translation

PostPosted: Sat Sep 27, 2014 11:09 am
by yanidubin
Sadly neither the Sparkfun nor adafruit pages offer anything like maximum SPI/I2C/UART speeds for the BSS138 one. While I have a veroboard prototype, I wouldn't rely on it giving a very good representation of maximum throughput. Might wait until I get one, and do some tests.

The TCA9406 looks like it might be better for higher speed stuff. Doesn't seem to come on any off-the-shelf boards (not an issue when spinning a board - but wanting to evaluate interfaces that are easily accessible to anyone also, so these can be recommended).

Re: GPIO interfacing, voltage translation

PostPosted: Mon Sep 29, 2014 10:32 am
by yanidubin
Unfortunately my perfboard prototype exhibits a significant degree of overshoot under the scope (at VIO = 2.5V, spikes to 3V going high, -0.5V going low - so bigger issues than slew just now). So not going to be connecting my Parallella to the outside world just yet... :(

Re: GPIO interfacing, voltage translation

PostPosted: Sat Oct 04, 2014 6:52 am
by yanidubin
As promised, the Tutorial for enabling and bringing out UART0 is now up. Please refer to this thread for links / feedback.

Re: GPIO interfacing, voltage translation

PostPosted: Sun Oct 26, 2014 8:15 am
by yanidubin
If anyone is following this, I just successfully interfaced my Parallella (via the porcupine, using UART0 as covered in my tutorial) through a BSS138 converter (described at the beginning of this thread), to my 5V AVR UARTs, in order to drive my camera controller. I am connected to my Parallella (via ssh), sending commands into picocom to the AVR UART, and having it drive my servos. I hope to provide a demo of this in the next few days.

Basically, I think matters improved once I got the PCBs in, rather than the perfboard prototype I was using, and its attendant inductance - and a single ground line down the edge of the board is now a proper plane.

Also, I experienced the more concerning overshoots when I was testing for the worst possible case. 1v8 on the low side, 10v on the high side. I still see a concerning level of overshoot at these levels, but at the levels that concern me (2v5 to 5v0) the overshoot is in the order of 3%. While I am unsure what affect my monkey patch cabling will have, in the end I decided nothing ventured, nothing gained.

I intend to make some time to get some proper results on the scopes at work - I only did a very quick test on Friday, and unfortunately since my Android phone only supports PTP/MTP and not USB mass storage, and I lacked a USB key, I was grabbing traces from a lovely ~$23k scope on a crappy smartphone camera).

Eventually, I intend to put up a proper post on this on my blog, along with the scope captures, and I will link from here. In the coming months I will also be prototyping a few dual supply level converters based on TI chipsets, to give people a few options. In particular, the TXB0108 (which I already mentioned in this thread), the TXS0108E (which supports not only push-pull, but also open-drain), and the LSF0108 (which boasts very high speed operation - ~50x increase over TXx chips for open-drain applications, and a ~50% increase for push-pull).

Re: GPIO interfacing, voltage translation

PostPosted: Sun Oct 26, 2014 1:49 pm
by 9600
Nice work and looking forward to the post. With interest in using Parallella in drones and for robotics etc. I can see this sort of interfacing being a common requirement!