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)

Parents
  • Hi,

    There seem to be at least two separate problems here:

    1. Getting a prebuilt example hex to run properly on the nRF52840 DK.
    2. Building an nRF Connect SDK sample from scratch using Segger Embedded Studio

    Regarding 1, I do not understand why it does not work. Can you try the attached blinky example (blinky_pca10056.hex) just to understand if the very basic is in place?

    Regarding 2:

     

    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.

    First of all, the asset tracker sample only works on the nRF91. But in any case, if you have correctly checked out the nRF Connect SDK you should see CMakeLists.txt under nrf\applications\asset_tracker\. As you can see here it is part of the repo, so I cannot understand how it could be missing. But since you cannot use it anyway, I suggest you start with a sample that can actually run on your board.

    I suggest starting with something very basic, for instance zephyr/samples/basic/blink_led. Just to see that you have everything in place I suggest doing it from the command line. Then, after following the getting started guide to install dependencies, check out the nrf repo and update everything with west, you can build the sample by simply navigating to zephyr/samples/basic/blink_led/ (or any other sample folder) and typing:

    west build -b nrf52840_pca10056

    Then you can program the sample by typing:

    west flash

    With this, you should see LED1 blinking with varying frequency.

    Does this work?

  • I couldn't even find the ncs/nrf directory. However, I was just able to resolve this issue: by chance, I ran nrfconnect331x8664.AppImage again, and then noticed near the bottom the ToolChain Manager choice. I clicked this and was informed the app was for windows only, but there was a link there for installing in Linux. Clicking this link brought me to a new web page I hadn't seen previously, and there were enough instructions there so I have been able to download and install the AMD64 device tree compiler (this link is broken in the instructions but I was able to get it directly from a Debian repository and install it). I also found a link that I could use with wget to finally download ncs/nrf. This was a really convoluted process but I finally can see the ncs/nrf/applications/asset_tracker path. I think it was just luck that I got to this point so maybe I can now run the Zephyr "getting started" examples.

    There are problems that might still be issues; for example, under the linux install instructions:

    pip3 install --user -r zephyr/scripts/requirements.txt

    causes a core dump.

    Sorry for the small font, clear formatting didn't fix it. Also, I don't know why it changed back to normal directly below.

    pip3 install --user -r nrf/scripts/requirements.txt
    works, but
    pip3 install --user -r bootloader/mcuboot/scripts/requirements.txt
    also causes a core dump.

    I had some success with the Zephyr tool chain. It seems to build and flash okay, but the
    examples may or may not work.
    west build -p auto -b nrf52840dk_nrf52840 samples/hello_world
    builds fine and west flash works

    > west flash
    -- west flash: rebuilding
    ninja: no work to do.
    -- west flash: using runner nrfjprog
    -- runners.nrfjprog: Flashing file: /home/martin/Dropbox/Nordic/Zephyr/zephyrproject/zephyr/build/zephyr/zephyr.hex
    Parsing hex file.
    Erasing page at address 0x0.
    Erasing page at address 0x1000.
    Erasing page at address 0x2000.
    Erasing page at address 0x3000.
    Applying system reset.
    Checking that the area to write is not protected.

    Programming device.
    Enabling pin reset.
    Applying pin reset.
    -- runners.nrfjprog: Board with serial number 683455871 flashed successfully.
    >

    but I don't see anything on the minicom connected to /dev/ttyACM0 (at 115.2kBaud).

    west build -p auto -b nrf52840dk_nrf52840 samples/basic/blinky
    seems to build okay except for the error:
    ERROR: ld.so: object 'libgtk3-nocsd.so.0' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
    which I mentioned previously.

    west flash reports success, but once again no blinking lights

    west build -p auto -b nrf52840dk_nrf52840 samples/basic/button

    builds same errors, doesn't work.

    However, by chance I disconnected the usb, reconnected, and it then worked. I went back to blinky,

    and re-built and reflashed, and then disconnected and reconnected, and all of a sudden, it
    worked. This really needs to be in the instructions. I tried again to get the hello_world going
    but no luck with this one. Also, west is using /dev/ttyACM0 so I'm not sure how a USB serial link
    can share the same USB connection? Maybe more explanation is required here? I went back
    to try and get the heart_rate_monitor going; no luck. The copied file just sat on the USB disk
    and never got loaded. I disconnected, reconnected, copied again, still no luck. I can upload the
    heart_rate_monitor hex file as you requested, but I don't see a link for uploading a file?
    DDo I need to put it somewhere that can have a link to it?
    .
    Summary, most things don't work (including I can't wrap the lines or format properly),
    instruction mostly wrong, but I did eventually get blinky and
    button to work with the disconnect and reconnect of the usb. I guess this is some progress.

    Now that I finally have ncs/nrf, I will try with them. Again, there really needs to be some
    instruction for linux users on how to do the install properly that don't leave out critical
    ssteps and that are correct, and don't core dump. I still have no idea what tool
    chain I should be using. Finally, for those not familiar with .rst files, it turns out there
    is a plug-in for sublime_text that allows them to be viewed. Another unix thing I guess.


  • I just spent over two hours replying to this e-mail, and when I posted it, was informed it was flagged as Spam.

    Very very short summary of two hours of work:

    1) Is the SDK tool chain the same as the Zephyr Tool Chain?

    2) the Linux instructions don't work, there are many errors, and two of the PIP3 commands result in core dumps.

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

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

Reply Children
No Data
Related