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

Flash write

Hello,

I'm trying to write value to a specified address with ble_flash_page_write .

I'm using ble_flash_page_write after ble disconnect event. I've tested different page address to be sure i'm not writing on application or s110 areas and page address are multiples of 4.

At execution, an Hard fault occur at the ble_flash_page_write line... Any idea about this error ? Is there others solutions to write values to a precise flash address ?

int32_t page = 200;
uint8_t word_count = 1;
uint32_t data_array[2]={0x81ABACAB};
data_array[1] = 0x81ABACAB;
		
err_code = ble_flash_page_write(page,(uint32_t *) &data_array,1);
APP_ERROR_CHECK(err_code);
Parents
  • Hi Thomas,

    Can you confirm you have registered for system events and are passing it on to pstorage module?

    Below the code that may be useful you..!

    
    
    
    /**@brief Function for dispatching a system event to interested modules.
     *
     * @details This function is called from the System event interrupt handler after a system
     *          event has been received.
     *
     * @param[in]   sys_evt   System stack event.
     */
    static void sys_evt_dispatch(uint32_t sys_evt)
    {
        pstorage_sys_event_handler(sys_evt);
    }
    
    /**@brief BLE stack initialization.
     *
     * @details Initializes the SoftDevice and the stack event interrupt.
     */
    static void ble_ant_stack_init(void)
    {
        // Initialize SoftDevice
        SOFTDEVICE_HANDLER_INIT(NRF_CLOCK_LFCLKSRC_XTAL_20_PPM, false);
        
        // Subscribe for BLE events.
        uint32_t err_code = softdevice_ble_evt_handler_set(ble_evt_dispatch);
        APP_ERROR_CHECK(err_code);
        
        // Register with the SoftDevice handler module for BLE events.
        err_code = softdevice_sys_evt_handler_set(sys_evt_dispatch);
        APP_ERROR_CHECK(err_code);
    }
    
    
    

    Hope this helps!

    Regards, Krishna

Reply
  • Hi Thomas,

    Can you confirm you have registered for system events and are passing it on to pstorage module?

    Below the code that may be useful you..!

    
    
    
    /**@brief Function for dispatching a system event to interested modules.
     *
     * @details This function is called from the System event interrupt handler after a system
     *          event has been received.
     *
     * @param[in]   sys_evt   System stack event.
     */
    static void sys_evt_dispatch(uint32_t sys_evt)
    {
        pstorage_sys_event_handler(sys_evt);
    }
    
    /**@brief BLE stack initialization.
     *
     * @details Initializes the SoftDevice and the stack event interrupt.
     */
    static void ble_ant_stack_init(void)
    {
        // Initialize SoftDevice
        SOFTDEVICE_HANDLER_INIT(NRF_CLOCK_LFCLKSRC_XTAL_20_PPM, false);
        
        // Subscribe for BLE events.
        uint32_t err_code = softdevice_ble_evt_handler_set(ble_evt_dispatch);
        APP_ERROR_CHECK(err_code);
        
        // Register with the SoftDevice handler module for BLE events.
        err_code = softdevice_sys_evt_handler_set(sys_evt_dispatch);
        APP_ERROR_CHECK(err_code);
    }
    
    
    

    Hope this helps!

    Regards, Krishna

Children
No Data
Related