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

Changing data_rate in GAZELL when enabled

Hi Nordic I am using GZLL to develop a prototype whereby data from sensors will be transferred to a Computer in a Wireless sensor network. The idea is, when data are requested, the transmission rate should be increased till the data is received and acknowldged at the base. After that, to save energy, transmission rate should be reduced untill further request is made. I have tryed to directly change tranmission rate using the GZLL_timeslot_period funciton while GZLL is enabled and also tryed disabling Gzll, increae the rate, send data, disable Gzll, reduce tramissino rate and enabling it again sequence. Here is the code snippit that demonstrates my attempt. As you can see, I am adjusting the code in the nrf_gzll_disabled() call back function. Any feedback??!!

int main()
{
 		    nrf_gzll_set_timeslot_period(1000000);  
                enable_ok = nrf_gzll_enable(); 
                while(true) {}
} 
void  nrf_gzll_device_tx_success(uint32_t pipe, nrf_gzll_device_tx_info_t tx_info)
{
                increase_t_rate = true;
                nrf_gzll_disable();
                while(nrf_gzll_is_enabled()){}
                nrf_gzll_enable();
		uint8_t currReading;
                uint32_t ack_payload_length = NRF_GZLL_CONST_MAX_PAYLOAD_LENGTH; 
                if(tx_info.payload_received_in_ack)
                {
                   pop_ok = nrf_gzll_fetch_packet_from_rx_fifo(pipe, ack_payload, &ack_payload_length); 
                  if (i == 0)//acknowldege reception of TEDS transmission request
		  {
			data_payload[0]= 0xAF; // signal the start
		        push_ok = nrf_gzll_add_packet_to_tx_fifo(pipe, data_payload, TX_PAYLOAD_LENGTH);
			i++;
		   } 
                   
                }
increase_t_rate = false;
nrf_gzll_disable();
while(nrf_gzll_is_enabled()){};
nrf_gzll_enable();
}
void nrf_gzll_disabled()
{
	if (increase_t_rate == true)
	{
		nrf_gzll_set_timeslot_period(5000);
	}
	else if(increase_t_rate == false)
	{
		nrf_gzll_set_timeslot_period(1000000);
	}
}
  • Hi Raiyans,

    As showed in the description of the nrf_gzll_set_timeslot_period() function, you will receive a return code false if gazell is already enabled. So, if you want to change the timeslot period you would need to disable gazell, change the timeslot period and enable it again.

    Another option is that you keep the timeslot period at short period (5000), but on the Device side, you disable the radio when you don't need to transfer anything. When you have something to transfer you can start gazell and transmitting in "out-of-sync" mode. It will take some transmission before they are sync again but I think you will have even shorter latency compare to the solution to set the timeslot period to 1000000.

    This of course cause more power consumption on the Host side, but if you connect it to a computer, I don't think power consumption could be the concern here.

  • Hello @Hung Bui, Thank you very much for your answer. I need to follow the first approach as data should be tranmitted at all time. Only at different rates. So disabling Gazell and enabling it again is the way to go. I have now problems regarding restaring the tranmission after the device is disabled. I can no longer syn the device with the host after disabling the device. What values do I need to set for timeslots per channel and other values inorder to establish recommunication?? Best Regards Raiyan

  • @Raiyans: Have you made sure you set the new timeslot period on both side (host and device) to 1000000 ?

  • Hi Hung ***, It is wokring now. There was a small problem in my code. Thank you very much. You can add your comment as answer so that I can accept it. Best Regards

Related