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

NRF52840 requires power cycle, HW reset, or Verify to run after flashing firmware

Hello, I've seen some similar questions about resets after downloading firmware, but haven't been able to find the solution to my problem.

I'm using a Minew MS88SF3 NRF52840-QIAA module with SDK17.0.0 with Segger Embedded Studios v4.52, messily soldered onto a custom board for a HID keyboard prototype. I've had some issues needing to resolder the module, needing to touch up some pins, but I think I've got those all sorted out so I've convinced myself it's a software issue.

Testing with the ble_hids_keyboard example (PCA10056 and S140) I can't seem to download firmware and have it run right afterwards, but only when the device had existing firmware. The problem can be succinctly summarized as:

Firmware runs successfully when:

  • Erase All followed by Download
  • Download followed by Verify
  • Download followed by pulling Reset pin low
  • Download followed by power cycling
  • Run in Debug mode

Firmware does not run when:

  • Download onto a chip with existing firmware and leaving it be

When I have RTT Viewer running during a download of a slightly modified firmware, I get this error message:

00> <info> app_timer: RTC: initialized.
00> 
00> <error> app: ERROR 8 [NRF_ERROR_INVALID_STATE] at B:\Users\[me]\Documents\NRF52_SDK17.0\nRF5_SDK_17.0.0_9d13099\examples\my_custom_projects\nrf52840_keypad_0\main.c:1497
00> 
00> PC at: 0x000315F9
00> 
00> <error> app: End of error report

Line 1496 and 1497 of main.c are as follows. It's interesting that I would get this error after a Download, but not when running it in Debug.

err_code = nrf_sdh_enable_request();
APP_ERROR_CHECK(err_code);

Otherwise, for the default hids_keyboard example, I just get this. Not sure I remember what I changed to make the error logging more verbose in my custom firmware.

00> <info> app_timer: RTC: initialized.
00> 
00> <error> app: Fatal error

Thanks!

  • Sorry if my original post was unclear, but doing Erase All followed by flashing does not result in an error. Flashing without an Erase All will result in the error though. I experience an error with all unmodified PCA10056 / S140 examples. I haven't added any code to the default examples to experience this behavior.

  • Ok, I see, sorry about the misunderstanding. So it fails when you just do Build and Run in SEGGER Embedded Studios? If so it might be something wrong with your SES installation.

    As for how to get more information in the debugging you can set DEBUG in your preprocessor definitions.

    If this is not how you flash your device, how do you do it. If you do so using I.E. nrfjprog you should indeed do an --eraseall before flashing, or else you will try to write onto existing firmware.

    Best regards,

    Simon

  • Correct, it fails when doing Build and Run or Target>Download within SES.

    Trying a different set of hardware with NRF52832 and the ble_hids_keyboard example from PCA10040 / S132, I noticed something strange. I now experience this error with the default example, but not with my modified project (attached). At this point I'm completely lost, I don't remember experiencing this issue beforehand but now apparently my modified project is the only one I don't see this error on? Is there an SES setting that I should check, or perhaps a reinstall of SES entirely?

    Sorry for the trouble and inconsistent info, I've lost track of when the problem began and on which projects, so it's hard to keep it all straight.

    ble_app_hids_keyboard_40.zip

  • Hi

    I understand, it's hard to keep track of issues like this. Sounds very strange that only the modified example runs correctly. This makes me think that either your SES installation is faulty or that one or more SDK library/driver files have been edited so that the examples no longer work as intended.

    I would try reinstalling SES first, and if that doesn't help, I would suggest trying with a fresh installation of the SDK.

    Best regards,

    Simon

  • Reinstall / Update of SES seemed to fix the issue for now. I'll be keeping an eye out for the first time this happens again if it does, but for the time being the problem is solved, so thank you! Verifying your answer

Related