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

nrf52832 does not work well at power on

I download my program to PCA10040 DK board and the program will make the led1 blink two times. First I download program to flash and all work well.The led1 will blink two times and stop. But when the board power off and then power on again,the led1 will blink all the time and will not stop. At this time,I open "options for target"--"debug"--"settings" and have a look at the jlink and target cpu,then close the dialog,the program works well again! but when power off...

I try to add " while(1); " to the end of my led1 blink code. All work well,even though power off and power on again. Why? I know the function of "while(1);",but I'm sure I only make the led1 blinky two times. I'm so confused.

Parents
  • first download my code to PCA10040 DK, all work fine. There is a switch in the DK, when I switch off the board and switch on again,it goes wrong.

    int main(void)

    {

    uint8_t num = 0;

    nrf_gpio_cfg_output(18);

    while ( num < 2 )

    {

    num++;

    nrf_gpio_pin_write(18,0);

    nrf_delay_ms(500);

    nrf_gpio_pin_write(18,1);

    nrf_delay_ms(500);

    }

    // while(1);

    /***************************
    ... //other code, first comment then to test other code.

    ***************************/

    }

    what's the difference if there is a "while (1);" or not ? what I see is that led1 will blinks two times or blinks all the time? Why?

Reply
  • first download my code to PCA10040 DK, all work fine. There is a switch in the DK, when I switch off the board and switch on again,it goes wrong.

    int main(void)

    {

    uint8_t num = 0;

    nrf_gpio_cfg_output(18);

    while ( num < 2 )

    {

    num++;

    nrf_gpio_pin_write(18,0);

    nrf_delay_ms(500);

    nrf_gpio_pin_write(18,1);

    nrf_delay_ms(500);

    }

    // while(1);

    /***************************
    ... //other code, first comment then to test other code.

    ***************************/

    }

    what's the difference if there is a "while (1);" or not ? what I see is that led1 will blinks two times or blinks all the time? Why?

Children
No Data
Related