SlideShare une entreprise Scribd logo
1  sur  66
RaspberryPi
michal6103@gmail.com
Q&A
• Did anyone used microcontrollers or SoCs
• Atmel
• PIC
• Z80, …
• Any experiences with embedded systems or devboards?
• Arduino style…
• Raspberry/Orange/Banana Pi, Humming board, Beaglebone,Odroid
• Who plans to build a media center?
• Who has kids?
Raspberry Pi Foundation
Why Raspberry Pi and the Foundation
• Inspired by ZX Spectrum
• Cheap computer for every child
• Educational reasons – kids do not know how to code
• People happen to be consumers, RPF wants to inspire makers
• Accidental price
• 2006 model build on Atmel ATmega644
• Broadcom employees changed stuff
• Language of choice Python, later Scratch
• Many other languages and tools
Hardware
Geek’s guide
rPi Atmel edition
Models
Raspberry Pi Model B+
• Announced on 14th July 2014
• Broadcom BCM2835 SoC, with ARM1176JZF-S 700 MHz
processor
• VideoCore IV dual-core 250 MHz GPU
• 512 MB SDRAM - shared by the GPU and CPU
• MicroSD card slot for boot and storage
• 4 x USB 2.0 ports (via on-board 5 port hub)
• RJ45 10/100 MBit/s Ethernet port
• HDMI and Composite video, audio through TRRS jack
• 40 pin GPIO, I2C, SPI, UART interface connector
• CSI (camera) and DSI (display) connectors
• 4 squarely positioned mounting holes
• 600 mA (3.0 W)
Raspberry Pi 2 Model B
• Announced on 2nd Feb 2015
• Broadcom BCM2836 SoC, with quad-core ARM Cortex-A7 900 MHz processor
• Ubuntu Core
• Windows 10 IOT Core
• VideoCore IV dual-core 250 MHz GPU
• 1 GB SDRAM - shared by the GPU and CPU
• MicroSD card slot for boot and storage
• 4 x USB 2.0 ports (via on-board 5 port hub)
• RJ45 10/100 MBit/s Ethernet port
• HDMI and Composite video, audio through TRRS jack
• 40 pin GPIO Interface connector
• CSI (camera) and DSI (display) connectors
• 4 squarely positioned mounting holes
Power – chief culprit
• Micro USB 5V, 1A
• Poly-fuse is problem of the past
• 5.25V is OK for USB
• http://www.modmypi.com/raspberry-pi/accessories/power-supplies/5v-2a-
ultra-hq-usb-power-supply-eu
• USB Power
• max_usb_current=1
• USB output current limit from 600mA to double that, 1200mA
Micro SD Card
• SD, SDHC, SDXC, UHC, all of them except the ones that do not work.
• Boot partition FAT32
• Max. around 20MB/s
• http://elinux.org/RPi_SD_cards
OS
B+ is ARMv6 a.k.a ARM11
• General purpose
• NOOBS - installer
• Raspbian
• Ubuntu Mate, Ubuntu Core (rPi2 only)
• Pidora, Arch and other unofficial
• Mediacenter
• OSMC
• Openelec
• Xbian
• Other obscure OSes
• Windows 10 IOT Core (rPi2 only)
• RISC OS
How to install
• FAT32, just extract it there
• Disk image – just dd it there
• Most distros have Win/Mac/Lin installers
Micro SD - Partitions
• diskpart
• list disk
• select diskn
• list partition
• select partitionn
• delete partition
Notifications and monitoring
• Red square: over-temperature
• Rainbow square: under-voltage
• /sys/class/thermal/thermal_zone0/temp
• /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
• Core temp below 70 degrees
• Voltage above 4.8V, across test pads PP3 (GND) and PP7 (VCC) or PP1( VCC before polyfuse)
• Brown-out detector will at VCC <= 4.65V switch off the power LED
• Watchdog – config.txt
• sudo apt-get install watchdog
• sudo update-rc.d watchdog defaults
• sudo vim /etc/watchdog.conf
Hardware
Hacker’s guide
What is really in BCM2835 SoC?
• ARM1176JZF-S 700 MHz processor – secondary processor
• Dualcore Videocore IV CPU @250MHz with SIMD Parallel Pixel Units
(PPU) which runs scalar (integer and float) and vector (integer only)
programs – primary processor
• Image Sensor Pipeline (ISP) providing lens shading, statistics and
distortion correction
• 12 QPU units which provide 24 GFLOPS compute performance for
coordinate, vertex and pixel shaders
Broadcom VideoCore IV @ 250 MHz
• OpenGL ES 2.0 - OpenGL is a 3D library
• OpenVG - OpenVG is a 2D vector drawing library
• EGL - EGL is an interface between OpenGL ES or OpenVG and the
underlying native platform window system.
• OpenMAX IL - OpenMAX API’s used for audio, video, and still images
processing
• Inside Videcore - https://www.raspberrypi.org/magpi-
issues/MagPi35.pdf page 35
VA API, CUDA and others like OpenCL
• OpenMAX
• QPU Assembly
Broadcom VideoCore IV @ 250 MHz
• MPEG-2 (license)
• VC-1 (license)
• 1080p30 H.264/MPEG-4 AVC high-profile decoder and encoder
• How to encode
https://www.raspberrypi.org/forums/viewtopic.php?t=72435
Dude I just want to build media center…
… more nerdy stuff at the end
Mediacenter
Distros
• No raspi-config here
What can it play
• Bundled acceleration
• H.264 (up to High Profile) up to 1080P
• MPEG-4 up to 1080P. This includes XviD and DivX (but not the older 3.xx DivX).
• Licenses: http://www.raspberrypi.com/license-keys/
• MPEG-2
• VC1
• GPU assisted:
• MJPEG, VP6, VP8 and OGG Theora. Limited to DVD resolutions.
• No acceleration:
• DivX 3, msmpeg, sorenson spark on the ARM. Should work for SD resolutions.
• DTS audio decode works well in recent builds
• TrueHD audio is CPU intensive and may require overclocking
Tuners
• H.264 encode/decode [DVB-S2]
• Licenses:
• MPEG2 decode [DVB-T, DVB-S]
• VC-1
• Tuners:
http://elinux.org/RPi_VerifiedPeripherals#USB_TV_Tuners_and_DVB_
devices
Audio
• Outputs:
• HDMI
• Analog
• I2S {HATs}
• USB soundcards
• MP3 soft decoding stereo
• AC3 , DTS, PCM pass-through
• Multichannel PCM not supported by all receivers – select 2.0 output
IR Remote
• Xbian mappings = Pain
• Kodi
• remote.xml
• Lircmap.xml
• lircd.conf
• USB IR stuff
• LIRC DT overlay – config.txt
• LIRC daemon
• HDMI-CEC
• CEC enabled HDMI cable – pin13
GPIO
GPIO
GPIO Permissions
• MMAP – root access
• SYSFS
• pigpio
• gpio-admin
GPIO performance
Language Library Tested / version Square wave
Shell /proc/mem access 2015-02-14 2.8 kHz
Shell / gpio utility WiringPi gpio utility 2015-02-15 / 2.25 40 Hz
Python RPi.GPIO 2015-02-15 / 0.5.10 70 kHz
Python wiringpi2 bindings 2015-02-15 / latest github 28 kHz
Ruby wiringpi bindings 2015-02-15 / latest gem (1.1.0) 21 kHz
C Native library 2015-02-15 / latest RaspPi 22 MHz
C BCM 2835 2015-02-15 / 1.38 5.4 MHz
C wiringPi 2015-02-15 / 2.25 4.1 – 4.6 MHz
Perl BCM 2835 2015-02-15 / 1.9 48 kHz
http://codeandlife.com/2012/07/03/benchmarking-raspberry-pi-gpio-speed/
Python GPIO
• import RPi.GPIO as GPIO
• Default and will be always supported
• MMAP - Script must be root or write access to /dev/mem
• Kind of abandoned, SPI, PWM missing
• from gpiozero import …
• New and cool
• Focused on beginners
• Examples with wiring diagrams
• import wiringpi2
• Wiringpi wrapper
• Stable, most complete
• import pigpio
• Daemon, no-root for users
• PWM, I2C, SPI, UART, waveforms,
How to access it?
• http://elinux.org/RPi_GPIO_Code_Samples
GPIO - Blink
• Interactive pinout diagram http://pinout.xyz/
• GPIO zero
from gpiozero import LED
from time import sleep
led = LED(17)
while True:
led.on()
sleep(1)
led.off()
sleep(1)
I am hacker, I hack!!!!
Custom GPIO pin setup
• pins_rev1 Rev1 pin setup. There are some difference because of the moved I2C pins
• pins_rev2 Rev2 pin setup. This includes the additional codec pins on P5
• pins_bplus1 Model B+ rev 1.1, including the full 40pin connector
• pins_bplus2 Model B+ rev 1.2, swapping the low-power and lan-run pins
• pins_aplus Model A+, lacking ethernet
• pins_2b1 Pi 2 Model B rev 1.0, controls the SMPS via I2C0
• pins_2b2 Pi 2 Model B rev 1.1, controls the SMPS via software I2C on 42&43
• pins_cm The Compute Module, note the default for this is the default for the chip so can
be a useful source of information about default pullups / downs on the chip.
• https://www.raspberrypi.org/documentation/configuration/pin-configuration.md
Camera
• RAW - Bayer pattern
• Image Sensor Pipeline
• 5Mpx
• fixed-focus
• 1080p30
• 720p60
• VGAp90 – slowmo
Camera
• Standard and NoIR
• 250mA
• HW acceleration
• JPEG
• H.264
• V4L2 API
• raspistill
• raspivid
• Python
• OpenCV
• Timelapse, slowmo
• Motion detection
MMAL - Multi-Media Abstraction Layer
• Accelerated:
• Encoding
• Filters - Blur, Sobel, YUV ….
• Multiplexing
• http://www.jvcref.com/files/PI/documentation/html/
• http://blog.oklahome.net/2014/09/what-ive-learned-about-mmal-
raspberry.html
Camera and Python
• Python:
• https://github.com/waveform80/picamera/tree/release-1.8
• PIL, OpenCV objects
• Stream – network, circular, H.264
• Overlaying
• Examples included: http://picamera.readthedocs.org/en/release-
1.10/
Simple stream from camera
• sudo modprobe bcm2835-v4l2
• cvlc v4l2:///dev/video0 --v4l2-width 1920 --v4l2-height 1080 --v4l2-
chroma h264 --sout '#standard{access=http,mux=ts,dst=0.0.0.0:12345}'
:demux=264
Babymonitor
Display
• https://www.raspberrypi.org/blog/the-eagerly-awaited-raspberry-pi-
display/
• RGB 800×480 display @60fps
• 24-bit colour
• FT5406 10 point capacitive touchscreen
• 70 degree viewing angle
• Metal-backed display with mounting holes for the Pi
Display
Movies are watched and robot is built.
Now what?
• Baking Pi – ASM, bare metal
• https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/
• Low level graphics – C, framebuffer in Linux
• http://raspberrycompote.blogspot.ie/2012/12/low-level-graphics-on-
raspberry-pi-part_9509.html
• Bare metal examples – C, bare metal
• https://github.com/dwelch67/raspberrypi
• Programming AudioVideo on the Raspberry Pi GPU – C, linux
• https://jan.newmarch.name/RPi/index.html
Projects
• Baby monitor
• https://github.com/silvanmelchior/RPi_Cam_Web_Interface
• Vertical plotter WIP
• Video1: https://plus.google.com/u/0/+MichalSedlak/posts/ZjMeC3qguMV
• Video2: https://plus.google.com/photos/photo/116922401464380915458/6059538975170772338
• Plotter: https://github.com/michal6103/droopy
• Renderer: https://github.com/michal6103/droopy-web
• Ambient light WIP Raspberry for server side only, client NodeMCU
• PWM, APA102
• https://github.com/michal6103/striplight
• Hyperion – Opensourced Amblight – waiting for Xbian SPI module
• Video: https://www.youtube.com/watch?v=lnx_futkSQ8
• https://github.com/tvdzwan/hyperion/wiki
• Future:
• Fairy tails audio box, controlled by RFID card for kids
• OpenCV and Box2D voleyball
• Lemon power source
• Speed radar
https://www.raspberrypi.org/magpi-
issues/Projects_Book_v1.pdf
Hardware
Nerd’s guide – You know the licenses and how it works…
Broadcom VideoCore IV @ 250 MHz
• On 28 February 2014, release of full documentation for the VideoCore
IV's 3D subsystem ->
http://www.broadcom.com/docs/support/videocore/VideoCoreIV-
AG100-R.pdf
• Only a minor part of Broadcom’s software released as open source
• All acceleration is done using a firmware for VPU
• The entire SoC itself is managed / initialized by a ThreadX. RTOS that
is loaded into the Videocore's VPU during bootup
Wait what?
Videocore IV GPU
Wait what? Where is ThreadX, RTOS?
• BCM2835 – VPU is primary, CPU is “coprocessor”
• VPU is running ThreadX RTOS, then starts ARM and stuff
Yeah … I got it … What?
• The VideoCore is a custom processor, but is general-purpose enough
to run ThreadX
• The QPU units have been specially tailored to 3D tasks.
• The Videocore runs a RTOS
• RTOS API/ABI translates high-level 3D instructions (e.g. from OpenGL) into
commands for the QPU units
• The bootcode.bin acts as bootloader , start.elf contains the RTOS
• https://www.raspberrypi.org/forums/viewtopic.php?f=72&t=78414
Cool, what does it mean?
• You can write write software for bare hardware
• Any language you like for ARM, in case it is C or assembly
• Assembler and C toolchain for the VideoCore IV
• https://github.com/hermanhermitage/videocoreiv/
• https://github.com/hermanhermitage/videocoreiv/wiki/VideoCore-IV-Programmers-
Manual
• Assembler for QPUs
• https://github.com/hermanhermitage/videocoreiv-qpu
• http://petewarden.com/2014/08/07/how-to-optimize-raspberry-pi-code-using-its-gpu/
Down the rabbit hole
• https://github.com/hermanhermitage
So much flexibility in your solution feels like
How does it boot?
• First stage bootloader in ROM, ran by RISC core on VPU
• Mount FAT32 on SD Card
• VPU loads second-stage bootloader from the SD Card - bootcode.bin
• Second-stage bootloader bootcode.bin
• loaded into the L2 cache as we do not have RAM yet
• inits the RAM and the PLLs
• Parse config.txt for memory split
• third-stage bootloader loaded from SD Card - start.elf {RTOS binary}
• RTOS is launched
• Splits RAM – GPU/ARM {fixup.dat}
• Loads config.txt from SD card
• Loads cmdline.txt
• Loading kernel.img
• Powering on the ARM core {reset 0}
• Hurray Linux
• https://thekandyancode.wordpress.com/2013/09/21/how-the-raspberry-pi-boots-up/
Overclock
• raspi-config
• Multiple settings in config.txt
• Turbo mode does not break warranty
• https://www.raspberrypi.org/blog/introducing-turbo-mode-up-to-50-
more-performance-for-free/
• SD card problems when overclocked – no after Nov 11 2013
Config.txt is new BIOS settings
https://www.raspberrypi.org/documentation/configuration/config-
txt.md
Device trees are the PnP
• Just read this:
https://raw.githubusercontent.com/raspberrypi/firmware/master/boot/overlays/README
• Maybe this: https://www.raspberrypi.org/documentation/configuration/device-tree.md
• Info about devices
• Text file compiled to binary blob
• OS neutral
• Configuration parameters
• Forget about modprobe
• Overlays
• raspi-config for some devices
• Non-dt kernels - ATAGs
Device trees
• config.txt
• dtoverlay=lirc-rpi,gpio_out_pin=17
• spi - Set to "on" to enable the spi interfaces (off)
• random - Set to "on" to enable the hardware random number generator
(off)
• uart0 - Set to "off" to disable uart0 (on)
• watchdog - Set to "on" to enable the hardware watchdog (off)
• Other devices and HATs
• HATs identified by DTB stored in EEPROM
Q&A
Future session
• Baking Pi or one of projects
Thank you for your time
GPS modules
• http://elinux.org/RPi_VerifiedPeripherals#USB_GPS_devices
• SPI, I2C
• Text protocols

Contenu connexe

Tendances

Exploring Raspberry Pi
Exploring Raspberry PiExploring Raspberry Pi
Exploring Raspberry Pi
Lentin Joseph
 

Tendances (20)

Introduction to Raspberrypi
Introduction to  RaspberrypiIntroduction to  Raspberrypi
Introduction to Raspberrypi
 
Rasp berry Pi
Rasp berry PiRasp berry Pi
Rasp berry Pi
 
Raspberry pi : an introduction
Raspberry pi : an introductionRaspberry pi : an introduction
Raspberry pi : an introduction
 
Presentation on Raspberry pi
Presentation on Raspberry piPresentation on Raspberry pi
Presentation on Raspberry pi
 
Simple Presentation On Raspberry pi
Simple Presentation On Raspberry piSimple Presentation On Raspberry pi
Simple Presentation On Raspberry pi
 
Raspberry PI
Raspberry PIRaspberry PI
Raspberry PI
 
Raspberry Pi Presentation
Raspberry Pi PresentationRaspberry Pi Presentation
Raspberry Pi Presentation
 
Raspberry-Pi
Raspberry-PiRaspberry-Pi
Raspberry-Pi
 
Presentation on Raspberry Pi by Sazzad H. IIUC
Presentation on Raspberry Pi by Sazzad H. IIUCPresentation on Raspberry Pi by Sazzad H. IIUC
Presentation on Raspberry Pi by Sazzad H. IIUC
 
Raspberry pi
Raspberry piRaspberry pi
Raspberry pi
 
Raspberry Pi Session - 22_11_2014
Raspberry Pi Session - 22_11_2014Raspberry Pi Session - 22_11_2014
Raspberry Pi Session - 22_11_2014
 
Raspberry pi
Raspberry piRaspberry pi
Raspberry pi
 
Raspberry pi ppt
Raspberry pi pptRaspberry pi ppt
Raspberry pi ppt
 
Raspberry Pi
Raspberry PiRaspberry Pi
Raspberry Pi
 
Introduction to raspberry pi
Introduction to raspberry piIntroduction to raspberry pi
Introduction to raspberry pi
 
Abstract of raspberry pi
Abstract of raspberry piAbstract of raspberry pi
Abstract of raspberry pi
 
Rasberry pi
 Rasberry pi Rasberry pi
Rasberry pi
 
Exploring Raspberry Pi
Exploring Raspberry PiExploring Raspberry Pi
Exploring Raspberry Pi
 
Raspberry pi
Raspberry piRaspberry pi
Raspberry pi
 
Raspberry Pi (Introduction)
Raspberry Pi (Introduction)Raspberry Pi (Introduction)
Raspberry Pi (Introduction)
 

Similaire à Raspberry Pi Introduction

Raspberry pi robotics
Raspberry pi roboticsRaspberry pi robotics
Raspberry pi robotics
LloydMoore
 

Similaire à Raspberry Pi Introduction (20)

Parallel Rendering of Webpages
Parallel Rendering of WebpagesParallel Rendering of Webpages
Parallel Rendering of Webpages
 
Raspberry pi
Raspberry piRaspberry pi
Raspberry pi
 
WOver
WOverWOver
WOver
 
HiPEAC-Keynote.pptx
HiPEAC-Keynote.pptxHiPEAC-Keynote.pptx
HiPEAC-Keynote.pptx
 
2_RaspberryPi presentation.pptx
2_RaspberryPi presentation.pptx2_RaspberryPi presentation.pptx
2_RaspberryPi presentation.pptx
 
Raspberry pi robotics
Raspberry pi roboticsRaspberry pi robotics
Raspberry pi robotics
 
INTRODUCTION TO RASPI
INTRODUCTION TO RASPIINTRODUCTION TO RASPI
INTRODUCTION TO RASPI
 
Raspberry pi basics
Raspberry pi  basicsRaspberry pi  basics
Raspberry pi basics
 
Raspberry Pi Gaming Rig
Raspberry Pi Gaming RigRaspberry Pi Gaming Rig
Raspberry Pi Gaming Rig
 
Costruiamo un Rover in 60 minuti
Costruiamo un Rover in 60 minutiCostruiamo un Rover in 60 minuti
Costruiamo un Rover in 60 minuti
 
OpenPOWER Summit 2020 - OpenCAPI Keynote
OpenPOWER Summit 2020 -  OpenCAPI KeynoteOpenPOWER Summit 2020 -  OpenCAPI Keynote
OpenPOWER Summit 2020 - OpenCAPI Keynote
 
My presentation raspberry pi
My presentation raspberry piMy presentation raspberry pi
My presentation raspberry pi
 
Up and running with Raspberry Pi
Up and running with Raspberry PiUp and running with Raspberry Pi
Up and running with Raspberry Pi
 
Introduction to Raspberry PI
Introduction to Raspberry PIIntroduction to Raspberry PI
Introduction to Raspberry PI
 
Maker printouts
Maker printoutsMaker printouts
Maker printouts
 
Codasip application class RISC-V processor solutions
Codasip application class RISC-V processor solutionsCodasip application class RISC-V processor solutions
Codasip application class RISC-V processor solutions
 
Abc beagleboard Getting To Know It
Abc beagleboard Getting To Know ItAbc beagleboard Getting To Know It
Abc beagleboard Getting To Know It
 
QEMU and Raspberry Pi. Instant Embedded Development
QEMU and Raspberry Pi. Instant Embedded DevelopmentQEMU and Raspberry Pi. Instant Embedded Development
QEMU and Raspberry Pi. Instant Embedded Development
 
4667031.ppt
4667031.ppt4667031.ppt
4667031.ppt
 
Raspberry Pi Technology
Raspberry Pi Technology Raspberry Pi Technology
Raspberry Pi Technology
 

Plus de Michal Sedlak (9)

Nodemcu - introduction
Nodemcu - introductionNodemcu - introduction
Nodemcu - introduction
 
Multipath
MultipathMultipath
Multipath
 
Linux: Desktop na kazdy den
Linux: Desktop na kazdy denLinux: Desktop na kazdy den
Linux: Desktop na kazdy den
 
Linux: Presmerovanie I/O
Linux:  Presmerovanie I/OLinux:  Presmerovanie I/O
Linux: Presmerovanie I/O
 
Linux: Procesy
Linux: ProcesyLinux: Procesy
Linux: Procesy
 
Linux: Filesystems
Linux: FilesystemsLinux: Filesystems
Linux: Filesystems
 
Linux: Zaklady Linuxu
Linux: Zaklady LinuxuLinux: Zaklady Linuxu
Linux: Zaklady Linuxu
 
Linux: LVM
Linux: LVMLinux: LVM
Linux: LVM
 
Twisted
TwistedTwisted
Twisted
 

Dernier

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 

Dernier (20)

FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdf
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 

Raspberry Pi Introduction

  • 2. Q&A • Did anyone used microcontrollers or SoCs • Atmel • PIC • Z80, … • Any experiences with embedded systems or devboards? • Arduino style… • Raspberry/Orange/Banana Pi, Humming board, Beaglebone,Odroid • Who plans to build a media center? • Who has kids?
  • 4. Why Raspberry Pi and the Foundation • Inspired by ZX Spectrum • Cheap computer for every child • Educational reasons – kids do not know how to code • People happen to be consumers, RPF wants to inspire makers • Accidental price • 2006 model build on Atmel ATmega644 • Broadcom employees changed stuff • Language of choice Python, later Scratch • Many other languages and tools
  • 8.
  • 9. Raspberry Pi Model B+ • Announced on 14th July 2014 • Broadcom BCM2835 SoC, with ARM1176JZF-S 700 MHz processor • VideoCore IV dual-core 250 MHz GPU • 512 MB SDRAM - shared by the GPU and CPU • MicroSD card slot for boot and storage • 4 x USB 2.0 ports (via on-board 5 port hub) • RJ45 10/100 MBit/s Ethernet port • HDMI and Composite video, audio through TRRS jack • 40 pin GPIO, I2C, SPI, UART interface connector • CSI (camera) and DSI (display) connectors • 4 squarely positioned mounting holes • 600 mA (3.0 W)
  • 10. Raspberry Pi 2 Model B • Announced on 2nd Feb 2015 • Broadcom BCM2836 SoC, with quad-core ARM Cortex-A7 900 MHz processor • Ubuntu Core • Windows 10 IOT Core • VideoCore IV dual-core 250 MHz GPU • 1 GB SDRAM - shared by the GPU and CPU • MicroSD card slot for boot and storage • 4 x USB 2.0 ports (via on-board 5 port hub) • RJ45 10/100 MBit/s Ethernet port • HDMI and Composite video, audio through TRRS jack • 40 pin GPIO Interface connector • CSI (camera) and DSI (display) connectors • 4 squarely positioned mounting holes
  • 11. Power – chief culprit • Micro USB 5V, 1A • Poly-fuse is problem of the past • 5.25V is OK for USB • http://www.modmypi.com/raspberry-pi/accessories/power-supplies/5v-2a- ultra-hq-usb-power-supply-eu • USB Power • max_usb_current=1 • USB output current limit from 600mA to double that, 1200mA
  • 12. Micro SD Card • SD, SDHC, SDXC, UHC, all of them except the ones that do not work. • Boot partition FAT32 • Max. around 20MB/s • http://elinux.org/RPi_SD_cards
  • 13. OS
  • 14. B+ is ARMv6 a.k.a ARM11 • General purpose • NOOBS - installer • Raspbian • Ubuntu Mate, Ubuntu Core (rPi2 only) • Pidora, Arch and other unofficial • Mediacenter • OSMC • Openelec • Xbian • Other obscure OSes • Windows 10 IOT Core (rPi2 only) • RISC OS
  • 15. How to install • FAT32, just extract it there • Disk image – just dd it there • Most distros have Win/Mac/Lin installers
  • 16. Micro SD - Partitions • diskpart • list disk • select diskn • list partition • select partitionn • delete partition
  • 17. Notifications and monitoring • Red square: over-temperature • Rainbow square: under-voltage • /sys/class/thermal/thermal_zone0/temp • /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq • Core temp below 70 degrees • Voltage above 4.8V, across test pads PP3 (GND) and PP7 (VCC) or PP1( VCC before polyfuse) • Brown-out detector will at VCC <= 4.65V switch off the power LED • Watchdog – config.txt • sudo apt-get install watchdog • sudo update-rc.d watchdog defaults • sudo vim /etc/watchdog.conf
  • 19. What is really in BCM2835 SoC? • ARM1176JZF-S 700 MHz processor – secondary processor • Dualcore Videocore IV CPU @250MHz with SIMD Parallel Pixel Units (PPU) which runs scalar (integer and float) and vector (integer only) programs – primary processor • Image Sensor Pipeline (ISP) providing lens shading, statistics and distortion correction • 12 QPU units which provide 24 GFLOPS compute performance for coordinate, vertex and pixel shaders
  • 20. Broadcom VideoCore IV @ 250 MHz • OpenGL ES 2.0 - OpenGL is a 3D library • OpenVG - OpenVG is a 2D vector drawing library • EGL - EGL is an interface between OpenGL ES or OpenVG and the underlying native platform window system. • OpenMAX IL - OpenMAX API’s used for audio, video, and still images processing • Inside Videcore - https://www.raspberrypi.org/magpi- issues/MagPi35.pdf page 35
  • 21. VA API, CUDA and others like OpenCL • OpenMAX • QPU Assembly
  • 22. Broadcom VideoCore IV @ 250 MHz • MPEG-2 (license) • VC-1 (license) • 1080p30 H.264/MPEG-4 AVC high-profile decoder and encoder • How to encode https://www.raspberrypi.org/forums/viewtopic.php?t=72435
  • 23. Dude I just want to build media center… … more nerdy stuff at the end
  • 26. What can it play • Bundled acceleration • H.264 (up to High Profile) up to 1080P • MPEG-4 up to 1080P. This includes XviD and DivX (but not the older 3.xx DivX). • Licenses: http://www.raspberrypi.com/license-keys/ • MPEG-2 • VC1 • GPU assisted: • MJPEG, VP6, VP8 and OGG Theora. Limited to DVD resolutions. • No acceleration: • DivX 3, msmpeg, sorenson spark on the ARM. Should work for SD resolutions. • DTS audio decode works well in recent builds • TrueHD audio is CPU intensive and may require overclocking
  • 27. Tuners • H.264 encode/decode [DVB-S2] • Licenses: • MPEG2 decode [DVB-T, DVB-S] • VC-1 • Tuners: http://elinux.org/RPi_VerifiedPeripherals#USB_TV_Tuners_and_DVB_ devices
  • 28. Audio • Outputs: • HDMI • Analog • I2S {HATs} • USB soundcards • MP3 soft decoding stereo • AC3 , DTS, PCM pass-through • Multichannel PCM not supported by all receivers – select 2.0 output
  • 29. IR Remote • Xbian mappings = Pain • Kodi • remote.xml • Lircmap.xml • lircd.conf • USB IR stuff • LIRC DT overlay – config.txt • LIRC daemon • HDMI-CEC • CEC enabled HDMI cable – pin13
  • 30. GPIO
  • 31. GPIO
  • 32. GPIO Permissions • MMAP – root access • SYSFS • pigpio • gpio-admin
  • 33. GPIO performance Language Library Tested / version Square wave Shell /proc/mem access 2015-02-14 2.8 kHz Shell / gpio utility WiringPi gpio utility 2015-02-15 / 2.25 40 Hz Python RPi.GPIO 2015-02-15 / 0.5.10 70 kHz Python wiringpi2 bindings 2015-02-15 / latest github 28 kHz Ruby wiringpi bindings 2015-02-15 / latest gem (1.1.0) 21 kHz C Native library 2015-02-15 / latest RaspPi 22 MHz C BCM 2835 2015-02-15 / 1.38 5.4 MHz C wiringPi 2015-02-15 / 2.25 4.1 – 4.6 MHz Perl BCM 2835 2015-02-15 / 1.9 48 kHz http://codeandlife.com/2012/07/03/benchmarking-raspberry-pi-gpio-speed/
  • 34. Python GPIO • import RPi.GPIO as GPIO • Default and will be always supported • MMAP - Script must be root or write access to /dev/mem • Kind of abandoned, SPI, PWM missing • from gpiozero import … • New and cool • Focused on beginners • Examples with wiring diagrams • import wiringpi2 • Wiringpi wrapper • Stable, most complete • import pigpio • Daemon, no-root for users • PWM, I2C, SPI, UART, waveforms,
  • 35. How to access it? • http://elinux.org/RPi_GPIO_Code_Samples
  • 36. GPIO - Blink • Interactive pinout diagram http://pinout.xyz/ • GPIO zero from gpiozero import LED from time import sleep led = LED(17) while True: led.on() sleep(1) led.off() sleep(1)
  • 37. I am hacker, I hack!!!!
  • 38. Custom GPIO pin setup • pins_rev1 Rev1 pin setup. There are some difference because of the moved I2C pins • pins_rev2 Rev2 pin setup. This includes the additional codec pins on P5 • pins_bplus1 Model B+ rev 1.1, including the full 40pin connector • pins_bplus2 Model B+ rev 1.2, swapping the low-power and lan-run pins • pins_aplus Model A+, lacking ethernet • pins_2b1 Pi 2 Model B rev 1.0, controls the SMPS via I2C0 • pins_2b2 Pi 2 Model B rev 1.1, controls the SMPS via software I2C on 42&43 • pins_cm The Compute Module, note the default for this is the default for the chip so can be a useful source of information about default pullups / downs on the chip. • https://www.raspberrypi.org/documentation/configuration/pin-configuration.md
  • 39. Camera • RAW - Bayer pattern • Image Sensor Pipeline • 5Mpx • fixed-focus • 1080p30 • 720p60 • VGAp90 – slowmo
  • 40. Camera • Standard and NoIR • 250mA • HW acceleration • JPEG • H.264 • V4L2 API • raspistill • raspivid • Python • OpenCV • Timelapse, slowmo • Motion detection
  • 41. MMAL - Multi-Media Abstraction Layer • Accelerated: • Encoding • Filters - Blur, Sobel, YUV …. • Multiplexing • http://www.jvcref.com/files/PI/documentation/html/ • http://blog.oklahome.net/2014/09/what-ive-learned-about-mmal- raspberry.html
  • 42. Camera and Python • Python: • https://github.com/waveform80/picamera/tree/release-1.8 • PIL, OpenCV objects • Stream – network, circular, H.264 • Overlaying • Examples included: http://picamera.readthedocs.org/en/release- 1.10/
  • 43. Simple stream from camera • sudo modprobe bcm2835-v4l2 • cvlc v4l2:///dev/video0 --v4l2-width 1920 --v4l2-height 1080 --v4l2- chroma h264 --sout '#standard{access=http,mux=ts,dst=0.0.0.0:12345}' :demux=264
  • 45. Display • https://www.raspberrypi.org/blog/the-eagerly-awaited-raspberry-pi- display/ • RGB 800×480 display @60fps • 24-bit colour • FT5406 10 point capacitive touchscreen • 70 degree viewing angle • Metal-backed display with mounting holes for the Pi
  • 47. Movies are watched and robot is built. Now what? • Baking Pi – ASM, bare metal • https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ • Low level graphics – C, framebuffer in Linux • http://raspberrycompote.blogspot.ie/2012/12/low-level-graphics-on- raspberry-pi-part_9509.html • Bare metal examples – C, bare metal • https://github.com/dwelch67/raspberrypi • Programming AudioVideo on the Raspberry Pi GPU – C, linux • https://jan.newmarch.name/RPi/index.html
  • 48. Projects • Baby monitor • https://github.com/silvanmelchior/RPi_Cam_Web_Interface • Vertical plotter WIP • Video1: https://plus.google.com/u/0/+MichalSedlak/posts/ZjMeC3qguMV • Video2: https://plus.google.com/photos/photo/116922401464380915458/6059538975170772338 • Plotter: https://github.com/michal6103/droopy • Renderer: https://github.com/michal6103/droopy-web • Ambient light WIP Raspberry for server side only, client NodeMCU • PWM, APA102 • https://github.com/michal6103/striplight • Hyperion – Opensourced Amblight – waiting for Xbian SPI module • Video: https://www.youtube.com/watch?v=lnx_futkSQ8 • https://github.com/tvdzwan/hyperion/wiki • Future: • Fairy tails audio box, controlled by RFID card for kids • OpenCV and Box2D voleyball • Lemon power source • Speed radar
  • 50. Hardware Nerd’s guide – You know the licenses and how it works…
  • 51. Broadcom VideoCore IV @ 250 MHz • On 28 February 2014, release of full documentation for the VideoCore IV's 3D subsystem -> http://www.broadcom.com/docs/support/videocore/VideoCoreIV- AG100-R.pdf • Only a minor part of Broadcom’s software released as open source • All acceleration is done using a firmware for VPU • The entire SoC itself is managed / initialized by a ThreadX. RTOS that is loaded into the Videocore's VPU during bootup
  • 53. Wait what? Where is ThreadX, RTOS? • BCM2835 – VPU is primary, CPU is “coprocessor” • VPU is running ThreadX RTOS, then starts ARM and stuff
  • 54. Yeah … I got it … What? • The VideoCore is a custom processor, but is general-purpose enough to run ThreadX • The QPU units have been specially tailored to 3D tasks. • The Videocore runs a RTOS • RTOS API/ABI translates high-level 3D instructions (e.g. from OpenGL) into commands for the QPU units • The bootcode.bin acts as bootloader , start.elf contains the RTOS • https://www.raspberrypi.org/forums/viewtopic.php?f=72&t=78414
  • 55. Cool, what does it mean? • You can write write software for bare hardware • Any language you like for ARM, in case it is C or assembly • Assembler and C toolchain for the VideoCore IV • https://github.com/hermanhermitage/videocoreiv/ • https://github.com/hermanhermitage/videocoreiv/wiki/VideoCore-IV-Programmers- Manual • Assembler for QPUs • https://github.com/hermanhermitage/videocoreiv-qpu • http://petewarden.com/2014/08/07/how-to-optimize-raspberry-pi-code-using-its-gpu/
  • 56. Down the rabbit hole • https://github.com/hermanhermitage
  • 57. So much flexibility in your solution feels like
  • 58. How does it boot? • First stage bootloader in ROM, ran by RISC core on VPU • Mount FAT32 on SD Card • VPU loads second-stage bootloader from the SD Card - bootcode.bin • Second-stage bootloader bootcode.bin • loaded into the L2 cache as we do not have RAM yet • inits the RAM and the PLLs • Parse config.txt for memory split • third-stage bootloader loaded from SD Card - start.elf {RTOS binary} • RTOS is launched • Splits RAM – GPU/ARM {fixup.dat} • Loads config.txt from SD card • Loads cmdline.txt • Loading kernel.img • Powering on the ARM core {reset 0} • Hurray Linux • https://thekandyancode.wordpress.com/2013/09/21/how-the-raspberry-pi-boots-up/
  • 59. Overclock • raspi-config • Multiple settings in config.txt • Turbo mode does not break warranty • https://www.raspberrypi.org/blog/introducing-turbo-mode-up-to-50- more-performance-for-free/ • SD card problems when overclocked – no after Nov 11 2013
  • 60. Config.txt is new BIOS settings https://www.raspberrypi.org/documentation/configuration/config- txt.md
  • 61. Device trees are the PnP • Just read this: https://raw.githubusercontent.com/raspberrypi/firmware/master/boot/overlays/README • Maybe this: https://www.raspberrypi.org/documentation/configuration/device-tree.md • Info about devices • Text file compiled to binary blob • OS neutral • Configuration parameters • Forget about modprobe • Overlays • raspi-config for some devices • Non-dt kernels - ATAGs
  • 62. Device trees • config.txt • dtoverlay=lirc-rpi,gpio_out_pin=17 • spi - Set to "on" to enable the spi interfaces (off) • random - Set to "on" to enable the hardware random number generator (off) • uart0 - Set to "off" to disable uart0 (on) • watchdog - Set to "on" to enable the hardware watchdog (off) • Other devices and HATs • HATs identified by DTB stored in EEPROM
  • 63. Q&A
  • 64. Future session • Baking Pi or one of projects
  • 65. Thank you for your time