This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Programming guide for nrf5 SDK

I'm starting to read all the resources and examples included in the SDK. However, there doesn't seem to be a lot of emphasis on explaining how the programming architecture works (ie. event driven, task driven, or what).

A lot of the tutorials and examples simply show you how to compile and run one of the SDK examples. Is there any documentation that explains how one would create their own application entirely from scratch?

This would probably help in understanding the underlaying code in examples rather than just taking an example and adding on custom code.

  • Yes, I've mainly been using RTT for now just because of the timing issues encountered with UART or halt debugging.

    Things make a bit more sense after working through some examples...I come from a background of working with PICs at a low level so it's a little confusing that there are multiple ways to do things (HAL, drivers, libraries), as well as events vs interrupts. It would be nice if there was a long tutorial which went through everything rather than having to comb through different examples and read back and forth between the API descriptors, etc. But I guess that's just firmware life.

  • Yes, you need to get your hands dirty and spend some time (which is rather months then days). I haven't found any magic shortcut yet unfortunately... Btw. if you think that nRF5 SDK is confusing then what you say on products such as STM32 line where you have even 3-4 SDKs to choose from for the start and continuing in so many layers and building blocks in each of them?! From what I see is nRF5 SDK pretty much above industry standard;)

  • Oh good lord. Yes I've heard great things about Nordic so that's why I decided to go with them. I guess I'm just used to things like C++ or C# where there are tons of tutorials and very thorough documentation. Even my experiences with PICs were very straight forward...but I guess when you have a Bluetooth stack on top it gets a little more complicated. I'm finding I have to refer back and forth between the nrf52 datasheet and the SDK API (and also between the HAL and driver/libraries in the API which can get confusing in terms of which to use). Whereas with PICs all I need to do is reference the datasheet and work with the registers directly. I know you can do this with the Nordic SDK HAL layer as well but I guess it's just taking some time to figure out what's going on considering there are different options of achieving the same thing.

  • Yes, most of us never really access registers directly, all standard things like BLE, UART/SPI/I2C, scheduler, RTC based timer etc. are provided in decent libraries and drivers. So once you figer the optimal event driven architecture then you are fine for 90% of projects. The problems start when you want to push nRF52 to the limits, because chip itself is pretty powerful but not all things are 100% utilized in SDK or are not working smoothly when all merged into one complex project. BUT that's absolutely normal and again I can say that Nordic SDK is above industry standard in this sense as well (try to do this with NXP LPC series or STM32, you will be in the same situation: if you want to push the platform to the limit you need to have very deep knowledge of it and hands-on experience in range of 6+ months)

  • Right. I'm trying to stick with event driven and the drivers/libraries as well. The only time I'm using HAL is for simple GPIO (just more intuitive for me as this point).

    Thanks for the tips. I've got a fairly simple project, just interfacing BLE and streaming accelerometer data...but I've only got a month to implement it so hopefully it won't be too problematic. Cheers!

Related