Using Serial Port /dev/ttyAMA0 on Raspberry Pi

hello and Happy Fasting All

I’d like to share about Serial Port on Rpi, kebetulan gw lagi working on Holux GPS GR-89 n mau connect to Rpi UART.note for you all, RPi UART Level itu 3.3volt and GPS gw 5v yang di take from Rpi Pins. on the out world(beuh bahasanya) maksudnya di luaran banyak yang bilang level itu must be converted, but trust me, you dont have to do that thing, just connect lah. it works!! secara umum the Raspberry Pi’s serial port is configured to be used for console input/output. Whilst this is useful if you want to login using the serial port, it means you can’t use the Serial Port in your programs, to be able to use the serial port to connect and talk to other devices (e.g. Arduino/BT-Module), the serial port console login needs to be disabled. Needless to say you will need some other way to login to the Raspberry Pi, and we suggest doing this over the network using an SSH connection, you can do this with putty(jangan jorok ye) terminal.

Just follow these instruction ya, hehe..

Disable Serial Port Login

To enable the serial port for your own use you need to disable login on the port. There are two files that need to be edited The first and main one is

/etc/inittab

This file has the command to enable the login prompt and this needs to be disabled.

Edit the file and move to the end of the file.

You will see a line similar to

T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100

Disable it by adding a # character to the beginning.

Save the file.

#T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100

Disable Bootup Info

When the Raspberry Pi boots up, all the bootup information is sent to the serial port. Disabling this bootup information is optional and you may want to leave this enabled as it is sometimes useful to see what is happening at bootup. If you have a device connected (i.e. Arduino) at bootup, it will receive this information over the serial port, so it is up to you to decide whether this is a problem or not.

You can disable it by editing the file

/boot/cmdline.txt

The contents of the file look like this

dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait

Remove all references to ttyAMA0 (which is the name of the serial port). The file will now look like this

dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait

Reboot

In order you enable the changes you have made, you will need to reboot the Raspberry Pi

# sudo shutdown -r now

Test the Serial Port A great way to test out the serial port is to use the minicom program.

If you dont have this installed run

# sudo apt-get install minicom

Connect your PC to the Raspberry Pi serial port using an appropriate serial port adapter and wiring, then open Putty or a similar serial terminal program on PC side. Setup a connection using the serial port at 9600 baud. Now run up minicom on the Raspberry Pi using :

# minicom -b 9600 -o -D /dev/ttyAMA0

What you type into the minicom terminal screen should appear on the serial PC terminal n sebaliknya,

this is contoh tampilan minicom lewat Putty SSH Terminal in my Win 7, I do this bcoz this is the simple way to access the Rpi.hehe..

NMEA data berhasil gw dapetin, ksananya its up to me dongs.

NMEA Burst on Rpi
NMEA Burst on Rpi — Raspberry Pi + Holux GPS GR-89

hehe.. ok, selamat mencoba kawan. ayo bobok jam stengah 4 nanti kita sahur 🙂

great things begin from the small things -tommy-

Advertisements
Using Serial Port /dev/ttyAMA0 on Raspberry Pi

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s