This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

dealing large data packet's through ble

Hi, I need to send(using BLE) large amount of data's, which are collected by the accelerometer sensor for 1 hour. I have an external NOR flash where the accelerometer data's are stored and from there data's are transmitted to the BLE stack when sync occurs. I am using nRF51822 nordic controller. Assume that, data size will be 50KB.

Regards, Balaji

  • It's a little hard to read your code. Try the code tags next time :-)

    Anyway, it looks like you are incrementing values without being sure that the packet is actually sent. You should not increment the counters before the packet is sent successfully.

    After you have send the packet with "ble_hrs_heart_rate_measurement_send", you will have to check all the err_code conditions, and only when you have cleared all the checks, you can consider the packet as sent. This is where you can prepare the next packet, set of values or similar.

  • Try something like this...

    
    static uint8_t packets=0;
    while(true)
    { 
    	err_code = ble_hrs_heart_rate_measurement_send(&m_hrs, packets, 0);
    	if (err_code == NRF_ERROR_INVALID_STATE || err_code == BLE_ERROR_GATTS_SYS_ATTR_MISSING)
    	{ 
    		break;
    	}
    	else if (err_code == BLE_ERROR_NO_TX_BUFFERS)
    	{ 
    		// We will try to maximize throughput, so we don't stop sending (quit the while loop) before we reach BLE_ERROR_NO_TX_BUFFERS state
    		break; 
    	}
    	else if (err_code != NRF_SUCCESS) 
    	{
    		APP_ERROR_HANDLER(err_code);
    	}
    	// At this point the packet handed to the "ble_hrs_heart_rate_measurement_send" is considered sent
    	// Prepare the next
    	packet++
    }
    
    
  • Thanks for the suggestions, KPE. I'll give only incrementing after an NRF_SUCCESS a try. I just figured that decrementing counters back if there was an BLE_ERROR_NO_TX_BUFFERS returned was equivalent.

    Regarding the code tag, the button for it doesn't seem to be available when commenting down in the thread like it is when you are starting a thread (formatting tools aren't shown?).

    Cheers, Jamie

  • Thanks for the suggestions, KPE. I'll give only incrementing after an NRF_SUCCESS a try. I just figured that decrementing counters back if there was an BLE_ERROR_NO_TX_BUFFERS returned was equivalent.

    Regarding the code tag, the button for it doesn't seem to be available when commenting down in the thread like it is when you are starting a thread (formatting tools aren't shown?).

    Cheers, Jamie

  • Hi Morten, Is there some example about how to receive large data's(>20 byte)?

Related