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

Problem with nRF52840 DK new project.

A month ago I bought an nRF52840 DK to start creating my own projects with the nRF52840 chip

I have created a new project in Segger Embedded Studio for the nRF52840 DK.
What I want to do is to turn on a single LED... on the board using the Nordic Libraries but without using the ready-made SDK examples.
 
Next I will enumerate the steps i have followed so far. If you see something it is wrong please let me know.

Step 1:  File > New Project... > Create the project in a new solution > A C/C++ executable for Cortex-M processor
Step 2:  Select "nRF25840_xxAA" Target Device,  Choose Common Project Settings: Target Connection J-Link, J-Link:Target Interface SWD
Step 3: Links to System Files: Checked, main.c: Checked
Step 4: Select Configurations to add to project: Release:Checked, Debug: Not Checked  and press Finish.
Step 5: Build project (OK)
Step 6: In Release Mode I added library paths to preprocessor's "user include directories" as follows:

../../../../../../modules/nrfx
../../../../../../modules/nrfx/hal
../../../../../../modules/nrfx/templates
../../../../../../modules/nrfx/templates/nRF52840
../../../../../../modules/nrfx/soc
../../../../../../modules/nrfx/mdk
../../../../../../modules/nrfx/drivers
../../../../../../modules/nrfx/drivers/include
../../../../../../integration/nrfx/
../../../../../../integration/nrfx/legacy
../../../../../../components/
../../../../../../components/boards
../../../../../../components/toolchain
../../../../../../components/toolchain/cmsis/include
../../../../../../components/drivers_nrf/nrf_soc_nosd
../../../../../../components/libraries/util
../../../../../../components/libraries/strerror
../../../../../../external/fprintf
../../../../../../external/segger_rtt
../../../../../../config/nrf52840/config
../../../../../../config/nrf52840/ses
../../../../../../config/nrf52840/armgcc

Step 7: I added the "nrf_gpio.h" (from path modules\nrfx\hal\nrf_gpio.h in the SDK) to the project items window
Step 8: included the nrf_gpio.h with #include <nrf_gpio.h> in the main.c
Step 9: Build the project but an error occured -----> Error: nrf_gpio.h: No such file or directory

Next I attach the main .c code

#include <stdio.h>
#include <stdlib.h>
#include <nrf_gpio.h>     //The GPIO Hardware Abstraction Layer (HAL)
#include <nrf_delay.h>   //For basic delaying functions
#include <pca10056.h>    //GPIO definitions for the nRF52840-DK (aka pca10056)

int main(void)
{
    /* Configure pin 13 as standard output. */
    nrf_gpio_cfg_output(BSP_LED_0); //BSP_LED_0 is pin 13 in the nRF52840-DK

    /* Toggle LED1. */
    while (true)
    {
            
            nrf_gpio_pin_write(BSP_LED_0,1); 
            nrf_delay_ms(500); // On time 
            nrf_gpio_pin_write(BSP_LED_0,0);
            nrf_delay_ms(500);// Off time 
    }
}


I Followed the infocenter.nordicsemi.com/.../getting_started_ses.pdf tutorial. Then
I read other posts in devZone indicating the same or similar problem.
Unfortunately no clear solution has been given in those posts.

Please give me a step by step explanation on what I am doing wrong. And how to fix things.
And please don't tell me about the Nordic starting guides because they work only with ready made examples.

The following image shows the build result

Parents Reply Children
Related