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

Following nRF Connect Tutorial of nRF9160 and got stuck on "west flash" on "you first Hello World"



I've been following the guide linked here and got to the point where PCA10090 is flashed with Hello World project. However, when executing "west flash" command, an error appears:

c:\Users\username\Documents\nrf_repository\ncs\nrf\samples\nrf9160\hello_world>west flash
-- west flash: rebuilding
ninja: no work to do.
-- west flash: using runner nrfjprog
Traceback (most recent call last):
File "c:\users\username\appdata\local\programs\python\python37\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "c:\users\username\appdata\local\programs\python\python37\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\username\AppData\Local\Programs\Python\Python37\Scripts\west.exe\__main__.py", line 9, in <module>
File "c:\users\username\appdata\local\programs\python\python37\lib\site-packages\west\main.py", line 583, in main
args.handler(args, unknown)
File "c:\users\username\appdata\local\programs\python\python37\lib\site-packages\west\main.py", line 334, in ext_command_handler
command.run(args, unknown, topdir, manifest=manifest)
File "c:\users\username\appdata\local\programs\python\python37\lib\site-packages\west\commands\__init__.py", line 118, in run
self.do_run(args, unknown)
File "c:\users\username\documents\nrf_repository\ncs\zephyr\scripts\west_commands\flash.py", line 32, in do_run
'ZEPHYR_BOARD_FLASH_RUNNER')
File "c:\Users\username\Documents\nrf_repository\ncs\zephyr\scripts/west_commands\run_common.py", line 288, in do_run_common
runner = runner_cls.create(cfg, parsed_args)
File "c:\Users\username\Documents\nrf_repository\ncs\zephyr\scripts/west_commands\runners\nrfjprog.py", line 50, in create
ret.ensure_snr()
File "c:\Users\username\Documents\nrf_repository\ncs\zephyr\scripts/west_commands\runners\nrfjprog.py", line 55, in ensure_snr
self.snr = self.get_board_snr_from_user()
File "c:\Users\username\Documents\nrf_repository\ncs\zephyr\scripts/west_commands\runners\nrfjprog.py", line 58, in get_board_snr_from_user
snrs = self.check_output(['nrfjprog', '--ids'])
File "c:\Users\username\Documents\nrf_repository\ncs\zephyr\scripts/west_commands\runners\core.py", line 531, in check_output
return subprocess.check_output(cmd)
File "c:\users\username\appdata\local\programs\python\python37\lib\subprocess.py", line 395, in check_output
**kwargs).stdout
File "c:\users\username\appdata\local\programs\python\python37\lib\subprocess.py", line 472, in run
with Popen(*popenargs, **kwargs) as process:
File "c:\users\username\appdata\local\programs\python\python37\lib\subprocess.py", line 775, in __init__
restore_signals, start_new_session)
File "c:\users\username\appdata\local\programs\python\python37\lib\subprocess.py", line 1178, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified


I have version v1.0.0 of Nordic Connect SDK and followed "Getting Started Assistant" for installing tools.

Could you provide assistant on why this error is appearing?

Thanks in Advance.

Parents
  • Hi there,

    Looking at that log and at the link you provided, there is only one reference to the command line tools nrfjprog and that is further down the page than Your First Hello World. Do you have the nrfjprog command line tools installed?

    The can be found here.

    Could you also post the structure of the project folder and the build directory created by west?

    What you need to flash the nRF9160 is the merged.hex file that should be located at /path/to/build/zephyr/merged.hex if the west command actually worked. There are other ways to flash the nRF9160 but you first need that file which is what nrfjprog would be looking for Wink

Reply
  • Hi there,

    Looking at that log and at the link you provided, there is only one reference to the command line tools nrfjprog and that is further down the page than Your First Hello World. Do you have the nrfjprog command line tools installed?

    The can be found here.

    Could you also post the structure of the project folder and the build directory created by west?

    What you need to flash the nRF9160 is the merged.hex file that should be located at /path/to/build/zephyr/merged.hex if the west command actually worked. There are other ways to flash the nRF9160 but you first need that file which is what nrfjprog would be looking for Wink

Children
  • Hey, thanks for your reply.

    I don't see nrfjprog listed as a step in "Getting Started Assistant", so I see no reason to believe I installed it.

    I could proceed installing nrfjprog command line tools but since it hasn't been mentioned at that step of the tutorial, it doesn't seem like the natural flow of the guide.

    I would step back and ask: What tool should be used at that step ("Your First Hello World") to flash the device? How can I configure it?

    One datapoint to the issue is that building and flashing the device using Segger Embedded Studio works just fine, whereas with West Commands build is the ony step is works.

    BTW - Here are a couple of snapshots of the project folder and the build directory:

    I don't see the merged.hex, though. Only zephyr.hex in build/zephyr.


    Thank you very much for your time!

  • nrfjprog is the Nordic command line tool for flashing devices which uses Segger JLink under the hood. Generally you do need to install this tool in order for Nordic methods of flashing devices to work. As your terminal log shows, the west command invoked nrfjprog to flash the device.

    nrfjprog doesn't need to be configured, it just needs to be installed so west can use the tool. If you are saying that SES can flash then it should be all fine but I suspect that that's because SES is using JLink to flash the ARM Cortex-M33.


    I would step back and ask: What tool should be used at that step ("Your First Hello World") to flash the device? How can I configure it?

    Ok, so I normally use ninja to build and flash from the command line, I also use a Mac so I'm not gonna know the correct format for a Windows machine.

    When I run through those steps to build the at_client example with west, I must specify that the application is non-secure, i.e. nrf9160_pca10090ns. If I run west build as they have written it in that tutorial the command fails.
    For me to make a successful merged.hex file, I must use the command:

    west build -b nrf9160_pca10090ns --pristine

    I think the command in the article builds a secure version of the application. If I run that command in SPM's (secure partition manager) folder, it will build successfully and there is no merged.hex file as expected. When building as well, ninja calculates far more tasks (e.g 1/296) when building when set to non-secure which is what I would expect for a non-secure application that must merge the secure application (SPM) and the non-secure application (custom firmware).

    All that being said, west should have tried to flash either zephyr.hex or merged.hex, the fact it didn't find the file is interesting. From a few other posts on the DevZone, the line "The system cannot find the file specified" seems to be linked to nrfjprog not being pathed on the PC which is why I would focus on that as the issue. Can you call nrfjprog from the command line, something like nrfjprog --version

  • Hey there, 

    I downloaded nrfjprog and retried flashing using west flash. It worked just fine

    What still concerns me is that I had to do one installation apart from what's incidated in "Getting Started Asisstant". Was it a installation step that I overlooked or is it nrfjprog supposed to be included in any of the installations steps? 

    The Getting Started Assistant lists the following steps to complete a setup for nRF Connect SDK:

    - Zephyr requirements and GNU ARM Embedded Toolchain
        + Install Chocolatey.
        + Install Git.
        + Install python.
        + Install Ninja.
        + Instal DTC.
        + Install GPerf
        + Install GNU ARM Embedded Toolchain.

    - clone nRF Connect SDK
        + Install West.
        + Init nrfconnect-nrf repository.
        + Installing various python modules (requirements.txt)

    - SEGGER Embedded Studio.

    These concerns are, of course, to help my-future-self/someone-else that might be stuck in this in the future. 

    Thank you very much for your time.

  • If I'm honest I looked back through all that stuff as well and didn't see it, thats one of the reasons I suggested that was the issue initially.

    This looks like a major oversight to not have a step that involves the nrfjprog tools as this also includes a bundled package of JLink which makes all this work.

    I know of nrfjprog as I have been working on nRF52s and the nRF91 for a year and a half, that's why I know about it.

  • Ok, you guys might want to consider it adding it in future versions.
    FWIW - The assistance provided solved the issue, so we're done here. 
    Thanks for everything!

Related