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.

Parents
  • In tutorial section of this forum there are 4 guides to Bluetooth Low Energy (in the middle of the page, starting with the advertisement explanation and exercises). I believe that's what you describe. By reading the code of these examples and following code snippets and exercises you should get glimps how Nordic BLE stack work and what "standard application architecture" is on top of that. If you decide to go with Nordic BLE stack (note that there are other options so that might be the reason why there is no authoritative guide to app's architecture = it depends on the radio stack) then you can see many sequence diagrams including basic flow charts of thread vs. interrupt driven event retrieval architectures on Infocenter. There are also several "project templates" in the nRF5 SDK which should be "the master architecture" example if you decide to go with nRF5 SDK and Nordic BLE stacks (Soft Device).

    If anything missing could you be more specific? E.g. by linking some other examples from different embedded architectures and SDKs...

Reply
  • In tutorial section of this forum there are 4 guides to Bluetooth Low Energy (in the middle of the page, starting with the advertisement explanation and exercises). I believe that's what you describe. By reading the code of these examples and following code snippets and exercises you should get glimps how Nordic BLE stack work and what "standard application architecture" is on top of that. If you decide to go with Nordic BLE stack (note that there are other options so that might be the reason why there is no authoritative guide to app's architecture = it depends on the radio stack) then you can see many sequence diagrams including basic flow charts of thread vs. interrupt driven event retrieval architectures on Infocenter. There are also several "project templates" in the nRF5 SDK which should be "the master architecture" example if you decide to go with nRF5 SDK and Nordic BLE stacks (Soft Device).

    If anything missing could you be more specific? E.g. by linking some other examples from different embedded architectures and SDKs...

Children
  • I'm currently reading the tutorials...guess I'll have to just keep reading. I'm definitely using the Nordic stack and SDK, as I've already committed to using a nRF52 device. I prefer to start from scratch so I know exactly what's happening as opposed to working off an example that feels fairly bloated.

    For example, is there a tutorial on how to create a new project in Keil in order to get the bare minimums working?

  • This is interesting question. I won't help here as I don't use Keil but from my little experience I would ask it differently: have anyone seen guide how to set-up anything in Keil from scratch? I believe that it just gets copied from one project to another because no one wants to spend half of his life to configure that ridiculously complex settings through billions of windows and list boxes;) Sorry for being sarcastic but I couldn't resist.

    I actually believe that it's covered in this old blog post for nRF51, just note that there were changes in nRF5 SDK and Keil/ARM CMSIS dependencies/support along the road so it might influence how the Keil behaves with nRF5 packs today...

  • Yes seems like they've changed it to a .zip structure. The Keil packs are from 2015. I guess I'll just play around with the examples and stuff until I figure it out.

    One reason why I want to avoid the bloated examples is because of the 32kB limit on Keil. What development environment are you using?

  • GCC 4.9 (ARM EABI NONE), launching Makefile compilation and linking from CygWin but using Eclipse as IDE (basically just for syntax highlight project browsing, otherwise I hate Eclipse but the rest of the team is using it...) Note that I basically don't use debugger so I'm not tight to Keil or IAR or GDB in that sense, the debugging used to have major limitations on nRF1 and while it is better on nRF52 I'm having my projects stable enough that just UART/RTT print outs + BLE sniffer + logical analyzer are all I need. It can get tricky if you insist on halt/step/run debugger... (some situations like timing when BLE stack runs connection link make classic debugging very problematic, that's one of the specific of embedded programming)

  • 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.

Related