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

ble_app_hrs example not debugging as expected and no LED on nRF6310

Hello,

As a summary (described fully below) I have loaded the ble_app_hrs example onto my device and its not working right as LEDs that should light up don't and the program is getting stuck in a HardFault_Handler.

%%%%%%% BACKGROUND %%%%%%%

So I'm using:

  • nRF6310 with a PCA10006 and J-Link Lite CortexM (nRFgo Starter Kit)
  • nRFgo Studio v 1.21.2.10 and programming a S110v7.0.0 SoftDevice onto the board via nRFgo Studio
  • ARM Keil v5 with legacy fix.

I am working from the nRF51822 Development Kit User Guide v1.3 and have reached the heart rate monitor example ble_app_hrs which I've accessed from the directory "Nordic\nrf51822\Board\nrf6310\ble_s110_serialization\ble_app_hrs\arm\ble_app_hrs.uvproj"

I have managed to successfully program the S110 soft Device as shown in the picture below.

image description

In Keil I can then successfully Flash the device with the compiled ble_app_hrs. I am targeting a nRF51822_xxaa board. The Build Output is given as;

Load "C:\\Keil_v5\\ARM\\Device\\Nordic\\nRF51822\\Board\\nrf6310\\ble_s110_serialization\\ble_app_hrs\\arm\\_build\\ble_app_hrs.axf" 
Set JLink Project File to "C:\Keil_v5\ARM\Device\Nordic\nRF51822\Board\nrf6310\ble_s110_serialization\ble_app_hrs\arm\JLinkSettings.ini"
* JLink Info: Device "NRF51822_XXAA" selected.
 
JLink info:
------------
DLL: V5.12f, compiled May 17 2016 16:03:35
Firmware: J-Link Lite-Cortex-M V8 compiled Aug 20 2015 17:57:19
Hardware: V8.00
S/N : 518004931 
Feature(s) : GDB 
 
* JLink Info: Found SWD-DP with ID 0x0BB11477
* JLink Info: Found Cortex-M0 r0p0, Little endian.
* JLink Info: FPUnit: 4 code (BP) slots and 0 literal slots
* JLink Info: CoreSight components:
* JLink Info: ROMTbl 0 @ F0000000
* JLink Info: ROMTbl 0 [0]: F00FF000, CID: B105100D, PID: 000BB471 ROM Table
* JLink Info: ROMTbl 1 @ E00FF000
* JLink Info: ROMTbl 1 [0]: FFF0F000, CID: B105E00D, PID: 000BB008 SCS
* JLink Info: ROMTbl 1 [1]: FFF02000, CID: B105E00D, PID: 000BB00A DWT
* JLink Info: ROMTbl 1 [2]: FFF03000, CID: B105E00D, PID: 000BB00B FPB
* JLink Info: ROMTbl 0 [1]: 00002000, CID: B105900D, PID: 000BB9A3 ???
ROMTableAddr = 0xF0000000
 
Target info:
------------
Device: nRF51822_xxAA
VTarget = 3.313V
State of Pins: 
TCK: 0, TDI: 0, TDO: 1, TMS: 1, TRES: 1, TRST: 1
Hardware-Breakpoints: 4
Software-Breakpoints: 8192
Watchpoints:          2
JTAG speed: 2000 kHz
 
Erase Done.
Programming Done.
Verify OK.
Application running ...
Flash Load finished at 15:28:23

And for detail my Target Config is shown below.

image description

My Debug Driver Flash Download settings are shown below.

image description

%%%%%%% PROBLEM %%%%%%%

Once I have flashed the device I immediately recognise my first problem - the nRFgo Motherboard does not light up LED0 to show advertising which should happen as described in the ble_app_hrs main.c

int main(void)
{
    APP_GPIOTE_INIT(1); 
    connectivity_chip_reset();
    
    leds_init();  
    buttons_init();  
    timers_init();    
    ble_stack_init();
    bond_manager_init();
    scheduler_init();
    gap_params_init();
    advertising_init();
    services_init();
    sensor_sim_init();
    conn_params_init();
    sec_params_init();
   
    // Start execution
    application_timers_start();
    advertising_start();
    
    // Enter main loop
    for (;;)
    {
        app_sched_execute();
        power_manage();
    }
}

static void leds_init(void)
{
    nrf_gpio_cfg_output(ADVERTISING_LED_PIN_NO);
    nrf_gpio_cfg_output(CONNECTED_LED_PIN_NO);
    nrf_gpio_cfg_output(ASSERT_LED_PIN_NO);
}

static void advertising_start(void)
{
    uint32_t err_code;
    
    err_code = sd_ble_gap_adv_start(&m_adv_params);
    APP_ERROR_CHECK(err_code);
    
    nrf_gpio_pin_set(ADVERTISING_LED_PIN_NO);
}

Shown is my nRFgo motherboard while it's meant to be running the program.

image description

So I decided to go ahead and debug the code. What I've found is that whenever I debug the program and run it then stop it's always getting caught in a HardFault Hander in arm_startup_nrf.s.

HardFault_Handler\
                PROC
                EXPORT  HardFault_Handler         [WEAK]
                B       .  //GETS CAUGHT HERE
                ENDP

So I'm not sure what is going wrong. I've been struggling to use this nRF6310 to get this basic example working for 3 days now and I encounter problem after problem if someone could help I would be immensely grateful.

Thank you for your time.

Parents
  • Hi,

    The hardfault is most likely triggered by wrong start address in RAM1, should be 0x20002000 for s110 v.7.x.x. More details about memory layout with Softdevice can be found in chapter 10.1 in SDS v.1.3

  • Thank you very much for your input, I tried this change and I still seem to be encountering the same problem with the LED not lighting up but I no longer gets the hardfault, it appears the program runs to the end of main but only accesses a few function calls and doesn't enter the infinite for loop. I also tried updating my SD to 8.0.0 but I can no longer flash successfully when I do this. Version 7.3.0 seems to work however. I have also checked and I believe I'm running SDK 11.0.0 I will review the documents you have linked and hopefully can work out where I'm going wrong from there. Thank you again for your assistance.

Reply
  • Thank you very much for your input, I tried this change and I still seem to be encountering the same problem with the LED not lighting up but I no longer gets the hardfault, it appears the program runs to the end of main but only accesses a few function calls and doesn't enter the infinite for loop. I also tried updating my SD to 8.0.0 but I can no longer flash successfully when I do this. Version 7.3.0 seems to work however. I have also checked and I believe I'm running SDK 11.0.0 I will review the documents you have linked and hopefully can work out where I'm going wrong from there. Thank you again for your assistance.

Children
No Data
Related