Shorthand notes #1
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Prerequisites (long download + compile)
IMPORTANT!! These steps can easily take 30 MINUTES of downloading and compiling
1. Install basic compiler tools
Mac
Linux
Windows 10
2. Install
rustMac, Linux:
Note: Follow any on-screen instructions from the rust installer.
We want to make sure that we're all on the same version:
Note: see https://rustup.rs for Windows 10.
FYI: Toolchain Version Locking
Each directory can have its own Rust config. You can explicitly set the version of rust to use for that code.
Let's say you're going to run all of these examples from
~/blue_pill:For this workshop we'll use v1.59.0:
Also, you can explicitly compile a rust program with a particular rust version:
3. Add the ARM Cortex-M toolchain
4. Install the ftdi USB driver
Mac
Linux
Windows 10
5. Install
cargo flashfor Rust 1.59.0STOP
Did you read the prerequisites ^^?
Workshop (NOT Prerequisites)
1. Download and Print the schematics
2. Clone the docs repository
3. Clone the code repository
4. Connect the pill to programmer
The pin order on the programmer may not exactly match the pin order on the board
In most of the parts in the kit, this is what the PIN order looks like:
Example only of programmer pinout (not the same as yours):
DOUBLE CHECK!!!
Failure to double check == fried board!
Windows 10 STLink Driver
If you're on Windows 10, be sure to install the STLink driver:
Connect Programmer to Computer
Uncap the programmer and plug into a USB port on your computer.
Again: bad 3.3v or GND connection == fried board!
How to know if it worked?
The blue pill should boot up with both
If it does not, it could be that it was not programmed with the "hello, world" application.
--list-probesNote: If you have multiple STLinks connected, you'll want to edit
Embed.toml(or maybe it wasCargo.tomlwith those values.Console.app on Mac
If you're on Mac you can open Console.app and searching
icddandstm32from the top-level logs (your computer name).Unplug and re-plug the programmer device and you should see something like this:
5. Build the sample code
Peripherals
When you want to answer the question "How do I make x do y?", you'll be looking here:
I2C
Beginning of each transaction sends the address. Only the listener listens.
SPI
Has chip select.
Rotary Encoder: Search: stm32 hal rust rotary encoder
Timers
Each timer has certain constraints
TxCxN
Libraries
rtt_targetstm32f1xx_hal::paccortex_mTerms
rccRust / HAL conventions.
Sometimes random, seemingly unrelated things must be passed around.
Although the devices know what they need (as they have 1:1 types - such as
apb2), it is explicit for the sake avoiding race or locking conditions, and for documentation to the reader.Cleaning Up
Set the default rust toolchain version back to
stable:Errors
Probe could not be created
cargo-flash 0.9.0gives me this error. The instructions have been updated to usecargo-flash 0.8.0:Solution: Use
cargo-flash 0.8.0.Error The config 'default' could not be loaded.
Solution: Use
cargo-embed 0.8.0, and update the configPrior Versions
The last time we did this workshop we used these versions:
@neuberfran You may have better luck with the instructions in the wiki here: https://cgit.pinealservo.com/BluePill_Rust/resources/wiki/Software-Setup