messinwu
Posts: 17
Joined: Wed Aug 08, 2012 1:33 pm

Additional TTL on I2C or SPI?

Wed Aug 08, 2012 1:41 pm

Hey everyone, I'm a newbie with electronics, kind of. I've already got a MAX3232 set up on the "Mini-UART" pins to provide me /dev/ttyAMA0 serial port, which I'm going to use to communicate with a radio modem, and it's working well. However, I'd like to avoid using the USB ports as much as possible so I'd like to access another serial port for a GPS module which talks TTL (it also can talk RS232). I've ready somewhere that the RasPi does have another "more complex" serial port as well as the simple one I've already connected to. How do I access it?

I guess there are SPI/I2C pins on the GPIO header pins, but I don't really understand how to interface with them. I'm running Arch Linux. I can connect the GPS module via female jumper wires easily, it requires 5 volts, and I know which pin that is, but what else do I need to do?

Is someone generous enough to spoon feed me on this? Do I need to purchase an additional interface module? Something dirt cheap is preferable. The GPS module is the GT-320FW, this is for a high altitude balloon project. I have several USB-Serial adapters, but again, I'd like to avoid USB as much as possible, as I'm already planning to have a USB Webcam connected.

User avatar
TonyD
Posts: 445
Joined: Thu Sep 08, 2011 10:58 am
Location: Newcastle, UK
Contact: Website

Re: Additional TTL on I2C or SPI?

Thu Aug 09, 2012 11:29 am

If your GPS module is a 5V unit then you'll need some 5V to 3.3V conversion as the Raspberry Pi GPIO is 3.3V only.

There's a couple of forum posts you can search for that discuss doing 5V to 3.3V conversion for the RPi GPIO.
Tony

messinwu
Posts: 17
Joined: Wed Aug 08, 2012 1:33 pm

Re: Additional TTL on I2C or SPI?

Thu Aug 09, 2012 11:45 am

Thank you, but I've already dealt with that on the Mini-UART pins 14 and 15 and have /dev/ttyAMA0 working properly already with an adapter module as mentioned in my initial post. I'm trying to make an additional serial interface work using alternate pins.

The GPS unit does use 5v, but why couldn't I just plug in to the 5v header to supply the correct voltage?

Hmm, seems nobody has the answer, or else this forum isn't as active as others I've posted on for general linux issues. I'm thinking of getting a $15 I2C-to-UART breakout module, which should give me an additional TX and RX like the one I'm already using.... Kind of pecking in the dark here though.

User avatar
Grumpy Mike
Posts: 901
Joined: Sat Sep 10, 2011 7:49 pm
Location: Manchester (England England)
Contact: Website

Re: Additional TTL on I2C or SPI?

Thu Aug 09, 2012 5:50 pm

The GPS unit does use 5v, but why couldn't I just plug in to the 5v header to supply the correct voltage?
Because then the signals being fed into the Pi would be 5V logic signals and would damage the Pi's input pins.

messinwu
Posts: 17
Joined: Wed Aug 08, 2012 1:33 pm

Re: Additional TTL on I2C or SPI?

Thu Aug 09, 2012 6:00 pm

Ahh, gotcha.

Here's a link which originally got me thinking about the allegedly available 2nd serial port:
http://lavalink.com/2012/04/more-on-ras ... ial-ports/

They go into lots of detail regarding the capabilities of the supposed second serial port available on the Pi, but stop short of explaining how to actually gain access to it.

Upon further research, I see the Broadcom chip has several "ALT" modes of operation for the GPIO pins configurations, which appears to allow actually two additional serial ports between ALT3 and ALT5 configurations, but I've not really found anywhere that explains how to configure the GPIO pins for alternate functions like that, whether each pin can be configured separately, etc....

davidmam
Posts: 101
Joined: Tue Dec 06, 2011 4:13 pm

Re: Additional TTL on I2C or SPI?

Fri Aug 10, 2012 9:41 am

Grumpy Mike wrote:
The GPS unit does use 5v, but why couldn't I just plug in to the 5v header to supply the correct voltage?
Because then the signals being fed into the Pi would be 5V logic signals and would damage the Pi's input pins.
To do that you would need to conenct a 5v input to the GPIO pin. You can use the 5v header pin to power the GPS unit, as long as it doesn't take too much current. IIRC GPS can use a lot of power in very short bursts. It may cause wierd problems if it sucks too much power. Do ensure that any inputs to the GPIO are properly regulated down to 3.3v.

User avatar
Grumpy Mike
Posts: 901
Joined: Sat Sep 10, 2011 7:49 pm
Location: Manchester (England England)
Contact: Website

Re: Additional TTL on I2C or SPI?

Sat Aug 11, 2012 9:47 am

If you look at the data sheet you will see that there are two UARTS a simple one and a full one. It also shows you what pins you can map them to. Note that you can map the same thing to more than one pin by using the Alt functions on the GPIO setup register.
However, I don't know if Linux has any drivers for accessing another one.

User avatar
TonyD
Posts: 445
Joined: Thu Sep 08, 2011 10:58 am
Location: Newcastle, UK
Contact: Website

Re: Additional TTL on I2C or SPI?

Sun Aug 12, 2012 6:30 pm

messinwu wrote: Here's a link which originally got me thinking about the allegedly available 2nd serial port:
http://lavalink.com/2012/04/more-on-ras ... ial-ports/

They go into lots of detail regarding the capabilities of the supposed second serial port available on the Pi, but stop short of explaining how to actually gain access to it.
...
IMHO I think that article is wrong. Looking at the table (see below) from it, the alternative UART Tx and Rx are at GPIO32 and GPIO33 and also at GPIO36 and GPIO37. These GPIO aren't available on the RPi expansion header and in fact according to the RPi schematic these GPIO aren't connected to anything. So whilst its true there is a second UART on the Broadcom chip, this UART is not accessible.

Image
Tony

messinwu
Posts: 17
Joined: Wed Aug 08, 2012 1:33 pm

Re: Additional TTL on I2C or SPI?

Mon Aug 13, 2012 1:31 am

Thank you SO MUCH for clearing this issue up, finally! Now I can move on to other methods.

Anyone hear of anybody getting SoftwareSerial working on the Pi? It's traditionally an Arduino library, but I'm sure it could be ported to the Pi. I just don't have the knowledge to do so, I have a feeling it would require knowing something about the clock and the GPIO pin numbers. Then hopefully it would compile. Anyone play with that yet?

fraverg
Posts: 1
Joined: Thu Sep 06, 2012 8:30 pm

Re: Additional TTL on I2C or SPI?

Thu Sep 06, 2012 8:37 pm

as davidman said all 5V signals in input on the GPIO shall be dropped down to 3.3V to avoid damages.
The question is: how can I use 8 GPIO pin as bidirectional data bus? I mean that the same 8 bit can be configured as input or output depending on the program needing.
Does a kind of bidirectional "voltage converter" exists?

thanks for your help.

techpaul
Posts: 1512
Joined: Sat Jul 14, 2012 6:40 pm
Location: Reading, UK
Contact: Website

Re: Additional TTL on I2C or SPI?

Thu Sep 06, 2012 8:58 pm

Yes look at TIs TXB0108 devices fully birdirectional and other goodies for level transaltion.

That is 8 bi-dir 5V to 3V3 translation with 8kV ESD on 5V side and isolate both sdes if one power rail is not there
Just another techie on the net - For GPIO boards see http:///www.facebook.com/pcservicesreading
or http://www.pcserviceselectronics.co.uk/pi/

SUMIT GARETHIYA
Posts: 4
Joined: Mon Nov 24, 2014 4:42 am

Re: Additional TTL on I2C or SPI?

Tue Dec 23, 2014 5:44 am

Hello to all,

can any one please help me ..

i want to interface a GY-GPS6MV2 gps module with raspberry pi. how this can be done ?

https://www.openimpulse.com/blog/produc ... ps-module/

i want to get the value of latittude and longitiude.

please suggust me some python code. i am new in this area, soo i had suffer from lot of problem.

Return to “Interfacing (DSI, CSI, I2C, etc.)”