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

Gazell callbacks not working

I have the following code, it's pretty bare in terms of its functionality:

#include <stdint.h>

extern "C"
{
    #include "nrf_delay.h"
}

#include "gazell.h"
#include "tools.h"
#include "uart.h"
#include "core.h"

extern uint8_t nodeMode;

uint8_t rxPayload[GAZELL_PACKET_SIZE],
        txPayload[GAZELL_PACKET_SIZE] = { 0, 0, 1, 2, 3, 4, 5, 6, 7, 8 };

extern "C"
{
    void nrf_gzll_host_rx_data_ready(uint32_t pipe, nrf_gzll_host_rx_info_t rxInfo) { debugOut("dataReady\r\n"); }
    void nrf_gzll_device_tx_success(uint32_t pipe, nrf_gzll_device_tx_info_t txInfo) { debugOut("txSuccess\r\n"); }
    void nrf_gzll_device_tx_failed(uint32_t pipe, nrf_gzll_device_tx_info_t txInfo) { debugOut("txFailed\r\n"); }
    void nrf_gzll_disabled() { debugOut("disabled\r\n"); }
}

nrf_gzll_error_code_t gazellInit()
{   
    nrf_gzll_error_code_t errorCode;
    debugOut("Gazell init %s\r\n", nodeMode == MODE_MASTER ? "host" : "device");
    gazellErrorHandle(nrf_gzll_init(nodeMode == MODE_MASTER ? NRF_GZLL_MODE_HOST : NRF_GZLL_MODE_DEVICE));
    gazellErrorHandle(nrf_gzll_enable());
    
    while(nodeMode == MODE_SLAVE)
    {
        nrf_gzll_add_packet_to_tx_fifo(1, txPayload, GAZELL_PACKET_SIZE);
        ++txPayload[0];
        nrf_delay_ms(1000);
    }
    
    return NRF_GZLL_ERROR_CODE_NO_ERROR;
}

For some reason though, it appears the callbacks aren't being called. I am however sure that the transmission takes place, since when I start the device with having the host off I quickly get an overflow in the tx fifo. What am I missing/doing wrong?

Thank you in advance

Parents
  • Turns out they are being called just fine, it's just that I have my UART print functions wait for an interrupt indicating that the transmission is over. Seems like Gazell's interrupts are higher priority so the UART interrupt isn't called when I need it to. Is there any way around that? I just need to check whether UART tx fifo is empty.

Reply
  • Turns out they are being called just fine, it's just that I have my UART print functions wait for an interrupt indicating that the transmission is over. Seems like Gazell's interrupts are higher priority so the UART interrupt isn't called when I need it to. Is there any way around that? I just need to check whether UART tx fifo is empty.

Children
No Data
Related