I'm running BLE and Gazell host concurrently using the timeslot API. I also have 2 Gazell peripherals transmitting all the time. Everything works just fine when I run Gazell on its own, but when I try to put it inside a SoftDevice timeslot it doesn't do anything. It doesn't receive any data. I've looked around and saw someone mention I should put Gazell into NRF_GZLL_MODE_SUSPEND mode.
This is the function that gets executed in a timeslot. It runs in the main (application) context.
void timeslotProc(void *data, uint16_t dataSize)
{
debugOut("#");
nrf_gzll_set_mode(NRF_GZLL_MODE_HOST);
nrf_gpio_pin_write(6, 1);
timerStart();
while(timerRead() < 9000) nrf_delay_us(1); // Await incoming Gazell transmissions
nrf_gzll_set_mode(NRF_GZLL_MODE_SUSPEND);
nrf_gpio_pin_write(6, 0);
timerStop();
}
How do I get it working? Thank you
EDIT: I'm using the standard variant of the Gazell library, not the SD resources variant. Could it be because of that? The propblem is I can't use that one due to SWI1 conflict with app_timer_ble_gzll and ble_radio_notification
EDIT 2: After some rewriting I successfully switched over to Gazell SD resources variant. It didn't matter though, Gazell is still not working:
nrf_radio_signal_callback_return_param_t *timeslotHandler(uint8_t signalType)
{
static nrf_radio_signal_callback_return_param_t returnParams;
returnParams.callback_action = NRF_RADIO_SIGNAL_CALLBACK_ACTION_NONE;
switch(signalType)
{
case NRF_RADIO_CALLBACK_SIGNAL_TYPE_START:
if(!isGazellOn)
{
gazellInit(true);
isGazellOn = true;
}
else nrf_gzll_set_mode(NRF_GZLL_MODE_HOST);
NRF_TIMER0->CC[3] = 9000;
NRF_TIMER0->INTENSET = TIMER_INTENSET_COMPARE3_Enabled << TIMER_INTENSET_COMPARE3_Pos;
NRF_TIMER0->SHORTS = TIMER_SHORTS_COMPARE3_CLEAR_Enabled << TIMER_SHORTS_COMPARE3_CLEAR_Pos;
NVIC_EnableIRQ(TIMER0_IRQn);
NRF_TIMER0->TASKS_START = 1;
nrf_gpio_pin_write(6, 1);
break;
case NRF_RADIO_CALLBACK_SIGNAL_TYPE_TIMER0:
if(NRF_TIMER0->EVENTS_COMPARE[3])
{
nrf_gzll_set_mode(NRF_GZLL_MODE_SUSPEND);
nrf_gpio_pin_write(6, 0);
NRF_TIMER0->EVENTS_COMPARE[3] = 0;
NRF_TIMER0->TASKS_STOP = 1;
returnParams.params.request.p_next = &tsReqParams;
returnParams.callback_action = NRF_RADIO_SIGNAL_CALLBACK_ACTION_REQUEST_AND_END;
}
break;
}
return &returnParams;
}