jamesmunns / nrf52dk-sys

A Rust Crate to develop on the Nordic nRF52-DK
MIT License
85 stars 19 forks source link

Compatibility with NRF51? #11

Closed CodeLenny closed 6 years ago

CodeLenny commented 6 years ago

Hi, I'm thinking of using Rust for an nRF51422 project, and I'm using the NRF51 DK, and it looks like this repo is the closest thing available.

If you wouldn't mind answering a few questions, I'd love a kickstart to the process. (And I could see some of these answers winding up in a "FAQ/If you're here for..." section of the README, I might be able to PR it if it would help...)

  1. Is this repo in a stable/useful state, or are there still unfinished parts that I should be aware of? 2.. Is this a good idea in practice, or is it just a fun experiment? I'd prefer to spend more time programming my microcontroller than fighting to unite Rust and the nRF universe.
  2. Do you know if this library is directly compatible with the nrf51/nRF51422 DK/chip? Otherwise, are you aware of any key differences to be aware of?
  3. Speaking of chips, have you tried/used/thought of using this repo for bare nRF chips, or do you know of any differences that make this repo only compatible with the DK?

I'd love to get started using Rust with this project, but probably wouldn't if there wasn't an existing repo for the nRF family to base things on, thank you!

anxiousmodernman commented 6 years ago

@CodeLenny sorry for the late review.

  1. It is usuable. My check on this is compiling and flashing the examples to nrf52-dk microcontroller. Best results are on Linux machines, but an open PR should make it easier to compile things on MacOS. No one has tested Windows yet.

1.2 I am not a professional hardware developer, but the author of this crate is, so I defer to James. I think that this crate would be suitable for prototyping on Nordic's dev boards.

  1. It depends. I have only used this with an nrf52 series dev board. I imagine that some subset of Nordic's C libraries will be common, but this might be a better question for them. Ultimately everything is compiled down to ARM assembly, so presumably if you use common functionality everything should be fine. If not, it should be possible to build a crate in a similar style, to wrap the C libraries specific to your board.

  2. Only the DK is tested.

niklasad1 commented 6 years ago

@CodeLenny

I think it depends on your version of Nordic SoftDevice, according to Nordic's documentation nRF5 SDK v12.3.0 should work, see http://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.sdk%2Fdita%2Fsdk%2Fnrf5_sdk.html

The differences between nrf51 and nrf52 can be found here

I haven't looked into the linker scripts in the repo but you might need to change RAM and Flash size since nrf51 has less memory than nrf52.

I would also recommend you to have a look at Tock OS, an embedded OS written in Rust which support both nRF51-DK and nRF52-DK with a pure Rust BLE stack with limited functionality.

CodeLenny commented 6 years ago

@anxiousmodernman @niklasad1 Thank you both for all the info!
Also @niklasad1 thanks for suggesting Tock, it looks like a very interesting project.

Sounds like I should give developing Rust on the nrf51 a shot!

anxiousmodernman commented 6 years ago

@CodeLenny Awesome! I'm gonna close this, but feel free to open new issues with questions or suggestions.