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,

    It seems the root issue here is that you have not properly installed the toolchain including all dependencies. Please follow the instructions on this page to the point, not omitting any steps.

    Yes, but I only found this page yesterday, after a week of work

    Most of the instructions don't work; for example just down-loading the device tree compiler:

    > wget http://mirrors.kernel.org/ubuntu/pool/main/d/device-tree-compiler/device-tree-compiler_1.4.7-1_amd64.deb
    --2020-05-27 09:30:37--  mirrors.kernel.org/.../device-tree-compiler_1.4.7-1_amd64.deb
    Resolving mirrors.kernel.org (mirrors.kernel.org)... 149.20.37.36, 2001:19d0:306:6:0:1994:3:14
    Connecting to mirrors.kernel.org (mirrors.kernel.org)|149.20.37.36|:80... connected.
    HTTP request sent, awaiting response... 301 Moved Permanently
    Location: mirrors.edge.kernel.org/.../device-tree-compiler_1.4.7-1_amd64.deb [following]
    --2020-05-27 09:30:37--  mirrors.edge.kernel.org/.../device-tree-compiler_1.4.7-1_amd64.deb
    Resolving mirrors.edge.kernel.org (mirrors.edge.kernel.org)... 147.75.197.195, 2604:1380:1:3600::1
    Connecting to mirrors.edge.kernel.org (mirrors.edge.kernel.org)|147.75.197.195|:80... connected.
    HTTP request sent, awaiting response... 404 Not Found
    2020-05-27 09:30:37 ERROR 404: Not Found.

    >

    I had set up the gnuarmemb previously for Zephyr

    export ZEPHYR_TOOLCHAIN_VARIANT=zephyr
    export ZEPHYR_SDK_INSTALL_DIR=/home/martin/Dropbox/Nordic/Zephyr/zephyr-sdk-0.11.2

    The new setup uses

    export ZEPHYR_TOOLCHAIN_VARIANT=gnuarmemb
     export GNUARMEMB_TOOLCHAIN_PATH="~/gnuarmemb"


    The Zephyr set up is working, should I still change it? I will for now just to be sure I'm compatible.

    It is not possible to successfully install the requirements following instructions on the page you suggest
    For example,
     pip3 install --user -r zephyr/scripts/requirements.txt
    has many lines of text and then does a core dump.
    ...
    many lines
    ...
    Successfully installed Click-7.1.2 MarkupSafe-1.1.1 Pillow-7.1.2 PyYAML-5.3.1 Pygments-2.6.1 alabaster-0.7.12 anytree-2.8.0 appdirs-1.4.4 arrow-0.15.5 attrs-19.3.0 babel-2.8.0 breathe-4.14.2 cbor-1.0.0 certifi-2020.4.5.1 cffi-1.14.0 chardet-3.0.4 cmsis-pack-manager-0.2.10 colorama-0.4.3 configobj-5.0.6 coverage-5.1 docopt-0.6.2 docutils-0.16 future-0.18.2 gcovr-4.2 gitlint-0.13.1 idna-2.9 imagesize-1.2.0 importlib-metadata-1.6.0 intelhex-2.2.1 intervaltree-3.0.2 jinja2-2.11.2 junit2html-23 lxml-4.5.1 milksnake-0.1.5 more-itertools-8.3.0 packaging-20.4 pluggy-0.13.1 ply-3.11 prettytable-0.7.2 psutil-5.7.0 py-1.8.1 pycparser-2.20 pyelftools-0.26 pykwalify-1.7.0 pylink-square-0.6.1 pyocd-0.26.1 pyparsing-2.4.7 pyserial-3.4 pytest-5.4.2 python-dateutil-2.8.1 pytz-2020.1 pyusb-1.0.2 requests-2.23.0 setuptools-46.4.0 sh-1.12.14 six-1.15.0 snowballstemmer-2.0.0 sortedcontainers-2.1.0 sphinx-3.0.4 sphinx-rtd-theme-0.4.3 sphinx-tabs-1.1.13 sphinxcontrib-applehelp-1.0.2 sphinxcontrib-devhelp-1.0.2 sphinxcontrib-htmlhelp-1.0.3 sphinxcontrib-jsmath-1.0.1 sphinxcontrib-qthelp-1.0.3 sphinxcontrib-serializinghtml-1.1.4 sphinxcontrib-svg2pdfconverter-1.0.1 tabulate-0.8.7 urllib3-1.25.9 wcwidth-0.1.9 west-0.7.2 zipp-3.1.0
    Segmentation fault (core dumped)
    >
    pip3 install --user -r nrf/scripts/requirements.txt
    
    successfully completes, but
    > pip3 install --user -r mcuboot/scripts/requirements.txt
    Could not open requirements file: [Errno 2] No such file or directory: 'mcuboot/scripts/requirements.txt'

    I am in the ncs directory when I do this command as instructed. Has anyone ever tried the installation
    instructions on Ubuntu 18.04 previously? It appears the mcuboot directory has not been downloaded and I
    can't fine instructions on how to do this. (aside, I've gotten into a weird formatting mode again -
    I keep clicking Format->Clear Formatting, but it doesn't help).

    Doing some google searching, I found mcuboot was under the bootloader directory, which I can see. So I
    modified the pip3 command to run the the script their, but once again, I got a core dump. It appears
    installation instructions just can not be followed successfully on my machine for some unknown reason.

    > pip3 install --user -r bootloader/mcuboot/scripts/requirements.txt
    Collecting cryptography>=2.6 (from -r bootloader/mcuboot/scripts/requirements.txt (line 1))
      Using cached files.pythonhosted.org/.../cryptography-2.9.2-cp35-abi3-manylinux1_x86_64.whl
    Collecting intelhex (from -r bootloader/mcuboot/scripts/requirements.txt (line 2))
      Using cached files.pythonhosted.org/.../intelhex-2.2.1-py2.py3-none-any.whl
    Collecting click (from -r bootloader/mcuboot/scripts/requirements.txt (line 3))
      Using cached files.pythonhosted.org/.../click-7.1.2-py2.py3-none-any.whl
    Collecting cbor>=1.0.0 (from -r bootloader/mcuboot/scripts/requirements.txt (line 4))
    Collecting six>=1.4.1 (from cryptography>=2.6->-r bootloader/mcuboot/scripts/requirements.txt (line 1))
      Using cached files.pythonhosted.org/.../six-1.15.0-py2.py3-none-any.whl
    Collecting cffi!=1.11.3,>=1.8 (from cryptography>=2.6->-r bootloader/mcuboot/scripts/requirements.txt (line 1))
      Using cached files.pythonhosted.org/.../cffi-1.14.0-cp36-cp36m-manylinux1_x86_64.whl
    Collecting pycparser (from cffi!=1.11.3,>=1.8->cryptography>=2.6->-r bootloader/mcuboot/scripts/requirements.txt (line 1))
      Using cached files.pythonhosted.org/.../pycparser-2.20-py2.py3-none-any.whl
    Installing collected packages: six, pycparser, cffi, cryptography, intelhex, click, cbor
    Segmentation fault (core dumped)
    >

    Regarding:
     Please remember to follow the link to this page and do as told there as well. If you follow the instructions to the point then you should get a working setup. Linux is well supported as a platform for the nRF Connect SDK (in fact, Linux is the preferred platform for most Zephyr developers).
    I had done this previously, very carefully (again I've been working on getting started for a week now)
    but I redid it to be safe. This reverted cmake back to a too early version so I had to go through the
    process again of getting a recent version of cmake. About half of the suggested procedures don't work so
    I eventually went to cmake downloads and got version 3.17.2. I had previously installed Segger Embedded
    Studio, and this is a large convoluted procedure, and it was successful before, so I didn't want to go
    through it again, but I assume it's okay. So I may (or may not) be setup okay now. The biggest worry is
    the core dumps above.

    Regarding:
    I have one question, though. Are you purposely using nRF Connect SDK, or did you just end up there accidentally? The preferred SDK for nRF52 series development is currently the nRF5 SDK, which is more mature and easier to get started with.
    (I really wish I could figure out how to get line wrap working).
    The answer is no, I have been asking about four times which Tool Chain to use. Indeed, I don't even know
    what the nRF SDK Tool Chain is. There's the Zephyr Took Chain, the Segger Took Chain, the Connect Tool
    Chain, and now the SDK Took Chain. This is the first I've seen that the recommend chain is the SDK one.
    Now that I assume I have it installed, is there documentation on how to run it? I assume it's under
    ncs/nrf? Is there a binary eclipse like gui to run there? Or should I be running the Zephyr GUI?
    Very unclear to me. My best guess is the SDK Tool Chain is the Zephyr Tool Chain? I have only been
    running Connect because previously that was the only thing I could get going (actually the Zegger Tool
    Chain might also be working but I so far have not been able to figure out how to run the SDK Tool Chain.
    Just installing it has been a real bear; but I think I may now have it installed (except again for the
    core dumps above).

    So I guess the next think is to try and find a) exactly what the SDK Tool Chain is (i.e. is it the
    Zephyr Tool Chain), and b) where I should start reading to see how to run it.









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

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

Children
No Data
Related