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

setting system clock and activating nrf52 for debugging

hello there,

I use currently 'ble_app_hids_keyboard_s132_spi_pca10040' app of SDK11 for my nrf52832_xxaa device on 'IAR' IDE. It utilizes sofdevise s132. I do not use the evaluation board.

The nrf52 soc does not have an external 32KHz cyrstal for the LFXO oscillator, only an external 32MHz cyrstal for the HFXO oscillator. I try to set the RC oscillator. my purpose right now is only to be able to debug a simple app that flickers a led.

first of all here is what the 'nrfgo studio' shows about the memory occupancy concerning the softdevice and app: nrfgo_details.jpg

it is stated cleary that sofdevice occupies 124kB, and that the starting address of the app is 0x1f000. this is how I wrote these details in the 'Linker Configuration file editor' of the IAR: linker1.jpg

In addition, I use 0 level optimizatoin.

Here is how I wrote my simple app, without the use of ble transmission:

int main(void)
{
    bool erase_bonds;
//    uint32_t err_code;
    
    NRF_CLOCK->EVENTS_HFCLKSTARTED = 0;
    NRF_CLOCK->TASKS_HFCLKSTART = 1;
    while(NRF_CLOCK->EVENTS_HFCLKSTARTED == 0) { /* Do nothing */ }

//    NRF_CLOCK->LFCLKSRC = (CLOCK_LFCLKSRC_SRC_Synth << CLOCK_LFCLKSRC_SRC_Pos);
//    NRF_CLOCK->EVENTS_LFCLKSTARTED = 0;
//    NRF_CLOCK->TASKS_LFCLKSTART = 1;
//    while(NRF_CLOCK->EVENTS_LFCLKSTARTED == 0) { /* Do nothing */ }

    
    // Initialize.
    app_trace_init();
    timers_init();
    buttons_leds_init(&erase_bonds);
    ble_stack_init();
    scheduler_init();
//    device_manager_init(erase_bonds);
//    gap_params_init();
//    advertising_init();
//    services_init();
//    sensor_simulator_init();
//    conn_params_init();
//    buffer_init();
    
      nrf_gpio_cfg_output(27);
      nrf_gpio_pin_set(27);

    // Start execution.
//    timers_start();
//    err_code = ble_advertising_start(BLE_ADV_MODE_FAST);
//    APP_ERROR_CHECK(err_code);

    // Enter main loop.
    for (;;)
    {
//        app_sched_execute();
//        power_manage();
          nrf_gpio_pin_clear(27);
          nrf_delay_ms(300);
          nrf_gpio_pin_set(27);
          nrf_delay_ms(300);
    }
}

I try to debug but it stuck each time. what couild I amend?? and why does it is written explicaly in the SDK11 original 'ble_app_hids_keyboard_s132_spi_pca10040' app that the ROM of the app(not including softdevice) starts at 0x0??

Idan

Parents Reply Children
No Data
Related