SRUG 2024.03 Meetup
FutureWei/Linux Foundation Europe
giving OSSNA Talks on:
* Servo
* Robius
Offered to speak to our group
Pizza will be provided!
Text
On a Raspberry Pi Pico
- Brad G.
Prerequisites:
1. https://www.rust-lang.org/tools/install
2. `rustup target add thumbv6m-none-eabi`
Mac: `brew install git` (see https://brew.sh/) or
https://github.com/git-guides/install-git
Ubuntu: `apt install git`
Windows: https://github.com/git-guides/install-git
1. Wire pin 1 (GPIO 0) to an empty row
2. Add resistor from wire end row to new empty row
3. Add LED (long leg) from resistor end row to new empty row
4. Wire from LED (short leg) to - rail
5. Wire - rail to pin 38 (Ground)
The Raspberry Pi Pico has a different CPU then your computer.
Your computer has to compile your source code to machine language for a processor it can't run. This is called cross-compiling.
Your cross-compiled program then needs to be transferred to the Pi and run there.
To do this:
1. Unplug your RPi Pico USB cable (either end) if it is plugged in.
2. Hold down the white button on the RPi Pico.
3. Re-connect your RPi Pico with the white button held down.
(Your RPi Pico is now ready to receive your cross-compiled program.)
4. `cargo run`. (Your program is now running on your RPi Pico.)
5. Repeat the above procedure to send and run a new version of your code to your RPi Pico.
interface capabilities
Decimal Binary Hexadecimal
(Base 10) (Base 2) (Base 16)
Value | Encoding | Encoding | Encoding
------+----------+----------+-------------
Zero | 0 | |
One | 1 | |
Two | 2 | |
Three | 3 | |
Four | 4 | |
Five | 5 | |
Six | 6 | |
Seven | 7 | |
Eight | 8 | |
Nine | 9 | |
--------+----------+----------+-------------
Ten | 10 | |
Eleven | 11 | |
Twelve | 12 | |
Thirteen | 13 | |
Fourteen | 14 | |
Fifteen | 15 | |
Sixteen | 16 | |
Seventeen | 17 | |
... | ... | ... | ...
Decimal Binary Hexadecimal
(Base 10) (Base 2) (Base 16)
Value | Encoding | Encoding | Encoding
------+----------+----------+-------------
Zero | 0 | 0 |
One | 1 | 1 |
--------+----------+----------+-------------
Two | 2 | 10 |
Three | 3 | 11 |
Four | 4 | 100 |
Five | 5 | 101 |
Six | 6 | 110 |
Seven | 7 | 111 |
Eight | 8 | 1000 |
Nine | 9 | 1001 |
Ten | 10 | 1010 |
Eleven | 11 | 1011 |
Twelve | 12 | 1100 |
Thirteen | 13 | 1101 |
Fourteen | 14 | 1110 |
Fifteen | 15 | 1111 |
Sixteen | 16 | 1 0000 |
Seventeen | 17 | 1 0001 |
... | ... | ... | ...
Decimal Binary Hexadecimal
(Base 10) (Base 2) (Base 16)
Value | Encoding | Encoding | Encoding
------+----------+----------+-------------
Zero | 0 | 0 | 0
One | 1 | 1 | 1
Two | 2 | 10 | 2
Three | 3 | 11 | 3
Four | 4 | 100 | 4
Five | 5 | 101 | 5
Six | 6 | 110 | 6
Seven | 7 | 111 | 7
Eight | 8 | 1000 | 8
Nine | 9 | 1001 | 9
Ten | 10 | 1010 | a
Eleven | 11 | 1011 | b
Twelve | 12 | 1100 | c
Thirteen | 13 | 1101 | d
Fourteen | 14 | 1110 | e
Fifteen | 15 | 1111 | f
--------+----------+----------+-------------
Sixteen | 16 | 1 0000 | 10
Seventeen | 17 | 1 0001 | 11
... | ... | ... | ...
# Sample Values
Decimal 42 = 0b0010_1010, 0x2a
Decimal 255 = 0bffff_ffff, 0xff
Decimal 53_280 = 0b1101_0000_0010_0000, 0xd020
Status Register (Status)
Status Register Example
```
mov r0, #2 ;r0 = 2, SR: 0
loop:
sub r0, r0, #1 ;r0 = 1, SR: Z=0; r0 = 0, SR: Z=1
bne loop ;if Z != 0 { goto loop }
```
- Supervisor vs User Mode
Devices
Let's Get Started
(We are in a new Golden Age for programming!)
-Azi
-Sagaar