Workshop GPIO I2C SPI Panic1 woensdag 10 april 2019.

Slides:



Advertisements
Similar presentations
Presentation Heading – font Arial
Advertisements

5-9/12/2005 CPE How to format your computer and re-install Windows XP.
Introduction to the Raspberry Pi ® Saman Amighi 10/2013 ® Raspberry Pi Foundation.
How to install the Zelle graphics package
Embedded Programming and Robotics Lesson 12 Introducing the Raspberry Pi Intro to Raspberry Pi1.
Installing Ricoh Driver. Items you need to know IP address of Printer Options that are installed And Paper Sizes To get all this information you can print.
Programming Lab III Assignments
Part 1 Using the ARM board And start working with C Tutorial 5 and 6
Introduction to The Linaro Toolchain Embedded Processors Training Multicore Software Applications Literature Number: SPRPXXX 1.
1 Introduction to Tool chains. 2 Tool chain for the Sitara Family (but it is true for other ARM based devices as well) A tool chain is a collection of.
One to One instructions Installing and configuring samba on Ubuntu Linux to enable Linux to share files and documents with Windows XP.
Back to content Final Presentation Mr. Phay Sok Thea, class “2B”, group 3, Networking Topic: Mail Client “Outlook Express” *At the end of the presentation.
Guide to Linux Installation and Administration, 2e1 Chapter 3 Installing Linux.
Move Pictures From Your Mobile Phone to Your PC.  You never know when a photo opportunity is going to arise, which is why having a camera phone can be.
Guideline: How to build AMSS source code? History: 01/02/ Make Draft 05/02/2010 – Release /02/2010 – Updated.
Linux in a Virtual Environment Nagarajan Prabakar School of Computing and Information Sciences Florida International University.
From Scratch: Open CCS Exit and restart CCS Click Browse to create a new workspace directory.
GumTree Development Environment Setup Windows Only Compatible with Eclipse 3.2 M3 (Last update: 16/11/05)
C programming and compilers. At least 3 ways to compile C Using gcc in UNIX environment via chaos.cs.auckland.ac.nz Using gcc in Cygwin in Windows Using.
VMWare Workstation Installation. Starting Vmware Workstation Go to the start menu and start the VMware Workstation program. *Note: The following instructions.
Surya Bahadur Kathayat Outline  Ramses  Installing Ramses  Ramses Perspective (Views and Editors)  Importing/Exporting Example.
VirtualBox: How to create a Linux Virtual Machine.
Intro to Raspberry Pi A Southwest Florida Hackerspace Workshop Presented by: Russell Benzing & Eric Schiffli.
Time to apply stuff… Faculty of Mathematics and Physics Charles University in Prague 5 th October 2015 Workshop 1 – Java Wrestling.
Implementation of Embedded OS
Lab 5 Department of Computer Science and Information Engineering National Taiwan University Lab5 - OS Kernel 2014/10/21/ 16 1.
PROGRAMMING USING PYTHON LANGUAGE ASSIGNMENT 1. INSTALLATION OF RASPBERRY NOOB First prepare the SD card provided in the kit by loading an Operating System.
Raspberry PI 2 Installation & Demo App By Wayne Keadle.
Installing git In Linux: sudo apt-get install git In Windows: download it from run the setuphttp://git-scm.com/download/win.
Using Linux Kaya Oğuz Room: 310.
Holland Computing Center STAT802 Create and access Anvil Windows 10 SAS instance 01/23/2017.
Operating System Kernel Compilation
Workshop on Raspberry Pi 3
Computer System Laboratory
Computer System Laboratory
RASPBERRY PI WORKSHOP.
Development Environment Setup
Implementation of Embedded OS
IoT 101 with Raspberry Pi and Azure
Guide to Linux Installation and Administration, 2e
Computer System Laboratory
Chapter A - The Raspberry Pi Computer
NTP, Syslog & Secure Shell
Implementation of Embedded OS
The Raspberry Pi Initiative
Java on the LEGO Mindstorms EV3
A microcontroller Raspberry Pi 2 Model B V1.1 RPi
Implementation of Embedded OS
Lecture 6 Uli Raich UCC semester 2017/2018
Computer System Laboratory
PRU-ICSS Programming with CCS
Implementation of Embedded OS
INSTRUCTIONS FOR UPDATING THE MAPPING OF THE NAVIGATION SYSTEM
Engineering Innovation Center
CMPE 152: Compiler Design ANTLR 4 and C++
Operating System Kernel Compilation
slides borrowed and adapted from Alex Mariakis and CSE 390a
Macrosystems EDDIE: Getting Started + Troubleshooting Tips
Using Visual Studio and VS Code for Embedded C/C++ Development
Building an Internet of Things Device
Macrosystems EDDIE: Getting Started + Troubleshooting Tips
Software Setup & Validation
Implementation of Embedded OS
Computer System Laboratory
Computer System Laboratory
Beginning Raspberry Pi
Macrosystems EDDIE: Getting Started + Troubleshooting Tips
Operating System Kernel Compilation
Macrosystems EDDIE: Getting Started + Troubleshooting Tips
Presentation transcript:

Workshop GPIO I2C SPI Panic1 woensdag 10 april 2019

Installing the Raspberry Pi NOOBS NOOBS is an installer that packs a number of RPi ready images, easy to use, but you need an SD card of at least 8Gb to have enough room left for Raspbian Raspbian Debian image for Raspbery Pi © Sioux Embedded Systems 2011 | Confidential |

Installing NOOBS Format the SD card into one FAT32 partition Extract the files in the tar ball onto the SD card Pop the SD card into the RPi and turn it on Select the image to install and you are ready Also easy to reinstall an image after it has been messed up, by pressing Shift during startup of the RPi and redo the installation © Sioux Embedded Systems 2011 | Confidential |

Installing Raspbian Format the SD card into one FAT32 partition Use an image writing tool to write the downloaded image to the SD card Plug the SD card into the RPi and start it up © Sioux Embedded Systems 2011 | Confidential |

Documentation on RPi http://www.raspberrypi.org/documentation/ http://elinux.org/RPi_Low-level_peripherals © Sioux Embedded Systems 2011 | Confidential |

GPIO via command line > sudo su > echo "22" > /sys/class/gpio/export > echo "out" > /sys/class/gpio/gpio22/direction > echo "1" > /sys/class/gpio/gpio22/value > echo "0" > /sys/class/gpio/gpio22/value > while true; \ > do echo "1" > /sys/class/gpio/gpio22/value; \ > echo "0" > /sys/class/gpio/gpio22/value; \ > done > echo "22" > /sys/class/gpio/unexport Source: http://www.instructables.com/id/Control-Stuff-with-your-Raspberry-Pi-GPIO/ © Sioux Embedded Systems 2011 | Confidential |

GPIO in a C program Download and unpack the cross compiler (https://github.com/raspberrypi/tools) Download and unpack Eclipse (www.eclipse.org) Create new C Project Executable, Empty Project, Cross GCC Cross compiler prefix: “arm-bcm2708hardfp-linux-gnueabi-” Path to cross compiler: ~/workshop\ rasberry\ pi/cross-compiler/tools-master/arm-bcm2708/arm-bcm2708hardfp-linux-gnueabi/bin New source file, copy-paste from http://elinux.org/RPi_Low-level_peripherals Ctrl-B to Build the project © Sioux Embedded Systems 2011 | Confidential |

About the GPIO program This piece of C code doesn’t use a library, instead it mmaps the device memory, and manipulates the GPIO registers directly Must be run as root, to activate the root account on Raspbian: sudo passwd Don’t change the ssh config, make sure the root account stays permitted to login via ssh, we will need this in the later steps when running applications from Eclipse on the RPi target machines © Sioux Embedded Systems 2011 | Confidential |

Running the GPIO program Selec the menu Run Run configurations C/C++ Remote Applications Create a new connection to your RPi board Don’t forget to generate a ssh key and install it on the RPi Go to menu Window, Preferences, General, Network Connections, SSH2 If all is well, you can now instruct Eclipse to copy and run the cross compiled program on the target machine © Sioux Embedded Systems 2011 | Confidential |

GPIO via CLI, two threads running concurrently on different GPIO pins © Sioux Embedded Systems 2011 | Confidential |

I2C background Source: http://www.robot-electronics.co.uk/acatalog/I2C_Tutorial.html © Sioux Embedded Systems 2011 | Confidential |

I2C by using bcm2835 library Download to the RPi: http://www.airspayce.com/mikem/bcm2835/bcm2835-1.36.tar.gz Untar the file, and cd into the folder ./configure sudo make check sudo make install Getting these files into your cross compiler Copy bcm2835-1.36/src/bcm2835.o and libbcm2835.a from RPi to ~/workshop\ rasberry\ pi/cross-compiler/tools-master/arm-bcm2708/arm-bcm2708hardfp-linux-gnueabi/arm-bcm2708hardfp-linux-gnueabi/sysroot/lib You will also need the header file (untar the same tar ball somewhere on your machine locally) © Sioux Embedded Systems 2011 | Confidential |

I2C example from bcm2835 lib We’ll be using the examples provided in the bcm2835 library package Create a new Eclipse project, same cross compiler settings as before To be able to use the lib in Eclipse, right click on Project, select Properties, C/C++ General, Paths and Symbols, Libraries tab, add "bcm2835", and in the Includes Tab, add the path to the bcm2835.h file Copy the i2c.c file into the project, build the project, and run the application like before on the RPi This time the application won’t work without arguments, try: ./I2cWorkshop -s85 -dw -ib 1 0x01 What are looking at on the scope? Either use the hold function, or put the program in a while(1) loop to see the signal. Don’t forget to run the application with option –ie to restore the I2C lines back to GPIO at the end © Sioux Embedded Systems 2011 | Confidential |

I2C: Trying to write to address 0x55, but no response © Sioux Embedded Systems 2011 | Confidential |

SPI background Typical use: Typical use with three slave devices: Daisy chained with three slave devices: Source: http://en.wikipedia.org/wiki/Serial_Peripheral_Interface_Bus © Sioux Embedded Systems 2011 | Confidential |

SPI via bcm2835 library Use the example spi.c file from the bcm2835 library package Same as before, create a new cross gcc project in Eclipse, add the library to the project options, copy the file into the project Connect the MOSI and the SCLK signals to the scope. The CE0 signal is also interesting © Sioux Embedded Systems 2011 | Confidential |

PWM via the bcm2835 library Use the example pwm.c file from the library package Same as before Connect pin 12 (GPIO18) to the scope for the PWM signal © Sioux Embedded Systems 2011 | Confidential |

Thank you! © Sioux Embedded Systems 2011 | Confidential |