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

Test program not working in Custom Board

Hi Nordic Forum!

I've been trying to run a test program (pin toggle) on a custom nRF52832 board.

First, I tried the same program on the HDK to toggle pin P0.17 (LED1) and verified that it worked.

But then, when I tried on my custom board (but on pin P0.13) nothing happens. Later I tried to flash the same program but toggling pin P0.10 and measure it directly with a tester on the MCU contact, and again, I got a toggling pin on my HDK and nothing on my custom board.

Since I had some problems flashing my board in the beginning, I did a memory dump of my board, using nrfjprog --readcode after flashing the same program with a small difference (the pin number) and verified that both files were different, so my custom board seems to be flashing.

Our hardware designer seems to be sure the design is fine. Does anyone has experienced similar problems? Is there any code or base firmware I have to load first before my application?

Here's a sample code of the test program:

#include <stdbool.h>
#include <stdint.h>
#include <string.h>
#include "nordic_common.h"
#include "nrf.h"
#include "app_error.h"
#include "nrf_delay.h"
#include "SEGGER_RTT.h"
#include "nrf_gpio.h"

/**@brief Function for application main entry.
 */

int main(void) {

    nrf_gpio_cfg_output(10);
    nrf_gpio_pin_clear(10);

    for (;;) {
        nrf_gpio_pin_toggle(10);
        SEGGER_RTT_printf(0, "Hello World! \n");
        nrf_delay_ms(1000);
    }
}

As an additional comment, the SEGGER_RTT_printf doesn't work either. When I run it on the HDK, it works, but not on the custom board. This caught my attention because if my board is flashing, the SWDIO and SWDCLK are working, and the RTT runs on that.

Parents
  • Solved the problem.

    In the end, the problem was that I didn't have a 32KHz crystal on my custom board. After I changed the source of the Low-Frequency Clock by writing the register, it worked.

    Afterward, I just added the correspondent definition of the clock source in my custom board header file and deleted the Low-Frequency Clock initialization.

    As a general comment, If you're going to drop the 32KHz crystal, don't forget to add the following line in the custom_board.h

    #define NRF_CLOCK_LFCLKSRC      {.source        = NRF_CLOCK_LF_SRC_RC,              \
                                     .rc_ctiv       = 16,                               \
                                     .rc_temp_ctiv  = 2,                                \
                                     .xtal_accuracy = NRF_CLOCK_LF_XTAL_ACCURACY_20_PPM}
    

    The rc_ctiv and rc_temp_ctiv parameter where configured acording to this.

  • Thats interesting.

    BTW. I had other bizarre issues, when some one gave me 32.000 Khz crystals to fit on their board, but the value is supposed to be 32.768khz I cant exactly remember what happened, but I remember the code appeared to run, but did not run correctly ;-)

Reply Children
No Data
Related