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

How to know whether frequence hop successful with gzl?

Hi: I want to get frequence hopping with gzl, Now I finish config gzl and commuicate successful between host and device. But I don't know whether frequence hop successful? would you please give some suggestion. I have an oscilloscope of 50MHz only. Host_init:

rf_gzll_init(NRF_GZLL_MODE_HOST); 
nrf_gzll_set_tx_power(NRF_GZLL_TX_POWER_0_DBM);
nrf_gzll_set_base_address_0(NRF_GZLL_DEFAULT_BASE_ADDRESS_0);
nrf_gzll_set_base_address_1(NRF_GZLL_DEFAULT_BASE_ADDRESS_1);
nrf_gzll_set_address_prefix_byte(0,0x32);
nrf_gzll_set_address_prefix_byte(1,0x24);
nrf_gzll_set_timeslot_period(GZLL_RX_PEROD/2);
nrf_gzll_set_channel_table(my_channel_table,NRF_GZLL_DEFAULT_CHANNEL_TABLE_SIZE);
nrf_gzll_set_timeslots_per_channel(timeslots_per_channel);
nrf_gzll_set_datarate(NRF_GZLL_DATARATE_2MBIT);

Device_init:

	nrf_gzll_init(NRF_GZLL_MODE_DEVICE); 
nrf_gzll_set_tx_power(NRF_GZLL_TX_POWER_0_DBM);
nrf_gzll_set_base_address_0(NRF_GZLL_DEFAULT_BASE_ADDRESS_0);
nrf_gzll_set_base_address_1(NRF_GZLL_DEFAULT_BASE_ADDRESS_1);
nrf_gzll_set_address_prefix_byte(0,0x32);
nrf_gzll_set_address_prefix_byte(1,0x24);
nrf_gzll_set_timeslot_period(GZLL_RX_PEROD/2);
nrf_gzll_set_channel_table(my_channel_table,NRF_GZLL_DEFAULT_CHANNEL_TABLE_SIZE);
nrf_gzll_set_timeslots_per_channel(timeslots_per_channel);
nrf_gzll_set_timeslots_per_channel_when_device_out_of_sync(NRF_GZLL_DEFAULT_CHANNEL_TABLE_SIZE*timeslots_per_channel);
nrf_gzll_set_device_channel_selection_policy(NRF_GZLL_DEVICE_CHANNEL_SELECTION_POLICY_USE_SUCCESSFUL);
nrf_gzll_set_datarate(NRF_GZLL_DATARATE_2MBIT);

thanks!

  • I don't quite understand. Do you want to know if one frequency hop is successful or do you want to know if frequency hopping is working? I'm don't think you can test if one frequency hop is successful.

    Maybe you can use the nrf_gzll_device_tx_info_t struct that comes with nrf_gzll_device_tx_success() callback?

    It contains the number of tx attempts and number of channel switches(frequency hops).

  • Sorry, I want to know if frequency hopping is working. What is the nrf_gzll_device_tx_info_t.num_channel_switches mean? Will it show the current channel? I print it in callback function(nrf_gzll_device_tx_success()),but I found its value is always 0. Instead, It seems that the register(NRF_RADIO->FREQUENCY) show the current channel? Am I right and can I use this register to identify frequency hop is working? Thank you!

  • num_channel_switches is number of channel switches needed during previous packet transmission. Since you are using NRF_GZLL_DEVICE_CHANNEL_SELECTION_POLICY_USE_SUCCESSFUL the Device will start sending packets on the channel it last had a successfully acknowledged transmission as long as you are in sync and as long as all packets are successful I guess you will never change channel, and you will never get a num_channel_switches above 0. If you try to only have the device active and then turn on the host, you should get something else than 0. Or you can try using NRF_GZLL_DEVICE_CHANNEL_SELECTION_POLICY_USE_CURRENT. I'm not sure when the NRF_RADIO->FREQUENCY is set, but I think you can use it to see if the frequency is changing.

Related