Setting up environment for ANT dev with nrf51


I am in the initial stages of setting up my platformio environment to develop an ANT application for the nrf51. I have some code that I participated working on a long time ago using the Keil environment that I would like to bring up, but I have forgotten most of how it works and I remember that it was kind of a pain, so I am excited that platformio seems to support this platform now. There seems to be quite a bit of support for bluetooth applications, but I am having a hard time finding much beginner-friendly info on ANT.

My plan is to learn how this all works by setting up platformio with some example code to get the toolchain all straightened out, and then attempt to port my old code that was developed under Keil.

I plan to start by getting everything running using an nrf51 dongle (has a built in segger), and then move development to a board which has an off the shelf nrf51 module, programmed with an external segger.

So far, I have got platformio running on vscode, and added the nordic nrf51 platform to it. I have made an empty pio project for the nrf51 dongle, and it compiles successfully.

Now, I need to figure out how to add an ANT softdevice. From what I have read in the bluetooth examples included with this platform, I see that platformio will add the desired softdevice to the binary and flash it if the proper build_flags are set. However, I’m having a hard time finding the list of acceptable build_flags.

Also, it seems that there are no examples for ANT included with the nrf51 platformio. So, perhaps it could be a useful exercise to port one of the ANT examples that come with the nrf5 SDK.

Here are my questions:

-Where can I find the list of acceptable build_flags to correctly include the softdevice in my platformio.ini?
-Can anybody recommend an example application from the nordic SDK that would be a good candidate for porting to platformio as a learning exercise?
-Is this whole thing maybe not a good idea for platformio since none of the ant examples from Nordic use ardunio or mbed framework?
-Any other resources that would be helpful?

Thank you! I’ve had a great time using platformio/vscode for other embedded development, and would really like to be able to use it for this project too.

Hi @405nm! Unfortunately, there is no support for Nordic SDK at the moment, only Arduino and mbed frameworks. There are some Arduino libraries for communicating with ANT devices, e.g. GitHub - cujomalainey/ant-arduino: An implementation of a ANT driver for Arduino, Mbed and ESP-IDF. But I’m not sure it’s suitable for your project. Another option would be to incorporate Nordic SDK as a separate library but it requires some advanced skills from the developer (here is an example of complex library with vendor SDK, BSP, FreeRTOS).

Oh man! Well, thanks for the info. Maybe I’ll look into falling back to xbee radios for this particular project, the volume i am making is not super high. Thanks for the resources though, will check them out.

Hi @405nm, I have been trying to get that very thing to work for a while with nRF51/52 boards. Unfortunately the licensing for the ANT softdevice makes it very hard to integrate into these systems as the softdevice (and headers) cannot be shared (at least last time I asked they said that.) That means the much easier solution is to purchase the D52 modules and interface with the radios externally similar to the XBees.

Figure i should probably update this thread. I worked with @orrmany and some other community members and ant-ardiuno (and by extension antplus-arduino) now support nrf52 boards. @orrmany has an excellent example posted on his blog and hosts some SD ready packages to modify the bootloader and bsp for the adafruit nrf52 express board to be loaded with the S340.

Yes, albeit now I have build issues with PlatformIO 5.x core. :frowning:
@cujomalainey, do you succeed with building the ANT+ code with the new core?

Not yet, but have you rebased on the latest nRF52 release? I think i saw one with minor 5.x fixes

Just a late update, I got antplus-arduino working back in october/november on the softdevice. So you can import my lib and start using it with the ANT+ profiles right away