ferrous-systems / rust-exercises

Exercises for learning Rust, by Ferrous Systems
Creative Commons Attribution Share Alike 4.0 International
127 stars 15 forks source link

Updates as I run through #70

Closed jonathanpallant closed 5 months ago

jonathanpallant commented 5 months ago

I'm working through the two embedded courses, fixing things as I find them.

jonathanpallant commented 5 months ago

Going to run these now but I need to figure out the order in which to run.

The speed run is:

  1. Flash the dongle with nrfdfu /path/to/loopback-fw. You can get the firmware from a recent Github action Artifact zip file.
  2. Run cargo xtask serial-term and check you can see the output.
  3. Run cargo xtask change-channel 15 and see if serial term tells you it changed channel.
  4. put it back to the default channel
  5. Run cd nrf52-code/radio-app && cargo run --bin radio-recv and see if it says "hello"
  6. Flash the dongle with nrfdfu /path/to/puzzle-fw
  7. restart the serial-term
  8. try channel-change on the puzzle firmware, but put it back to the default channel
  9. Run cd nrf52-code/radio-app && cargo run --bin radio-solution and see if it gives you the solution
amanjeev commented 5 months ago

Flash the dongle with nrfdfu /path/to/puzzle-fw

the puzzle-fw binary does not exist in the GHA artifacts. so I built one.

amanjeev commented 5 months ago

Final command

at 12:50:34  ❤  cargo run --bin radio-puzzle-solution-2
    Finished dev [optimized + debuginfo] target(s) in 0.03s
     Running `probe-rs run --chip nRF52840_xxAA target/thumbv7em-none-eabihf/debug/radio-puzzle-solution-2`
      Erasing ✔ [00:00:00] [#####################################################################################] 20.00 KiB/20.00 KiB @ 33.47 KiB/s (eta 0s )
  Programming ✔ [00:00:00] [#####################################################################################] 20.00 KiB/20.00 KiB @ 31.19 KiB/s (eta 0s )    Finished in 1.266s
ciphertext: At4H)4H)uR)#Fu6Cx#)6#HHui#
plaintext:  This is an example message
Dongle response: correct
`dk::exit()` called; exiting ...
…oj/ferrous-systems/training-material/rust-exercises/nrf52-code/radio-app  on  update-run-through [?] is 📦 v0.0.0 via 🦀 v1.75.0 on ☁️  (us-east-1) took 2s

at 12:50:46  ❤  cargo run --bin radio-puzzle-solution
    Finished dev [optimized + debuginfo] target(s) in 0.03s
     Running `probe-rs run --chip nRF52840_xxAA target/thumbv7em-none-eabihf/debug/radio-puzzle-solution`
      Erasing ✔ [00:00:00] [#####################################################################################] 20.00 KiB/20.00 KiB @ 33.59 KiB/s (eta 0s )
  Programming ✔ [00:00:00] [#####################################################################################] 20.00 KiB/20.00 KiB @ 31.18 KiB/s (eta 0s )    Finished in 1.263s
ciphertext: At4H)4H)uR)#Fu6Cx#)6#HHui#
plaintext:  This is an example message
Dongle response: correct
`dk::exit()` called; exiting ...

and

serial-term shows

RX CRC 4615, LQI 62, LEN 1
TX Map(125) => 48

RX CRC 9f59, LQI 63, LEN 1
TX Map(126) => 56

RX CRC 0ed1, LQI 62, LEN 1
TX Map(127) => 0

RX CRC 0000, LQI 62, LEN 0
TX Secret

RX CRC fbd0, LQI 62, LEN 26
TX Correct
..........
RX CRC b181, LQI 36, LEN 45
TX Incorrect

RX CRC d26b, LQI 23, LEN 45
TX Incorrect
jonathanpallant commented 5 months ago

Flash the dongle with nrfdfu /path/to/puzzle-fw

the puzzle-fw binary does not exist in the GHA artifacts. so I built one.

Just to confirm, the puzzle-fw is present in the v1.9.0 release:

➜  rust-exercises-v1.9.0 $ cd nrf52-code/boards/dongle-fw
➜  dongle-fw $ ls -l
total 3816
-rw-r--r--@  1 jonathan  staff     879  6 Feb 21:25 README.md
-rwxr-xr-x@  1 jonathan  staff  961812  6 Feb 21:25 loopback-fw
drwxr-xr-x@ 19 jonathan  staff     608  6 Feb 21:25 old
-rwxr-xr-x@  1 jonathan  staff  983980  6 Feb 21:25 puzzle-fw