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

Can I do pstorage store whit S120 scan start?

static void ble_evt_dispatch(ble_evt_t * p_ble_evt)
{
    uint32_t           err_code;
    const               ble_gap_evt_t   * p_gap_evt = &p_ble_evt->evt.gap_evt;
    switch (p_ble_evt->header.evt_id)
    {
        case BLE_GAP_EVT_ADV_REPORT:
        {
	      pstorage_handle_t 		flash_handle;	
	      pstorage_block_identifier_get(&flash_base_handle,pstorage_block_id, &flash_handle);
	      err_code = pstorage_store(&flash_handle, (uint8_t * )&tx_data, 32, 0);
	      pstorage_block_id++ ;
        }
Parents
  • yes you can without any problem. The dispatch is happening at SWI2 interrupt priority, just make sure that it is not using APP_PRIORITY_HIGH otherwise the SVC calls within pstorage will cause hardfaults.

    update:

    ble_app_beacon.zip I have used this app to verify that pstorage event callbacks really occur even if you request them from the event handler.

  • Yes sure all those INIT codes have been added. And I tried pstorage store work will out of the ble_evt_dispatch(). Like this:

    static void weakup_meantimeout_handler(void * p_context)
    {
        UNUSED_PARAMETER(p_context);
    		pstorage_handle_t 		flash_handle;
    		while (rx_count>=32){
    						rx_count -= 32 ;
    						pstorage_block_identifier_get(&flash_base_handle,pstorage_block_id, &flash_handle);
    						if (!(flash_handle.block_id % 1024)) {
    								err_code = pstorage_clear(&flash_handle,1024);
    							}
    						err_code = pstorage_store(&flash_handle, (uint8_t * )&tx_data+rx_count, 32, 0);
    						pstorage_block_id++ ;
    			}
    }
    
Reply
  • Yes sure all those INIT codes have been added. And I tried pstorage store work will out of the ble_evt_dispatch(). Like this:

    static void weakup_meantimeout_handler(void * p_context)
    {
        UNUSED_PARAMETER(p_context);
    		pstorage_handle_t 		flash_handle;
    		while (rx_count>=32){
    						rx_count -= 32 ;
    						pstorage_block_identifier_get(&flash_base_handle,pstorage_block_id, &flash_handle);
    						if (!(flash_handle.block_id % 1024)) {
    								err_code = pstorage_clear(&flash_handle,1024);
    							}
    						err_code = pstorage_store(&flash_handle, (uint8_t * )&tx_data+rx_count, 32, 0);
    						pstorage_block_id++ ;
    			}
    }
    
Children
No Data
Related