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

RSSI value using Gazell

hi hakon, you told me to do " Try using the variable, for instance by setting "rx_info.rssi = rx_info.rssi;" in the callback and see if that helps." in the question i have asked the link of the question is link text

but it couldn't work, i am pasting my code below please see if i am missing something in the code for not getting variable RSSI or send me some working example of getting RSSI using gazel for PCA10001 board.

define PIPE_NUMBER 0 ///< We use pipe 0 in this example

// GPIO

define BUTTONS BUTTON_0

define LEDS LED_0

define TX_PAYLOAD_LENGTH 1

static uint8_t data_payload [TX_PAYLOAD_LENGTH]; 
static uint8_t ack_payload [NRF_GZLL_CONST_MAX_PAYLOAD_LENGTH]; static volatile bool init_ok, enable_ok, push_ok, pop_ok, tx_success; 
static nrf_gzll_device_tx_info_t tx_info;

int main() { uint8_t rss_check; uint8_t chk; uint8_t pipe; nrf_gpio_cfg_output(LED_1); nrf_gpio_cfg_sense_input(BUTTON_0,BUTTON_PULL, NRF_GPIO_PIN_SENSE_LOW); uint8_t debug_led_output;

// Setup port directions
nrf_gpio_pin_dir_set(BUTTONS,NRF_GPIO_PIN_DIR_INPUT);
nrf_gpio_pin_dir_set(LEDS,NRF_GPIO_PIN_DIR_OUTPUT);

// Initialize Gazell
init_ok = nrf_gzll_init(NRF_GZLL_MODE_HOST);  

// Load data into TX queue
ack_payload[0] = nrf_gpio_pin_read(BUTTONS);
push_ok1 = nrf_gzll_add_packet_to_tx_fifo(PIPE_NUMBER , data_payload1, TX_PAYLOAD_LENGTH); enable_ok = nrf_gzll_enable(); while(1) { nrf_gzll_host_rx_data_ready(PIPE_NUMBER ,rx_info1); // Error handling// it also needs the full four device support error handling debug_led_output = ((uint8_t)packet_received << 4) + ((uint8_t)pop_ok1 << 3) + ((uint8_t)push_ok1 << 2) + ((uint8_t)enable_ok << 1) + (uint8_t)init_ok;

    // If an error has occured
    if(debug_led_output != 0x1F)
    {
                nrf_gpio_pin_toggle(LED_1);
        nrf_gpio_pin_write(LEDS,0xFF);      
        nrf_delay_us(1000000); // 1 second delay 
        nrf_gpio_pin_write(LEDS, debug_led_output);
        nrf_delay_us(1000000); // 1 second delay 
        nrf_gpio_pin_write(LEDS,0xF0 + (uint32_t)nrf_gzll_get_error_code()); 
        nrf_delay_us(1000000); // 1 second delay 
    }

    // Optionally send the CPU to sleep while waiting for a callback.
    // __WFI();
}

}

void nrf_gzll_host_rx_data_ready(uint32_t pipe, nrf_gzll_host_rx_info_t rx_info) { 
//uint8_t rss; volatile int16_t rss2; uint32_t data_payload_length = NRF_GZLL_CONST_MAX_PAYLOAD_LENGTH; packet_received = true;

// Pop packet and write first byte of the payload to the GPIO port.
pop_ok1 = nrf_gzll_fetch_packet_from_rx_fifo(PIPE_NUMBER, data_payload1, &data_payload_length);
rx_info.rssi=rx_info.rssi;

if (data_payload_length > 0)
{
        nrf_gpio_pin_set(LED_1);
    nrf_gpio_pin_write(LEDS,~data_payload1[0]);
}

// Read buttons and load ACK payload into TX queue
ack_payload[0] = nrf_gpio_pin_read(BUTTONS);  // Button logic is inverted.
push_ok1 = nrf_gzll_add_packet_to_tx_fifo(PIPE_NUMBER, ack_payload, TX_PAYLOAD_LENGTH);
}

please help me out.....

Parents Reply Children
No Data
Related