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

How to get heart rate monitor to work on nRF52840-DK in Ubuntu 18.04

I've been using STM32 controllers with LoRaWan mostly GNU based and bare metal. Recently, I have been looking at the STM Nucleo STMWB32 communicating with a Raspberry Pi and I have it working but not well. Recently, Kevin Townsend (I just purchased his book) suggested I look into using Zephyr and also recommended Nordic devices. Based on his recommendation, I have been trying to get an nRF25840-DK started but despite spending considerable time, I can't get through the very first simplest step of downling the hex onto the device and running it. I do have the App installed, but am pretty sure the hex is not running. Setup: Ubuntu 18.04:

> uname -a
Linux granite10192.168.1.23 4.15.0-96-generic #97-Ubuntu SMP Wed Apr 1 03:25:46 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

The getting started guide suggests copying the hex to the drive folder that opens when the device is connected, and that the app will start automatically. The drive opens, I copy the hex, but it doesn't start. Pushing button 1, the LED 1 is supposed to blink once a second showing advertising. It doesn't. I have attempted to load the hex using the nRF Connect v3.3.3. programmer and writing the hex to the device and then re-reading the device. This seems to work (see log below), but I can not get the program to run.

From the getting started guide:

1.2.Download the Heart Rate Monitor (HRM) demo application from nRF52840 DK Downloads, nRF52833
DK Downloads, or nRF52 DK Downloads and extract it into a folder of your choice.
Power up the development kit:
a) Connect one end of a micro-USB 2.0 cable to the Universal Serial Bus (USB) connector on the kit
and the other end to one of your PC's USB host ports.
b) Slide the power switch to ON.
3.Observe that LED1 starts blinking.

LED1 does not start blinking.

I disconnected from the Connect programmer, and once again tried copying heart_rate_demo.hex to the USB drive, the folder closed, a second opened, the file had disappeared, but pushing button 1 did nothing.

I downloaded Segger Embedded Studio and tried going through their getting started guide, but go stuck at:

CMakeLists.txt - the location of the CMakeLists.txt project file of the sample that you want to work with (for example, the full path to ncs/nrf/applications/asset_tracker/CMakeLists.txt)

I can not find the path to ncs/nrf/applications/asset_tracker/CMakeLists.txt.

I looked in my $HOME/.config/nrfconnect/ but can not find anything there. I also used locate but couldn't find ncs/nrf/applications.

> ls $HOME/.nrfconnect-apps/
.          local                  pc-nrfconnect-gettingstarted.svg  pc-nrfconnect-rssi.svg
..         node_modules           pc-nrfconnect-linkmonitor.svg     pc-nrfconnect-toolchain-manager.svg
apps.json  pc-nrfconnect-ble.svg  pc-nrfconnect-ppk.svg             pc-nrfconnect-tracecollector.svg
external   pc-nrfconnect-dtm.svg  pc-nrfconnect-programmer.svg      updates.json
> ls $HOME/Dropbox/Nordic/arm_segger_embedded_studio_v452_linux_x64_nordic
.  ..  bin  gcc  html  include  lib  llvm  packages  samples  source  targets
Next I tried:

> cd /
> sudo find . -iname CMakeLists.txt

this found lots of CMakeLists.txt, but none under an ncs/nrf/applications tree.

I also downloaded Zephyr and in $HOME/Dropbox/Nordic/Zephyr/zephyrproject/zephyr I can see some CMakeLists.txt file, but I can't figure out how to use this to get started. I can see some examples, but under the board folders, there doesn't seem to be anything for the nRF52840 DK.

I have used openocd quite a bit and have no problem with it, but I have not used JLink previously. I have purchased a Segger USB debugger, but until I get at least something to run on the nRF52840-DK, I don't really know how to get started with this.

Finally, should I be using nRF Connect, or Zephyr, or Segger Embedded Studio, or $HOME/Dropbox/Nordic/s11/  or $HOME/Dropbox/Nordic/nRF_CLTools/ or nRF SDK tools? or do I need to try them all first? Or should I just try to take a bare metal approach with GNU gcc and gdb, something I am familiar and comfortable with, and it does seem there may be some examples under $HOME/Dropbox/Nordic/s11/?

Finally, am I the only one having problems like this? How where others successfully able to get over this very simple "Getting Started" step? I always thought the point of using "Getted Started" projects was to make getting started easy; I guess I was sadly mistaken.

2020-05-20T22:10:04.472Z INFO Parsing HEX file:  /home/martin/Dropbox/Nordic/heart_rate_demo/heart_rate_demo.hex
2020-05-20T22:10:04.571Z INFO File was last modified at  11/03/2016, 10:18:22
2020-05-20T22:10:04.712Z INFO SoftDevice detected, id 0x81 (S132 v2.0.0)
2020-05-20T22:11:38.148Z VERBOSE Could not fetch serial number for serial port at /dev/ttyACM0
2020-05-20T22:11:42.437Z VERBOSE Could not fetch serial number for serial port at /dev/ttyACM0
2020-05-21T20:29:49.011Z VERBOSE Could not fetch serial number for serial port at /dev/ttyACM0
2020-05-21T20:31:21.736Z VERBOSE Could not fetch serial number for serial port at /dev/ttyACM0
2020-05-21T20:36:40.552Z VERBOSE Could not fetch serial number for serial port at /dev/ttyACM0
2020-05-21T21:10:32.857Z VERBOSE Could not fetch serial number for serial port at /dev/ttyACM0
2020-05-21T21:26:07.387Z VERBOSE Could not fetch serial number for serial port at /dev/ttyACM0
2020-05-25T18:19:17.044Z INFO Using nrfjprog to communicate with target
2020-05-25T18:19:19.277Z INFO Using J-Link Software version 6.72
2020-05-25T18:19:20.599Z INFO Segger serial:  683455871
2020-05-25T18:19:20.600Z INFO Segger speed:  2000  kHz
2020-05-25T18:19:20.600Z INFO Segger version:  J-Link OB-SAM3U128-V2-NordicSemi compiled Mar 17 2020 14:43:00
2020-05-25T18:19:20.612Z INFO Core probed: 683455871.
2020-05-25T18:19:20.612Z INFO Core RAM: 256KiB.
2020-05-25T18:19:20.612Z INFO Core ROM: 1024KiB in pages of 4KiB.
2020-05-25T18:19:20.741Z INFO Model: NRF52840_xxAA_REV1.
2020-05-25T18:19:22.137Z INFO Core0: Reading device non-volatile memory. This may take a few seconds.
2020-05-25T18:19:22.211Z INFO Core0: UICR has been read. Click read button to read full non-volatile memory.
2020-05-25T18:19:22.349Z INFO SoftDevice detected, id 0x81 (S132 v2.0.0)
2020-05-25T18:19:26.185Z INFO Using nrfjprog to communicate with target
2020-05-25T18:19:27.497Z INFO Using J-Link Software version 6.72
2020-05-25T18:19:28.808Z INFO Segger serial:  683455871
2020-05-25T18:19:28.808Z INFO Segger speed:  2000  kHz
2020-05-25T18:19:28.809Z INFO Segger version:  J-Link OB-SAM3U128-V2-NordicSemi compiled Mar 17 2020 14:43:00
2020-05-25T18:19:28.819Z INFO Core probed: 683455871.
2020-05-25T18:19:28.819Z INFO Core RAM: 256KiB.
2020-05-25T18:19:28.819Z INFO Core ROM: 1024KiB in pages of 4KiB.
2020-05-25T18:19:28.949Z INFO Model: NRF52840_xxAA_REV1.
2020-05-25T18:19:30.215Z INFO Core0: Reading device non-volatile memory. This may take a few seconds.
2020-05-25T18:19:44.281Z INFO Core0: Non-volatile memory has been read. 5 non-empty memory blocks identified
2020-05-25T18:19:44.404Z INFO SoftDevice detected, id 0x91 (S132 v3.1.0)
2020-05-25T18:19:44.408Z INFO SoftDevice detected, id 0x81 (S132 v2.0.0)

  • Also, going through the install procedure a second time broke Zephyr as well. Took another couple of hours to fix. It had to do with the tool chain got installed as ~/gnuarmemb/gcc-arm-none-eabi-9-2019-q4-major rather than just ~/gnuarmemb with bin directly under it. This puts me back to where I ended yesterday. Blinky and Button in Zephyr work if after flashing board is disconnected and re-connected and I still don't understand what nRF SDK is and just can't get heart_rate_monitor to work. It looks best to give up on nRF SDK for now and just try to get the Zephyr tool chain working.

  • Is there a link to using the Portal? I spent two hours this morning on putting together an extensive reply and when posted it got flagged as SPAM and seems to have disappeared. I can't figure out how to have what I type automatically wrapped. I can't figure out how to find links for replying. I can't figure out how to upload an attachment. Thank you.

  • Hi,

    Your long reply was marked as spam, but I have approved it now. Please try to avoid copy-pasting with formating in the future, as that makes it less readable and also tends to increase the likelihood of the post being tagged as spam.

    To be honest, I think the best here is to start again from scratch. As you stated that you did not actively decide to use the nRF Connect SDK, then I advise against it. It is not as mature, nor yet as userfriendly as the nRF5 SDK. Also, the nRF5 SDK works with integrated toolchains.

    If you are developing for the nRF52 I suggest you follow Getting started with nRF5 SDK and SES (nRF51 & nRF52 Series). Please read and follow the full guide, but these are the key points:

    • Download the latest nRF5 SDK here (currently version 16.0.0).
    • Download and install the J-Link Software and Documentation Pack from here.
    • Download the latest Segger Embedded Studio (SES) here.
    • Download and install the nRF Command Line tools from here.

    Please note that the guide includes information on how to import Keil projects to SES, but that is not relevant for you, since recent SDK versions include SES projects for all examples. So after having the toolchain in place you simply just open the example in SES, build, program, and observe it work.

  • Also, if this helps some others: with David Martin's help I finally realized that many of the Nordic links are actually two links, the left one goes one place, and the right triangle goes a different place (usually a drop-down - and it's the one you need most of the time). I had idea of this, and it's truly critical. Finally, for newbies, it would really help, if the importance and value of the infocenter.nordicsemi.com was emphasized (and note infocenter.nordic.de is a bogus site). Maybe once I get everything up and running properly, I should write a proper how to? Just a thought.

  • Einar, I have started to put together a pdf document with hyperlinks based on your suggestions, and adding some details for Linux to make it easier getting future university projects started. I could upload it to you if you could give me instructions on how to do an upload (in case you are interested).

Related