serial comms on RPI GPIO pins

Discussion in 'Embedded Systems and Microcontrollers' started by Little Ghostman, Jan 16, 2016.

  1. Little Ghostman

    Thread Starter Member

    Jan 1, 2014
    294
    97
    Hi,I think I have over googled this and ended up confused on what should be easy question!

    So apologize in advance

    I am almost finished with my school prelim exams project, as well as various micro's and chips it has a Raspberry Pi on it to do a certain task. I noticed that it has RS232 pins on the GPIO and this would be handy for communicating with one of the modules on the project, the other modules use the SPI bus but one in particular would be better separated and on serial.

    Now having googled and googled I am unsure if the serial pins are reserved for connecting to the PI or if you can use them for communicating to other micro's or a mix?

    Does anyone know if these can be used for general serial coms or are they purely for SSH etc? This is my first project with a PI and its been a bit of steep curve! I am ok with most other micro's but this has kind of stumped me
     
  2. nsaspook

    AAC Fanatic!

    Aug 27, 2009
    2,908
    2,169
    Normally the serial port is used by Linux as a terminal port but it's easy to disable that function for serial communications with a device using your own program.

    Raspbian:
    https://www.raspberrypi.org/documentation/configuration/raspi-config.md

    http://elinux.org/RPi_Serial_Connection
     
  3. hexreader

    Active Member

    Apr 16, 2011
    250
    82
    If you are using latest Raspian GUI, then go through menus:

    menu - preferences - raspberry pi configuration - interfaces

    Select serial disabled, then reboot.

    Note that serial port name for current NOOBS distribution is /dev/ttyAMA0

    I struggled with similar problems, and many instructions on internet seem to be out of date.

    You may need system privileges to use serial port - so you might need to use "sudo" in your command when running your program

    Do you not sleep?
     
    Last edited: Jan 17, 2016
  4. Little Ghostman

    Thread Starter Member

    Jan 1, 2014
    294
    97
    Thanks alot guys, I see now why there is so much conflicting advice out there. I will have a go later and try it out, while it has plenty of I/O it seems most are happy to simple put a 'hat' on and leave it to software thats already out there.

    Not sleeping much at the moment as its pre lim exams! Some of my projects are.......ambitious so I have had to put the hours in!! I dont sit the real exam until later in the year, but I need a good score in the pre lims.
     
  5. nsaspook

    AAC Fanatic!

    Aug 27, 2009
    2,908
    2,169
    Most systems are switching to Device-Tree instead of static kernel compiles for GPIO. Many of the pre DT instructions no longer work.
     
  6. Little Ghostman

    Thread Starter Member

    Jan 1, 2014
    294
    97
    So far all the PI code is in python, I am more used to C on micro's, I might look into changing the code to C for the actual exam later in the year. I have nothing against python but its been a bit of a curve!
     
Loading...