nrf52840 dk to upload code to nrf52811

Hi

This is my first project to make my custom PCB. 

I have a question about how can I uploaded my code with segger embedded studio by using nrf52840 dk?

For the hardware configuration I follow the below.
(https://docs.nordicsemi.com/bundle/ug_nrf5340_dk/page/UG/dk/ext_programming_support_P20.html)

And my question is about software. For example below code work well with my nrf52840 DK (pca10056)

But how can I uploaded it to nrf52811 that is connected like above site configuration?

#include "nrf_gpio.h"
#include "nrf_delay.h"


#define LED_PIN 5        
#define BUTTON_PIN 13       

int main(void) {
    
    nrf_gpio_cfg_output(LED_PIN);
    
    
    nrf_gpio_cfg_input(BUTTON_PIN, NRF_GPIO_PIN_PULLUP);


    while (1) {
       
        
            // LED ON
            nrf_gpio_pin_set(LED_PIN);  
            nrf_delay_ms(500);          
            
            // LED OFF
            nrf_gpio_pin_clear(LED_PIN); 
            nrf_delay_ms(500);           
        
    }
}

After google search, I found the concept emulation and link below. 
But it's hard to get detail about how to do it. 

 (https://docs.nordicsemi.com/bundle/sdk_nrf5_v17.1.0/page/nrf52811_user_guide.html#ug_52811_own_project)

For example, my above code is from the folder "peripheral/blinky/pca10056". my sdk is 17.1.0_ddde560.

1. What is emulation? what is pca10056e for? How can I check emulation code is working? Is emulation code also activate my real hardware DK board's led?

2. Then How can I upload the code to nrf52811? From above link they write the guideline for it. but I need more detail....
After I open the project file in folder "peripheral/blinky/pca10056" which should I change?

Any advise will be very helpful for me.

Thank You!!!

  • Hi

    1. Emulation is for testing a project built for an nRf52811 on the nRF52840 DK and using the nRF52840 "as an nRF52811" to test the project in something close to an nRF52811 environment. Emulated projects will also be able to access the DKs LEDs and buttons.

    2. For your nRF52840 project you should follow the steps in "Transferring the project to nRF52811 hardware" for your project and it should build for an nRF52811 target afterwards. 
    For reference, these are the steps in question

    • Open the example project
    • In the project settings, change to device "NordicSemiconductor->nRF52811_xxaa".
    • In the C/C++ preprocessor settings, remove the defines "NRF52" and "NRF52840_XXAA".
    • Add the preprocessor define "NRF52811_XXAA".
    • In the linker script settings, adjust the linker script to match the maximum RAM and flash size of nRF52811.
      • ROM END: 0x2FFFF
      • RAM END: 0x20005FFF
    • Remove the following files from the project: <compiler>_startup_nrf52.s and system_nrf52.c.
    • Add the following files to the project: <compiler>_startup_nrf52811.s and system_nrf52811.c.

    After that, if you have connected the nRF52811 custom board as described in the link above, the DK should automatically detect the nR52811 and flash the board with the correct firmware (as long as the nRF52811 is also running on 3V, which is the voltage supported by the debugger onboard the DK.

    Best regards,

    Simon

  • Thanks for your reply!
    But I checked the document but I need more detail to follow that steps.

    Where is project setting changing device section?
    And where is c/c+preprocessor setting, preprocessor define

    I can't find where it is in my project options section.

    Sorry for the basic question and Thank you!

  • Hi

    Most of these are located in the preprocessor and Linker sections of the SEGGER project settings. The board you set in the preprocessor definitions for example.However, I see you've opened the settings of your main.c file. You should right click the project within SEGGER and open the project options from there, not the File 'main.c' Options.

    Best regards,

    Simon

  • Thanks for reply!

    Also I found an more specific way to do it from below link 

     Porting an example from pca10056 to pca10056e (Segger embedded studio)

    I downloaded the pca10056e.zip from vidar answer and it works!

Related