I've recently completed the Discovery book (this one: Introduction - Discovery) that uses the microbit v2, and I've also been able to successfully implement some of my own ideas (not in the book) with the microbit. I'm looking to take the next step in my embedded Rust journey, and I thought transmitting data via bluetooth would be a good idea. However, it has very quickly stomped me into submission .
Is there a different board that's easier to use for bluetooth data transmission?
If not, is the nrf-softdevice crate the way to go for the microbit v2?
Any general advice/recommendations for trying to transmit sensor data over bluetooth with Rust?
I like the nrf-softdevice crateβthe examples cover a wide range of use cases, and the community provides great support. What specific challenges are you encountering?
unfortunately, there's no open source bluetooth stack for this chip in rust, as far as I know. the softdevice is the only bluetooth stack on nrf chips, but its a proprietary blob, I have only used it with the C nrf sdk, I have zero experience with it in rust.
from the "readme" file, I have the impression that it should be easy to use, compared to the C sdk. but I'll let people with real experience to speak about it.
as for alternative boards, I have heard good words about rust support for the esp32 chips, thanks to the first party support from the chip vendor. you can find many esp32 based board on line, for example, there are several devkits from ada fruit. I recommend the C series such as esp32-c3, which is riscv based, over the xtensa based models, because the xtensa toolchain setup is a little bit more involved than the riscv toolchain.
there's a blog series about rust bluetooth on the esp32-c3 device, you can check it out:
That's interesting - you are at least seeing the info! prints and I don't get that at all. I did flash SoftDevice, but I'm not entirely sure because every time I do it it prints an error:
PS C:\Users\mthel> probe-rs download --verify --binary-format hex --chip nRF52833_xxAA "C:\Users\mthel\Rust\s140_nrf52_7.3.0\s140_nrf52_7.3.0_softdevice.hex"
ERROR probe_rs::architecture::arm::core::armv7m: The core is in locked up status as a result of an unrecoverable exception
Erasing β 100% [####################] 156.00 KiB @ 37.28 KiB/s (took 4s)
Programming β 100% [####################] 156.00 KiB @ 14.51 KiB/s (took 11s)
Finished in 16.24s
I mean, it appears to flash despite the error, but I don't know if that's causing any problems.
Without knowing much of the details about the hardware, it may be helpful to add some sleeps between the printouts?
I noticed the working version prints all the messages at 0.0000, so it's possible the device gets into a locked up state before it gets to send the info to your console.
Yes, I'm also using 0.25.0 and downgrading to 0.22.0 didn't fix the issue. I don't get the error anymore about the core being in locked up status when flashing SoftDevice, but the end result is the same when running cargo embed to flash the program to the microcontroller. Thanks for your help though, I really appreciate it!
I went ahead and ordered an ESP32-C3-DevKit so hopefully I'll be able to follow along with the blog posts that @nerditation linked to above and get something working with that board!
Ha! That was it! After being able to see the errors, I was able to get something working (updated code in the repo). Thanks so much for your help, I appreciate it! Now, on to figuring out how to transmit some data!