Problems with running the HRM example (ANT+)

Hello.

I bought an nRF5340 DK board and am trying to run the HRM example (which uses the ANT+ protocol) on it. The standard (create a new application -> copy a sample) blinky starts and works well, while the standard HRM_TX does not work.
I'm getting an error related to ANT+ initialization (hrm_tx: ant_plus_key_set failed: -63).
I have an ANT+ key that I got from thisisant.com and I tried writing it into the prj.conf file and the ant_rpc.conf file (adding the line "CONFIG_ANT_LICENSE_KEY=xxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxx -xxxx"). When it didn’t work out for me, I set “CONFIG_ANT_EVALUATION_KEY=y”.
What is this error? How to fix it?

I installed everything strictly according to the instructions from the video: https://youtu.be/yg2p-scEyUA (except for the last step since I couldn't open Kconfig —> Menuconfig, see screenshot below)

Thanks in advance, Victor

Parents
  • Hello,

    Please check out the following information:
    https://www.thisisant.com/APIassets/ANTnRFConnectDoc/doc/integration_notes.html#license-keys 

    For the nRF5340 the following applies:

    "If using the dual core automatic child image, the radio-adjacent or network core image (cpunet) configuration file will be either child_image/ant_rpc.conf or child_image/hci_ipc.conf."

    As a first step you can try to comment out the CONFIG_ANT_LICENSE_KEY setting and just using CONFIG_ANT_EVALUATION_KEY=y as a check for your build environment and HW. Any difference if you modify the existing example as-is (without create a new application)?

    Kenneth

  • В качестве первого шага вы можете попытаться закомментировать параметр CONFIG_ANT_LICENSE_KEY и просто использовать CONFIG_ANT_EVALUATION_KEY=y в качестве проверки вашей среды сборки и аппаратного обеспечения. Есть ли разница, если вы измените существующий пример как есть (без создания нового приложения)?

    That's exactly what I do.
    Take a close look at the second screenshot I attached to my post above.
    This is the file "child_image/ant_rpc.conf", I deleted the line with my ANT key (CONFIG_ANT_LICENSE_KEY), and also specified the parameter CONFIG_ANT_EVALUATION_KEY=y
    What am I doing wrong?

    Let's go through the stages of creating a new project with you.
    1) I create a new project, select "Copy a sample", I open it in a new VS window

    2) I go to the file "child_image/ant_rpc.conf", there I change to "CONFIG_ANT_EVALUATION_KEY=y"

    3) Then I create a new build. Just select nRF5340DK and click "build".

    4) The last step is I connect my board and click "Flash"

    It writes to me, saying that the device is programmed. Should work, right?

    Interestingly, this time I didn't get any errors. This is great!
    After waiting a couple of minutes, I still couldn't find my board using the Garmin Edge device.

    I'll translate: it says "To connect to the heart rate monitor, wear it".
    At this time, an error related to Ant+ is written on VCOM0:

    So what kind of error is this? Maybe my sequence of actions is incorrect? Maybe I'm missing something?
    <err> ant_init: ant_stack_init() failed: -22
    <err> ant_rpc_net: cmd handler missing cb

  • I built your project, tried to run it on my board - I get the same error "<err> ant_init: ant_stack_init() failed: -22", "<err> ant_rpc_net: cmd handler missing cb"

    I also tried running it in debug mode.

    The program stops at this point.

    I have a big request to ask you - if you don’t know how to help me with this problem, please refer me to another employee of yours.
    I really don't want to ask new questions, but I have to, since I bought a NEW board and can't run the example code, I don't think it should be this way.

    I will look forward to your help.
    Sincerely, Victor.

  • In this particular case I recommend to ask for support on https://www.thisisant.com/ , they are the ones that both develop the ANT stack and licensing, and should be best able to look into your problems with -NRF_EINVAL (ANT License Key argument is invalid).

    Maybe you can see a difference between our views when buildling:

    Kenneth

  • Hello, I am from the ANT team. I'd like to check two things first to help diagnose your issue.

    1. In the ANT folder, ie. C:\ncs\v2.6.0\ant, please run a "git status" and make sure that there are no local changes to the repository that might be affecting what is passed to the ant_init() function.

    2. Ensure the license key is propagating correctly through Kconfig. One way to double check this is to check the autoconf.h file that is generated as part of the build. For nRF5340 network core, this file is located at this relative path: 

    hrm_tx\build\ant_rpc\zephyr\include\generated\autoconf.h

    Can you confirm the following is being set as expected?

    #define CONFIG_ANT_LICENSE_KEY "license-string"

    The string that follows CONFIG_ANT_LICENSE_KEY is passed directly to the initialization function and should exactly match the evaluation key defined here: https://github.com/ant-nrfconnect/sdk-ant/blob/main/init/Kconfig#L13

  • Good afternoon.
    I really hope that you can help me!

    1. I checked “git status” in the folder you specified, the following error occurred:

    C:\ncs\v2.6.0\ant>git status
    HEAD detached at 39a2222
    Changes not staged for commit:
    (use "git add <file>..." to update what will be committed)
    (use "git restore <file>..." to discard changes in working directory)
    modified: init/Kconfig
    
    no changes added to commit (use "git add" and/or "git commit -a")

    I fixed everything (now there are no changes), but now I can’t build the project... During building I got this error:

    And this despite the fact that I have “CONFIG_ANT_EVALUATION_KEY=y” specified in the “child_image\ant_rpc.conf” file. Quite strange.
    Or is this how it should be?

    That is, there is still some nonsense with the Ant+ key.

    2. No, I have an empty line there, no key.

    #define CONFIG_ANT_LICENSE_KEY ""

    I really like your tips, I see that they bring me closer to a solution! Please help me solve the problem! I previously worked on Arduino, so I have no experience with NCS.

    I will look forward to your help.

    Sincerely, Victor.

  • Hi Victor,

    Thanks for running these steps! I think we're getting there.

    The build log shown is for an nRF52840. If you are building for nRF52840, the license key needs to be set in prj.conf. Since it is a single core chip this is the only configuration file that applies (there is no child_image in this case and ant_rpc.conf is unused).

    If you are intending to build for your nRF5340, child_image/ant_rpc.conf is the correct file for the license switch. Use "Add Build Configuration" to set up a new build for board nrf5340dk_nrf5340_cpuapp. This will use the child_image feature to automatically build for the network core based on the configurations in the ant_rpc.conf file.

    Let me know if this works!

Reply
  • Hi Victor,

    Thanks for running these steps! I think we're getting there.

    The build log shown is for an nRF52840. If you are building for nRF52840, the license key needs to be set in prj.conf. Since it is a single core chip this is the only configuration file that applies (there is no child_image in this case and ant_rpc.conf is unused).

    If you are intending to build for your nRF5340, child_image/ant_rpc.conf is the correct file for the license switch. Use "Add Build Configuration" to set up a new build for board nrf5340dk_nrf5340_cpuapp. This will use the child_image feature to automatically build for the network core based on the configurations in the ant_rpc.conf file.

    Let me know if this works!

Children
Related