Example io demo UPDATE 2019

From wiki.emacinc.com
Revision as of 12:03, 3 July 2019 by CBost (talk | contribs)
Jump to: navigation, search
TODO: {{#todo:SEOKWREV (01.03.14-16:47->JG+);(01.03.14-17:35->MD+);(04.07.14-09:45->BS+);(04.09.14-16:15->BS+)|Jgreene|oe 4,oe 5,jg,md,SEOKWREV,ky,bs}}

This demo covers basic GPIO usage for the IPAC single board computer, and 150 and 200 series carrier boards. This demo first cover GPIO manipulation through the Linux terminal and then demonstrates gpio usage in a C program using an io example program.

Hardware Requirements

To use the io demo program you will need the following target hardware.

  • An EMAC 150 series carrier board with a compatible SoM

OR

  • An EMAC 200 series carrier board with a compatible SoM

OR

  • an IPAC

AND

  • additional components to establish to serial and Ethernet connections for your target hardware

Software Requirments

These tools should already be installed if you installed the EMAC SDK using the automatic installer.

Setup

If you haven't already, please review the EMAC_OE_SDK "getting started" page. EMAC_OE_SDK will need to be installed and serial and network connections will need to be established between the developer machine and the target device.See the Serial Connections or Network Connections page for more information on how to connect to the target EMAC product using a serial port or Ethernet connection.

GPIO manipulation through Linux Terminal

GPIOs can be manipulated directly through the target devices serial terminal.

GPIO manipulation in C

A more common manipulation of GPIOs is through a C program. The following example will demonstrated GPIO manipulation using the Libgpiod libary.

On the target device:

  1. Login

  2. Change the file to read write if required

<cl> 1. Open qt Creator

  • Create a new project
  • select '+ New Project' on the 'Welcome' window, the New Project window will appear.
  • Under Projects select Non-Qt Project, Under the middle window select Plain C Application, Click 'Choose...', The Location window will appear.
  • Give your project a name, and choose a Create-in location, Click Next > to advance to the Build System window.
  • On the Build System Window choose either the qmake or cmake option (both will be covered in this tutorial), Click Next > to advance to the Kits window.
  • On the Kits window check only ARM Qt5, Click Next > to advance to the Summary window
  • The options on the Summary window will default to <None>, Click Finish. Your Project will now be generated.
  • Depending on whether you selected the qmake or cmake option the build files (project_name.pro and CMakeLists.txt respectively) will need to be configured.
  • For the qmake option copy and paste the following into your .pro file.
  • For the cmake option copy and paste the following into your CMakeLists.txt file.