RPPSOC

From blwiki
Jump to: navigation, search

Raspberry Pi Programmable System on a Chip (RPPSOC)

Tindie-mediums.png

KS-RPPSOC.PNG

Features

RPPSOC-P1010074-800px.jpg

RPPSOC-BLK-DIA.png

  • PSOC part CY8C5267AXI-LP051
    • Core: ARM Cortex M3
    • Data Bus Width: 32 bit
    • Maximum Clock Frequency: 67 MHz
    • Program Memory Size: 128 kB
    • Data RAM Size: 32 kB
    • ADC Resolution: 12 bit
    • Data RAM Type: SRAM
    • Interface Type: I2C, USB
    • Number of ADC Channels: 1
    • Number of I/Os: 72 I/O
    • Number of Timers/Counters: 4 Timer
    • Program Memory Type: Flash
  • Works on all Raspberry Pi cards with 40 pin GPIO (A+/B+/Pi2/Pi3/Zero)
  • All 29 Raspberry Pi I/O lines are connected to the PSOC
    • 3 of the lines are used for programming the PSSoC
  • Configuration EEPROM
  • Fuses on 3.3V and 5V power
  • Two I/O connectors
    • 14 + 16 = 30 I/O pins

Layout

RPPSOC-KICAD-PCB-X2-2.PNG

Connectors

H1 - PROG Connector

Note to Kickstarter Backers: The Kickstarter version of this card does not require a download cable.

  • Pin 1 is indicated by the H1 marking.
  1. GND
  2. RESET
  3. SWDCLK
  4. SWDIO

H2 - EEPROM Write Enable Jumper

  • Install jumper to enable writes to the EEPROM.
  • Remove jumper to disable writes to the EEPROM.

H3 - VDDIO3 Select Jumper

  • Power select for the P3 connector.
  • Install the jumper into either the 3.3V or 5V to the center pin
  • All of the I/O pins on the P3 connector are at this voltage

H4 - VDDIO0 Select Jumper

  • Power select for the P4 connector,
  • Install the jumper into either the 3.3V or 5V to the center pin
  • All of the I/O pins on the P4 connector are at this voltage

P3 - IO 3 Pins

  • 2X10 Connector, 0.1" pitch
  • PSOC Port numbers are marked on the board silkscreen

RPPSOC-P3-X2-rot.png

Descr Pin # Pin $ Descr
VDDIO3 1 2 VDDIO3
15.0 3 4 15.1
3.0 5 6 3.1
3.2 7 8 3.3
3.4 9 10 3.5
3.6 11 12 3.7
12.0 13 14 12.1
15.2 15 16 15.3
GND 17 18 GND
GND 19 20 GND

P4 - IO 0 Pins

  • 2X10 Connector, 0.1" pitch
  • PSOC Port numbers are marked on the board silkscreen

RPPSOC-P4-X2-rot.png

Descr Pin # Pin $ Descr
VDDIO3 1 2 VDDIO3
12.2 3 4 12.3
4.0 5 6 4.1
0.0 7 8 0.1
0.2 9 10 0.3
0.4 11 12 0.5
0.6 13 14 0.7
4.2 15 16 4.3
4.4 17 18 4.5
GND 19 20 GND

Raspberry Pi to PSOC connections

PSOC Pin RPI Function Python GPIO RPI Pin x RPI Pin RPI Function Python GPIO PSOC Pin
POWER +3.3V 1 2 +5V POWER
P12[5] = SDA (I2C0) GPIO2/SDA1 3 4 +5V POWER
P12[4] = SCL (I2C0) GPIO3/SCLK1 5 6 GND POWER
P5[5] GPIO4 7 8 GPIO14/TXD0 P12[7]
POWER GND 9 10 GPIO15/RXD0 P12[6]
P1[7] GPIO17 11 12 GPIO18 P1[6]
P1[5] GPIO27 13 14 GND POWER
SWD-RESET GPIO22 15 16 GPIO23 SWD-CLK
POWER +3.3V 17 18 GPIO24 SWD-DIO
P6[7] GPIO10/SPI_MOSI 19 20 GND POWER
P6[6] GPIO9/SPI_MISO 21 22 GPIO25 P5[0]
P6[5] GPIO11/SPI_SCLK 23 24 GPIO8/SPI_CE0 P6[4]
POWER GND 25 26 GPIO7/SPI_CE1 P5[7]
EEPROM ID_SDA 27 28 ID_SCL EEPROM
P5[6] GPIO5 29 30 GND POWER
P2[7] GPIO6 31 32 GPIO12 P2[6]
P2[5] GPIO13 33 34 GND POWER
P2[3] GPIO19 35 36 GPIO16 P2[4]
P2[1] GPIO26 37 38 GPIO20 P2[2]
POWER GND 39 40 GPIO21 P2[0]

Installing Programming Code

Steps are:

  • Install HexFileParser on your PC
  • Install WiringPi on your Pi
  • Install PSOC Programming code on your Pi

Install HexFileParser

  • Download HexFileParser from either

Install WiringPi Code

  • Log onto the Raspberry Pi
  • Using WiringPi to access GPIO
    • WiringPi is a C library for the Raspberry Pi which has a similar API the Arduino.
    • Download and setup wiringPi by running the following from your Pi:
git clone git://git.drogon.net/wiringPi
 
  • Do not use this one
git clone https://github.com/WiringPi/WiringPi.git << DO NOT DO THIS!!!
 +-----+-----+---------+------+---+---Pi 3---+---+------+---------+-----+-----+
 | BCM | wPi |   Name  | Mode | V | Physical | V | Mode | Name    | wPi | BCM |
 +-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
 |     |     |    3.3v |      |   |  1 || 2  |   |      | 5v      |     |     |
 |   2 |   8 |   SDA.1 |   IN | 1 |  3 || 4  |   |      | 5V      |     |     |
 |   3 |   9 |   SCL.1 |   IN | 1 |  5 || 6  |   |      | 0v      |     |     |
 |   4 |   7 | GPIO. 7 |   IN | 1 |  7 || 8  | 0 | IN   | TxD     | 15  | 14  |
 |     |     |      0v |      |   |  9 || 10 | 1 | IN   | RxD     | 16  | 15  |
 |  17 |   0 | GPIO. 0 |   IN | 1 | 11 || 12 | 1 | IN   | GPIO. 1 | 1   | 18  |
 |  27 |   2 | GPIO. 2 |   IN | 1 | 13 || 14 |   |      | 0v      |     |     |
 |  22 |   3 | GPIO. 3 |   IN | 1 | 15 || 16 | 0 | IN   | GPIO. 4 | 4   | 23  |
 |     |     |    3.3v |      |   | 17 || 18 | 0 | IN   | GPIO. 5 | 5   | 24  |
 |  10 |  12 |    MOSI |   IN | 1 | 19 || 20 |   |      | 0v      |     |     |
 |   9 |  13 |    MISO |   IN | 1 | 21 || 22 | 1 | IN   | GPIO. 6 | 6   | 25  |
 |  11 |  14 |    SCLK |   IN | 0 | 23 || 24 | 1 | IN   | CE0     | 10  | 8   |
 |     |     |      0v |      |   | 25 || 26 | 1 | IN   | CE1     | 11  | 7   |
 |   0 |  30 |   SDA.0 |   IN | 1 | 27 || 28 | 1 | IN   | SCL.0   | 31  | 1   |
 |   5 |  21 | GPIO.21 |   IN | 1 | 29 || 30 |   |      | 0v      |     |     |
 |   6 |  22 | GPIO.22 |   IN | 1 | 31 || 32 | 1 | IN   | GPIO.26 | 26  | 12  |
 |  13 |  23 | GPIO.23 |   IN | 1 | 33 || 34 |   |      | 0v      |     |     |
 |  19 |  24 | GPIO.24 |   IN | 1 | 35 || 36 | 1 | IN   | GPIO.27 | 27  | 16  |
 |  26 |  25 | GPIO.25 |   IN | 1 | 37 || 38 | 1 | IN   | GPIO.28 | 28  | 20  |
 |     |     |      0v |      |   | 39 || 40 | 1 | IN   | GPIO.29 | 29  | 21  |
 +-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
 | BCM | wPi |   Name  | Mode | V | Physical | V | Mode | Name    | wPi | BCM |
 +-----+-----+---------+------+---+---Pi 3---+---+------+---------+-----+-----+
 

Install PSOC Programming code on your Pi

  • Log onto the Raspberry Pi
  • Create a folder where you want to work from or you can start from ~/ since the folder RPPSOC will be created
  • Load the PSOC HSSP program as:
git clone https://github.com/land-boards/RPPSOC.git
cd ~/RPPSOC/HSSP/HSSP_Programmer
ls
 
  • Result should look like this:

HSSPDir.PNG

  • Note the HexImage.h and HexImage.c files
    • These are files created in later steps

Programming the PSOC from the Pi

  • PSOC code/hardware development is done on a Windows PC in Cypress Semiconductor's PSOC Creator.
  • PSOC Creator outputs .HEX file that contains the contents of the file that is used to program the part.
  • HexFileParser is run from Windows to create new .hex file for download
    • This program converts the .HEX file into the HexImage.h and HexImage.c files used by the programmer.
  • The user downloads the new .hex file into the Pi
  • The .hex file gets compiled with the Programmer code and downloaded
    • Future improvement - May make the code so that the file can be loaded at run time instead of compiling

Running the HexFileParser

  • Run HexFileParser on the PC

HexFileParser.PNG

  • Select the input files
  • Finding the HEX file can be a little bit tricky
    • Use Windows File Explorer to search for *.HEX file in the directory structure of the file
  • Path is something like
    • ~\CortexM3\ARM_GCC_493\Debug

SelectHexFile.PNG

  • Select the output file path

Upload the HexImage files to your Pi

  • Upload the HexImage.c and HexImage.h files to your Raspberry Pi
    • Load into the path that you installed the HSSP Programmer code (RPPSOC/HSSP/HSSP_Programmer)
  • You can load via a github site, or via an FTP program like FileZilla
    • FileZilla screen

RPPSOC-FileZilla.PNG

  • FileZilla Setup

FileZilla-SiteManagerSetup.PNG

Running the HSSP code

  • Compile the code on the Pi to create the programmer executable file
cd ~/RPPSOC/HSSP/HSSP_Programmer
make
 
  • You will see something like:
pi@rpp01 ~/RPPSOC/HSSP/HSSP_Programmer $ make
gcc -c main.c
gcc -c DataFetch.c
gcc -c DeviceAcquire.c
gcc -c HexImage.c
gcc -c ProgrammingSteps.c
gcc -c Swd_PacketLayer.c
gcc -c Swd_PhysicalLayer.c
gcc main.o DataFetch.o DeviceAcquire.o HexImage.o ProgrammingSteps.o Swd_PacketLayer.o Swd_PhysicalLayer.o -I/usr/local/include -L/usr/local/lib -lwiringPi -o progsoc
  • Run the programmer code
sudo ./progsoc
 
  • Around 10 seconds later, you should see something like:
pi@rpp01 ~/RPPSOC/HSSP/HSSP_Programmer $ sudo ./progsoc
Land Boards, LLC - Programming PSoC
HSSP Success
Exiting

Example Projects

RPPSOC Example Projects

  • Install with
  • Many of the Projects require python
sudo apt-get install python-dev
sudo apt-get install python-pip python2.7-dev
sudo apt-get install python-rpi.gpio
sudo pip install flask
 

EEPROM Access

sudo apt-get install python-smbus
sudo apt-get install i2c-tools
 

Setup to Access the Pi Configuration EEPROM

  • Unless you have a reason to program your hat EEPROM this is something that you don't need to do
  • We have found two different ways to configure the Pi to allow access to the Hat EEPROM
  • One of these ways worked with older Pi cards with older Raspbian OS
  • The other worked with a Raspberry Pi 3 card running Raspbian Jessie (June 2016)
  • There are enough variables here that we can only warn Your Mileage May Vary (YMMV)
  • Raspberry Pi Hat EEPROM tools github
  • There are a lot of somewhat helpful pages out there

EEPROM Access with older Raspbian

  • Pre-Jessie Raspbians
    • Device tree not quite there yet
      • Uses Module blacklisting method
sudo nano /boot/cmdline.txt
 
  • Add
bcm2708.vc_i2c_override=1
  • Reboot the Pi
dmesg | grep i2c
 
  • Returns
pi@rpp01 ~/RPPSOC/eeprom $ dmesg | grep i2c
[    0.000000] Kernel command line: dma.dmachans=0x7f35 bcm2708_fb.fbwidth=592
 bcm2708_fb.fbheight=448 bcm2708.boardrev=0x10 bcm2708.serial=0x5021ad30
 smsc95xx.macaddr=B8:27:EB:21:AD:30 bcm2708.disk_led_gpio=47 bcm2708.disk_led_active_low=0
 sdhci-bcm2708.emmc_clock_freq=250000000 vc_mem.mem_base=0x1ec00000 
vc_mem.mem_size=0x20000000  dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p6 
rootfstype=ext4 elevator=deadline rootwait bcm2708.vc_i2c_override=1
[    4.669685] bcm2708_i2c_init_pinmode(0,0)
[    4.710233] bcm2708_i2c_init_pinmode(0,1)
[    4.712269] bcm2708_i2c bcm2708_i2c.0: BSC0 Controller at 0x20205000 (irq 79) (baudrate 100000)
[    4.870335] bcm2708_i2c_init_pinmode(1,2)
[    4.872154] bcm2708_i2c_init_pinmode(1,3)
[    4.874329] bcm2708_i2c bcm2708_i2c.1: BSC1 Controller at 0x20804000 (irq 79) (baudrate 100000)
[   11.339704] i2c /dev entries driver

EEPROM Access with newer Raspbian Jessie

The main impact of using Device Tree is to change from everything on, 
relying on module blacklisting to manage contention, to everything off unless requested by the DTB. 
In order to continue to use external interfaces and the peripherals that attach to them, 
you will need to add some new settings to your config.txt
  • Edit /boot/config.txt file to add a line at the beginning
dtparam=i2c_vc=on
 
  • Reboot the Pi
dmesg | grep i2c
 
  • Returns
[    3.106292] i2c /dev entries driver
[    3.832585] bcm2708_i2c 3f205000.i2c: BSC0 Controller at 0x3f205000 (irq 83) (baudrate 100000)

Download EEPROM Tools

cd ~/RPPSOC/eeprom
rm eepmake
rm eepdump
make eepmake
make eepdump
chmod +x eep*.sh
./eepmake eeprom_settings.txt eepcfg.eep
 

Program the ID EEPROM

  • Install WRITE ENABLE jumper
  • Enter
sudo ./eepflash.sh -w -t=24c32 -f=eepcfg.eep
 
  • Returns
pi@rpp01 ~/RPPSOC/eeprom $ sudo ./eepflash.sh -w -t=24c32 -f=eepcfg.eep
This will disable the camera so you will need to REBOOT after this process
 completes.
This will attempt to write to i2c address 0x50. Make sure there is an eeprom 
at this address.
This script comes with ABSOLUTELY no warranty. Continue only if you know what
 you are doing.
Do you wish to continue? (yes/no):  
  • Enter yes
  • Pi returns
Writing...
0+1 records in
0+1 records out
105 bytes (105 B) copied, 2.0774 s, 0.1 kB/s
 
  • Enter
sudo ./eepflash.sh -r -t=24c32 -f=myeep.eep
./eepdump myeep.eep stuff.eep
more stuff.eep
 
  • Returns
pi@rpp01 ~/RPPSOC/eeprom $ more stuff.eep
# ---------- Dump generated by eepdump handling format version 0x01 ----------
#
# --Header--
# signature=0x69502d52
# version=0x01
# reserved=0
# numatoms=2
# eeplen=105
# ----------


# Start of atom #0 of type 0x0001 and length 45
# Vendor info
product_uuid 3ac75035-1eba-44ac-ba60-ff20f4c2131a
product_id 0x0006
product_ver 0x0001
vendor "land-boards.com"   # length=15
product "RPPSOC"   # length=6
# End of atom. CRC16=0x2077


# Start of atom #1 of type 0x0002 and length 32
# GPIO map info
gpio_drive 0
gpio_slew 0
gpio_hysteresis 0
back_power 0
#        GPIO  FUNCTION  PULL
#        ----  --------  ----
# End of atom. CRC16=0x6eed
 

Combined Copy/Paste

cd ~/RPPSOC/eeprom
./eepmake eeprom_settings.txt eepcfg.eep
sudo ./eepflash.sh -w -t=24c32 -f=eepcfg.eep
sudo ./eepflash.sh -r -t=24c32 -f=myeep.eep
./eepdump myeep.eep stuff.eep
more stuff.eep
 

Factory Acceptance Tests

Hardware Used

Test Steps

  • Install H3 on 3.3V pins
  • Install H4 on 5V pins
  • Install WRITE ENABLE jumper
  • Install card on Pi
  • Boot Pi
  • Test Software installed on Pi

Program EEPROM

  • Our custom version of eepflash is called eep2flash and it removes the prompts
    • This allows copy/paste of multiple commands to work
cd ~/RPPSOC/eeprom
sudo ./eep2flash.sh -w -t=24c32 -f=eepcfg.eep
sudo ./eep2flash.sh -r -t=24c32 -f=myeep.eep
rm stuff.eep
./eepdump myeep.eep stuff.eep
more stuff.eep | grep RPPSOC
 
  • Result should be
product "RPPSOC"   # length=6

Test PSOC

  • Change to Test Directory on the Pi
  • Download the RPPSOC-FAT image to the PSOC and compile the file
cd ~/RPPSOC/HSSP/HSSP_Programmer/
cp ExampleFiles/RPPSOC-FAT/Hex*.* .
make
sudo ./progsoc
 
  • Or for later times
cd ~/RPPSOC/HSSP/HSSP_Programmer/
sudo ./progsoc
 
  • LEDS on the test boards should cycle
  • Toggle the LED on the RPPSOC
sudo i2cset -y 1 0x20 0x1 0x1
sudo i2cset -y 1 0x20 0x0 0x0
 
  • Test
cd ~/RPPSOC/TestCodePi
sudo python fastTests-RPPSOC.py
 
  • Test result should be
Passed 100 loop test

Combined Copy/Paste

  • Set up
cd ~/RPPSOC/HSSP/HSSP_Programmer/
cp ExampleFiles/RPPSOC-FAT/Hex*.* .
make
cp progsoc progFat

cd ~/RPPSOC/HSSP/HSSP_Programmer/
cp ExampleFiles/RPPSOC-Blink1/Hex*.* .
make
cp progsoc progBlink1

 
  • Do these
cd ~/RPPSOC/eeprom
sudo ./eep2flash.sh -w -t=24c32 -f=eepcfg.eep
sudo ./eep2flash.sh -r -t=24c32 -f=myeep.eep
rm stuff.eep
./eepdump myeep.eep stuff.eep
more stuff.eep | grep RPPSOC

cd ~/RPPSOC/HSSP/HSSP_Programmer/
sudo ./progFat

sudo i2cset -y 1 0x20 0x1 0x1
sudo i2cset -y 1 0x20 0x0 0x0

cd ~/RPPSOC/TestCodePi
sudo python fastTests-RPPSOC.py

cd ~/RPPSOC/HSSP/HSSP_Programmer/
sudo ./progBlink1

sudo halt
  

Assembly Sheet/Parts List

RPPSOC Rev X2 Assembly Sheet