Skip to content

Update loopback fw#238

Merged
jonathanpallant merged 4 commits intomainfrom
update-loopback-fw
Mar 19, 2026
Merged

Update loopback fw#238
jonathanpallant merged 4 commits intomainfrom
update-loopback-fw

Conversation

@robamu
Copy link
Copy Markdown
Contributor

@robamu robamu commented Nov 14, 2025

Based on #226 .

Like expected, not exactly trivial, but definitely a good learning opportunity. Let's see if async can actually simplify the complexity here.

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages bot commented Nov 14, 2025

Deploying ferrous-systems-rust-exercises with  Cloudflare Pages  Cloudflare Pages

Latest commit: 61a6238
Status: ✅  Deploy successful!
Preview URL: https://f96123f1.ferrous-systems-rust-exercises.pages.dev
Branch Preview URL: https://update-loopback-fw.ferrous-systems-rust-exercises.pages.dev

View logs

@robamu robamu force-pushed the update-loopback-fw branch 3 times, most recently from e87b121 to eaa8e30 Compare November 19, 2025 11:51
@robamu
Copy link
Copy Markdown
Contributor Author

robamu commented Nov 19, 2025

Waiting for #226, but some notes:

  • Introduce shared BSP
  • Implementation did not become less complex, but some of the low-level details are hidden now
  • USB ACM is currently a separate task. For the dongle, this is more or less pointless at it will always used as a USB device. But it's a a good thing when running on the DK: The USB ACM is now optional. However, a pipe between the USB ACM and radio task now is now required to send data from the radio task via ACM.
  • I tried to make sleeping work when there is nothing to do using https://rtic.rs/2/book/en/by-example/app_idle.html.
    However, something is not working and the loopback does not work. Did not do any in-depth investigation into that yet.
  • Simplified running on the dk board a bit

@robamu robamu force-pushed the update-loopback-fw branch from 1d6f02d to 6512912 Compare January 16, 2026 15:28
@robamu
Copy link
Copy Markdown
Contributor Author

robamu commented Jan 16, 2026

Unfortunately, this currently breaks the puzzle firmware because both loopback and puzzle firmware depend on the dongle firmware lib. I duplicated the old dongle lib so the puzzle firmware keeps working, to pacify the CI.

@robamu robamu marked this pull request as ready for review January 16, 2026 16:55
@jonathanpallant
Copy link
Copy Markdown
Member

I think I'd rather see the puzzle-fw updated to use the new Dongle BSP in this PR, instead of having two copies of the Dongle BSP in the tree. I'm also not sure that it makes sense to starting pull parts of the BSPs into a shared library - it probably makes sense for a code maintainability point of view (only write things once) but it makes the code harder to read and understand (because now you have to look across multiple libraries). In this material I would prioritise readability over maintainability because we read it (or teach it) much much more often than we update it.

@robamu robamu force-pushed the update-loopback-fw branch from d9dd3e0 to d4c9566 Compare January 23, 2026 18:26
@robamu
Copy link
Copy Markdown
Contributor Author

robamu commented Jan 23, 2026

I ported the puzzle firmware now as well, and removed the shared BSP.

However, there is still some weird behavior for the puzzle firmware: When being connected to the serial terminal, the software is a lot more responsive and faster than when not being connected. I am not fully sure what the reason for this is, and this might just be due to my lack of knowledge about the behavior of USB CDC ACM devices.

For example, when connected via serial terminal, the puzzle solution takes 2-3 seconds. When not being connected
it takes a few seconds longer.

@robamu robamu force-pushed the update-loopback-fw branch from d4c9566 to 50a5e15 Compare January 23, 2026 18:48
@robamu
Copy link
Copy Markdown
Contributor Author

robamu commented Jan 23, 2026

Alright. I just lowered the timeout on the packet write, and it seems to work now at comparable speed :)

@robamu robamu force-pushed the update-loopback-fw branch from 50a5e15 to 33e4118 Compare January 23, 2026 18:49
@robamu
Copy link
Copy Markdown
Contributor Author

robamu commented Jan 23, 2026

ready for review now. I also kept the old board initialization function signature, makes this PR a little bit more focused on the port. It is a lot of unwraps but it could be argued that a double initialization will not happen very often and that a panic is okay for an error like this. What do you think (would be a separate PR though).

@robamu robamu force-pushed the update-loopback-fw branch from 5efaec7 to c511c5f Compare January 26, 2026 16:30
@robamu robamu force-pushed the update-loopback-fw branch 2 times, most recently from 48e6967 to 6b9743b Compare February 13, 2026 12:38
@robamu
Copy link
Copy Markdown
Contributor Author

robamu commented Feb 13, 2026

I did some experiments in https://github.com/ferrous-systems/rust-exercises/tree/sleep-experiments .

I essentially flashed the loopback firmware with sleep handling enabled onto the DK board and created a really simple radio packet sender for the dongle. The DK firmware seems to receive the radio packets, and I can see packets arriving in the serial monitor. So I am not sure what is going on. Why would this not work specifically for the dongle?

@robamu
Copy link
Copy Markdown
Contributor Author

robamu commented Feb 13, 2026

Unfortunately detected new issues: I think we seemingly lose data over the serial monitor:

Received 4 bytes (L
Received 4 bytes (LQI=55)

Received 4 bytes (LQI=55)

Received 4 bytes (LQI=55)

Received 4 bytes (LQI=55)

Received 4 bytes (L
Received 4 bytes (LQI=55)

Received 4 bytes (LQI=55)

Received 4 bytes (LQI=55)

Received 4 bytes (LQI=55)

Received 4 bytes (L

Update: Fixed. Classic mistake: using write instead of write_all

@robamu robamu force-pushed the update-loopback-fw branch from 9481532 to b521579 Compare February 13, 2026 14:23
@jonathanpallant
Copy link
Copy Markdown
Member

I think I've understood how these queues and pipes work. I propose some changes in https://github.com/ferrous-systems/rust-exercises/tree/update-loopback-fw-jp-updates to try and rename the types and variables to be consistent.

@robamu
Copy link
Copy Markdown
Contributor Author

robamu commented Mar 3, 2026

well at the very least i got some basic windows setup ready now so I can test this myself in the future. I found the bug. I mis-intepreted a generic (919497c).

@robamu
Copy link
Copy Markdown
Contributor Author

robamu commented Mar 3, 2026

there seems to be some github issue..

@jonathanpallant
Copy link
Copy Markdown
Member

github had another outage. Try again now?

@robamu
Copy link
Copy Markdown
Contributor Author

robamu commented Mar 4, 2026

could aslo be a cloudclare issue

@jonathanpallant
Copy link
Copy Markdown
Member

I kicked cloudflare.

@jonathanpallant
Copy link
Copy Markdown
Member

My proposed changes branch was updated - feel free to merge it in if you like it.

@jonathanpallant
Copy link
Copy Markdown
Member

Can confirm the dongle channel change now works on Windows, for both puzzle-fw and loopback-fw.

Unfortunately the loopback-fw's default radio channel is 20, but the application is expecting channel 25.

@jonathanpallant
Copy link
Copy Markdown
Member

Unfortunately the loopback-fw's default radio channel is 20, but the application is expecting channel 25.

The application was wrong, and was fixed in v1.28.1.

@robamu robamu force-pushed the update-loopback-fw branch from cad051d to 5641127 Compare March 16, 2026 13:14
robamu and others added 2 commits March 16, 2026 14:17
Previously, core core SYST peripheral was used as the monotonics
provider. This is probably problematic when doing IDLE mode sleepping.
…sleep-support

Update loopback fw with sleep support
@jonathanpallant jonathanpallant merged commit 3d67e5f into main Mar 19, 2026
14 checks passed
@robamu robamu deleted the update-loopback-fw branch March 20, 2026 09:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants