Code won't run until hitting the reset button


#1

Blinky sample ran successfully on the BLE NANO v2 a few weeks ago, but now a newly compiled one with no code change won’t run (blink) until I hit the reset button on the DAPLINK kit.

Precompiled Blinky sample from Redbear (hex file) will blink right away when it gets power.

I’m using MBED, nRF52-DK platform selected

code:
#include “mbed.h”

DigitalOut led1(P0_11);
int main() {
while (true) {
//pc.printf(“Blink! LED is now %d\r\n”, led1.read());
led1 = !led1;
wait(0.5);
}
}


#2

Seems that this is the cause:
“Version 0219. Source: https://github.com/NordicSemiconductor/CMSIS-DAP/tree/V0219
Please note that there is a behaviour change between this firmware and the J-Link firmware - with the mbed firmware you must press the ‘BOOT/RESET’ button the board to run your code once it has been downloaded *”

How can I emulate the press on the BOOT/RESET button when not connected to the DAPLINK?
By the way, this is a huge undocumented piece of info. I mean, I would expect this to be in a getting started manual by Red Bear and not in the DAPLINK page in mbed’s website.


#3

Thank you for pointing out this, by default, RedBear DAPLink has been set to auto-reset “ON” by default for firmware uploading, it is not the same as mentions here:

It is not related to the Nordic’s case and also, mbed firmware and the test firmware from RedBear will not affect this behavior. In the mean time, you can try to follow the MSD_COMMANDS.md to set it. RedBear will try to find out the reason as you point out, we hope there is not something missing during the production.

Thanks again and we will get back to you soon.


#4

Hi,

Did you get this resolved? We tested and it works as expected, it is default set to auto reset “ON” during mass production.


#5

No.
The blinking hex from your github starts when the board gets powerred. But when building the example in mbed, the code will start to run only when presseing the RESET/BOOT button. I suspect this is an issue with the mbed library/os or mbed board specific code.
Please try to build the blinky example in mbed, flash the board, then unplug and re-plug the board, the code won’t run until reset/boot is pressed.


#6

Hi,

I tested my BLE Nano 2 with DAPLink 1.5 to load the mbed firmware, it also works fine.

So strange it did not work for you. Please try the one I sent in the private message.


#7

Your program starts blinking when there’s power.
However, if I create a new program in embed by importing the blinky template, it will start blinking only when I hit the RESET button. Did you try creating one from scratch?
I posted it here:
https://os.mbed.com/users/matanshapira/code/mbed-os-example-blinky123/


#8

I also need to know how to have the Nano 2.0 start running a program when power is applied, and currently it doesn’t start running a program until the reset button is pressed. The redbear DAPlink board is v1.5.


#9

I’ve got a similar issue.

If I upload the HRM codes with Arduino IDE, BLE nano works fine when I power it with batteries via VIN or replug the DAPlink.
But when I upload the codes with mbed, basilly the same codes, BLE service does not start in a correct way when I power it with batteries via VIN or replug the DAPlink. It only works immiediately after drag & drop the hex file, or after pushing the RESET button. Absolutely not working with the batteries.

Something is wrong here.


#10

Please try the steps below:

  1. Plug your DAPLink in to your computer, it will show you a new disk named DAPLink;
  2. Keep pressing the button on the DAPLink;
  3. Open the DAPLink disk and new a folder auto_rst.cfg;
  4. It will prompt that if you are going to apply the config, choose yes and then it reset automatically.
  5. Now you can release the button and try drag and drop an application hex file to the DAPLink to see if it resets the Nano2 automatically.

Best regards,
Guohui


#11

Sorry, I do not quite understand what is the problem. Not reseting the Nano2 after deploying the application? Or not working if powered by battery? Or even it did not work if uploading the hex file generated from mbed?