Hi guys,
I am new to Nordic and I am using the evaluation kit "pca10001".
I have managed to run the LED BUTTON example which was declared in application note "nAN-36"
Now, I am trying to write to the flash via the soft device APIs like:
1- sd_flash_page_erase(uint32_t page_number) 2- sd_flash_write(uint32_t * const p_dst, uint32_t const * const p_src, uint32_t size)
For sorrow, it doesn't work!!
I have tried to debug the problem but it seems that, the processor halts or may be waiting for something!!
here you are the code that I have used as an application:
/***********************************************************************************************************************/ /********************************************Defines****************************************************************/ #define FLASH_START_PAGE 255 // The page that I would like to start writing at. #define FLASH_PROG_START_ADD ((uint32_t *const)(FLASH_START_PAGE * 1024U))
/***********************************************************************************************************************/ /*****************************************Functions**********************************************************/
/**@brief Function for flash write on air. */ static void flash_write(uint32_t *const p_dst, uint32_t const *const p_src, uint32_t size ) { uint32_t err_code;
err_code = sd_flash_write(p_dst, p_src, size);
APP_ERROR_CHECK(err_code);
} /***********************************************************************************************/ /***************Main Application/
/**@brief Function for application main entry. */ int main(void) {
uint32_t data[] = {0x0000, 0x1111, 0x2222, 0x3333};
uint32_t err_code = 0;
uint32_t * p_evt_id;
// Initialize
leds_init();
timers_init();
gpiote_init();
buttons_init();
ble_stack_init();
scheduler_init();
gap_params_init();
services_init();
advertising_init();
conn_params_init();
sec_params_init();
// Start execution
timers_start();
advertising_start();
err_code = sd_flash_page_erase((uint32_t)FLASH_START_PAGE);
if( NRF_SUCCESS == err_code ) {
flash_write(FLASH_PROG_START_ADD, data, 4);
}
else
{
// error erasing
nrf_gpio_pin_set(LED_1);
}
// Enter main loop
for (;;)
{
app_sched_execute();
power_manage();
}
}
/**
- @} */ // //
Need your advice.
Thanks in advance.