Tags:
view all tags
%DASHBOARD{ section="dashboard_start" }% %DASHBOARD{ section="banner" image="%PUBURLPATH%/Velo/MainMCUFirmware/kinetisdesignstudio.png" title="Raspberry Pi Interface to Cosmac Elf" titlestyle="color:#F00000;" }% %DASHBOARD{ section="box_start" width="992" height="400" }% ---+ elf2bin (download tool) $ *NAME*: elf2bin - Copies the Elf (Membership Card) memory to a binary file on the Raspberry Pi. $ *SYNOPSIS*: elf2bin [-s hexadr] [-e hexadr] [-w] [-r] [_file_] $ *DESCRIPTION*: Copies the Elf memory to a binary file (or stdout) on the Raspberry Pi. The Raspberry Pi GPIO is used as interface to the Cosmac Elf SBC (e.g. Elf Membership Card parallel port). The generated data is written to the standard output stream or to a _file_. Caution: Overwrite file if it exists. Use > for redirecting (save the file) or | for piping to another command (e.g. hexdump) $ *OPTIONS*: Non argument options that are duplicated on the command line are not harmful. For options that require an argument, each duplication will override the previous argument value. $ *-s* _hexadr_: start address in hex (0 is default) $ *-e* _hexadr_: end adress in hex (0xFFFF is default) $ *-w*: write enable when copying is finished $ *-r*: go to run mode when copying is finished %DASHBOARD{ section="box_end" }% %DASHBOARD{ section="box_start" width="992" height="380" }% ---++ bin2elf (upload tool) * elf [-i] [-v] [-s <adr>] [load|run|wait|reset|write|get|put] [<switch>] LED Q IN WAIT CLEAR WRITE SWITCH -i increment -v verbose %DASHBOARD{ section="box_end" }% %DASHBOARD{ section="box_start" width="992" height="600" }% ---++ elf (command line tool) * elf [-i] [-v] [-s <adr>] [load|run|wait|reset|write|get|put] [<switch>] LED Q IN WAIT CLEAR WRITE SWITCH -i increment -v verbose %DASHBOARD{ section="box_end" }% %DASHBOARD{ section="box_start" width="992" height="380" }% ---+ How to get and build RaspiElf tools Get the source from the GIT repository (if you have not installed GIT yet, then install it with =sudo apt-get install git=): <verbatim> pi@cosmac:~/elf $ git clone https://github.com/spyren/RaspiElf Cloning into 'RaspiElf'... remote: Counting objects: 68, done. remote: Compressing objects: 100% (37/37), done. remote: Total 68 (delta 32), reused 62 (delta 29), pack-reused 0 Unpacking objects: 100% (68/68), done. Checking connectivity... done. pi@cosmac:~/elf $ </verbatim> Build (compile) from the sources: <verbatim> pi@cosmac:~/elf $ cd RaspiElf pi@cosmac:~/elf/RaspiElf $ cd tools/ pi@cosmac:~/elf/RaspiElf/tools $ make cc -g -c elf2bin.c cc -g -c raspi_gpio.c cc -g -o elf2bin -lwiringPi elf2bin.o raspi_gpio.o cc -g -c bin2elf.c cc -g -o bin2elf -lwiringPi bin2elf.o raspi_gpio.o cc -g -c elf.c cc -g -o elf -lwiringPi elf.o raspi_gpio.o pi@cosmac:~/elf/RaspiElf/tools $ </verbatim> Install the binaries into =/usr/local/bin= <verbatim> pi@cosmac:~/elf/RaspiElf/tools $ sudo make install install -m 557 elf2bin bin2elf elf /usr/local/bin </verbatim> %DASHBOARD{ section="box_end" }% %DASHBOARD{ section="box_start" width="992" height="600" }% ---+ Sample session Initialise the Elf memory with 00H (32 Kib): <verbatim> pi@cosmac:~/elf/RaspiElf/chase $ bin2elf -e 7fff </dev/zero 0x8000 bytes written </verbatim> Upload the chase lighting program (details see ChaseLighting): <verbatim> pi@cosmac:~/elf/RaspiElf/chase $ bin2elf -w -r chase.bin 0x002d bytes written </verbatim> Stop the program an go into the load state: <verbatim> pi@cosmac:~/elf/RaspiElf/chase $ elf load 01 1 0 0 1 1 0 0c </verbatim> Hexdump the Elf memory until address 0x3f: <verbatim> pi@cosmac:~/elf/RaspiElf/chase $ elf2bin -e 3f | hexdump -C 0x0040 bytes read 00000000 c0 00 03 e3 90 b3 f8 30 a3 f8 01 53 64 6c 23 fa |.......0...Sdl#.| 00000010 fe 3a 1a f0 f6 c7 f8 80 30 1f f0 fe c7 f8 01 53 |.:......0......S| 00000020 f8 14 b2 22 92 3a 23 c5 7a 38 7b 30 0c 00 00 00 |...".:#.z8{0....| 00000030 04 ff 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 00000040 </verbatim> Get the status <verbatim> pi@cosmac:~/elf/RaspiElf/chase $ elf 02 1 1 0 1 1 1 ff pi@cosmac:~/elf/RaspiElf/chase $ elf -v LED:01 Q:1 Rx:1 IN:0 WAIT:1 CLR:1 READ:0 SWITCH:0c </verbatim> Write enable (not READ) <verbatim> pi@cosmac:~/elf/RaspiElf/chase $ elf -n read 02 1 1 0 1 1 0 ff </verbatim> Run mode (starts the chase lighting again) <verbatim> pi@cosmac:~/elf/RaspiElf/chase $ elf run </verbatim> Put 0000'0000B to the switches (LEDs from right to left) <verbatim> pi@cosmac:~/elf/RaspiElf/chase $ elf put 0 40 1 1 0 0 0 0 00 </verbatim> Put 1000'0000B to the switches (LEDs from left to right) <verbatim> pi@cosmac:~/elf/RaspiElf/chase $ elf put 80 10 1 1 0 0 0 0 80 </verbatim> Get the status (LEDs and Q are changing) <verbatim> pi@cosmac:~/elf/RaspiElf/chase $ elf -v LED:40 Q:1 Rx:1 IN:0 WAIT:0 CLR:0 READ:0 SWITCH:80 pi@cosmac:~/elf/RaspiElf/chase $ elf -v LED:02 Q:0 Rx:1 IN:0 WAIT:0 CLR:0 READ:0 SWITCH:80 </verbatim> %DASHBOARD{ section="box_end" }% %DASHBOARD{ section="box_start" width="992" height="600" }% ---+ Wiring * https://pinout.xyz/# * http://wiringpi.com/the-gpio-utility/ * http://raspberrypiguide.de/howtos/raspberry-pi-gpio-how-to/ | *Pi Pin#* | *Pi Function* | *Elf Pin DSUB J2* | *POWER P4* | *Elf Function* | | 1 | 3.3 V | (18) | (3) | (VIN, +) | | 2 | 5 V | (18) | 3 | VIN, + | | 3 | BCM 2, SDA | | | | | 4 | 5 V | | | | | 5 | BCM 3, SCL | | | | | 6 | GND | (19) | 1 | GND, - | | 7 | BCM 4 | 1, in | | IN- (EF4) | | 8 | BCM 14, TXD | (20) | 4, in | RXD, RX (EF3) | | 9 | GND | 21 | 6 | GND, /ON | | 10 | BCM 15, RXD | (15) | 5, out, Cathode | TXD, TX (Q) | | 11 | BCM 17 | 14, in | | WAIT- | | 12 | BCM 18 | 16, in | | CLR- | | 13 | BCM 27 | 17, in | | WE- | | 14 | GND | | | | | 15 | BCM 22 | 2, in | | IN0 | | 16 | BCM 23 | 3, in | | IN1 | | 17 | 3.3 V | | | | | 18 | BCM 24 | 4, in | | IN2 | | 19 | BCM 10, MOSI | 5, in | | IN3 | | 20 | GND | | | | | 21 | BCM 9, MISO | 6, in | | IN4 | | 22 | BCM 25 | 7, in | | IN5 | | 23 | BCM 11,SCLK | 8, in | | IN6 | | 24 | BCM 8, CE0 | 9, in | | IN7 | | 25 | GND | | | | | 26 | BCM 7, CE1 | 25, out, Cathode | | O0 (*) | | 27 | BCM 0 | | | | | 28 | BCM 1 | | | | | 29 | BCM 5 | 24, out, Cathode | | O1 (*) | | 30 | GND | | | | | 31 | BCM 6 | 23, out, Cathode | | O2 (*) | | 32 | BCM 12 | 22, out, Cathode | | O3 (*) | | 33 | BCM 13 | 13, out, Cathode | | O4 (*) | | 34 | GND | | | | | 35 | BCM 19 | 12, out, Cathode | | O5 (*) | | 36 | BCM 16 | 10, out, Cathode | | O6 (*) | | 37 | BCM 26 | 11, out, Cathode | | O7 (*) | | 38 | BCM 20 | | | | | 39 | GND | | | | | 40 | BCM 21 | | | | %DASHBOARD{ section="box_end" }% %DASHBOARD{ section="dashboard_end" }% -- %USERSIG{PeterSchmid - 2017-11-26}% ---++ Comments
Attachments
Attachments
Topic attachments
I
Attachment
History
Action
Size
Date
Who
Comment
png
gpio-numbers-pi2.png
r1
manage
53.2 K
2017-11-26 - 18:46
PeterSchmid
Edit
|
Attach
|
Watch
|
P
rint version
|
H
istory
:
r38
|
r18
<
r17
<
r16
<
r15
|
B
acklinks
|
V
iew topic
|
Raw edit
|
More topic actions...
Topic revision: r16 - 2017-12-17
-
PeterSchmid
Home
Site map
Cosmac web
MRR web
MecrispCube web
SuperRandonnee web
TWiki web
Ursula web
Velo web
Cosmac Web
Create New Topic
Index
Search
Changes
Notifications
RSS Feed
Statistics
Preferences
View
Raw View
Print version
Find backlinks
History
More topic actions
Edit
Raw edit
Attach file or image
Edit topic preference settings
Set new parent
More topic actions
Account
Log In
Edit
Attach
Copyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki?
Send feedback