problems with forwarding read rssi values to the wifi module through serial port

Hello. I am using nrf52832 for Ble-based positioning. currently i am tackling with establishment of an anchor measuring rssi values and sending them to a central center (a PC) through an additional wifi module. i am sending data from nrf52832 to the wifi module through serial (UART) connection. to this end, i combined a simple UART example with a blincky-c example of nrf5sdk. doing so, i receive a couple of rssi values and then the transmission to pc stocks. i tried chaning the priority of the UART transmission from lowest to highest and it seems to work. i wonder to know whether my job was ok or this change of priority may cause other problems...

Moreover, i have tried combining the libuarte example to the ble central blincky which is expected to handle my above problem, but it did not work (send data on serial) due to an unkown reason. 

best regards, 

  • Hi

    We have quite the backlog from the Easter holiday, and I will have to get back to you later this week with a proper answer on this ticket. You'll hear from me on Friday at the latest with some sort of update.

    What Wi-Fi module is this exactly, and how does the nRF52832 communicate with it? Is it RSSI from the Wi-Fi device you want to see, or are you trying to send RSSI values from the nRF52832 to the Wi-Fi module and forward it over Wi-Fi? What's your use case here exactly?

    Best regards,

    Simon

  • Hello Simon

    & thanks a lot. I am using esp8266 esp01 wifi module. in your question, the 2nd scenario is my will; one nrf52832 (acting as an anchor) is aimed to read BLE rssi values from some other nrf52832 (acting as ble tags) and then send these value to the wifi module through the serial ports in order to forward them over wifi network to a PC.

    Best regards,

    Ali

  • Okay, and what pins on the nRF52832 is connecting to the  esp01 module to do UART? And how are you handling the received RSSI values exactly?

    Best regards,

    Simon

  • i am using pins 6 and 8 as tx and rx respectively. i handle it inside the scan_evt_handler function:

    static void scan_evt_handler(scan_evt_t const * p_scan_evt)
    {
    ret_code_t err_code;
    char cip_cmd[32];
    char rssi_msg[32];
    char rssi_msg2[64];

    switch(p_scan_evt->scan_evt_id)
    {
    case NRF_BLE_SCAN_EVT_FILTER_MATCH:
    {
    nrf_gpio_pin_set(CUSTOM_PIN);

    ble_gap_evt_adv_report_t const * p_adv_report = p_scan_evt->params.filter_match.p_adv_report;

    //ble_gap_addr_t addr1= p_adv_report->peer_addr;
    NRF_LOG_INFO("Beacon detected! Address: %02X:%02X:%02X:%02X:%02X:%02X",
    p_adv_report->peer_addr.addr[0],
    p_adv_report->peer_addr.addr[1],
    p_adv_report->peer_addr.addr[2],
    p_adv_report->peer_addr.addr[3],
    p_adv_report->peer_addr.addr[4],
    p_adv_report->peer_addr.addr[5]);
    NRF_LOG_INFO("signal recieved from bluetooth channel: %d " ,p_adv_report->ch_index);
    NRF_LOG_INFO("its RSSI is: %d dBm" ,p_adv_report->rssi);


    //uart_send("HelloESP01\r\n");
    //nrf_delay_ms(100);
    int8_t rssi = p_adv_report->rssi;

    snprintf(rssi_msg, sizeof(rssi_msg), "RSSI: %d dBm\r\n", rssi);
    int len =strlen(rssi_msg);

    snprintf(rssi_msg2, sizeof(rssi_msg2), "Beacon Address: %02X:%02X:%02X:%02X:%02X:%02X",
    p_adv_report->peer_addr.addr[0],
    p_adv_report->peer_addr.addr[1],
    p_adv_report->peer_addr.addr[2],
    p_adv_report->peer_addr.addr[3],
    p_adv_report->peer_addr.addr[4],
    p_adv_report->peer_addr.addr[5]);
    int len2 =strlen(rssi_msg2);

    snprintf(cip_cmd, sizeof(cip_cmd), "AT+CIPSEND=%d\r\n", len+len2);


    uart_send(cip_cmd);
    nrf_delay_ms(40);
    uart_send(rssi_msg2);
    nrf_delay_ms(40);
    uart_send(rssi_msg);
    nrf_delay_ms(40);

    }
    break;

    case NRF_BLE_SCAN_EVT_CONNECTING_ERROR:
    err_code = p_scan_evt->params.connecting_err.err_code;
    APP_ERROR_CHECK(err_code);
    break;
    default:
    break;
    }
    }

    and this is my "main" function if needed:

    int main(void)
    {
    // Initialize.
    nrf_gpio_cfg_output(CUSTOM_PIN);
    nrf_gpio_pin_clear(CUSTOM_PIN);
    log_init();
    timer_init();
    leds_init();
    buttons_init();
    power_management_init();
    ble_stack_init();

    gatt_init();
    db_discovery_init();
    lbs_c_init();

    // Start execution.
    NRF_LOG_INFO("Blinky CENTRAL example started.");

    uart_init();
    // Turn on the LED to signal scanning.
    bsp_board_led_on(CENTRAL_SCANNING_LED);
    char td[][6]= {{0xD5, 0x2A, 0x9D, 0x99, 0xE3, 0xDA},{0xD2, 0xE8, 0x6B, 0x15, 0xD0, 0xD6}};

    //uart_send("HelloESP01\r\n");
    nrf_delay_ms(3000);

    uart_send("AT\r\n");
    nrf_delay_ms(2000);
    uart_send("AT+CIPSTART=\"TCP\",\"192.168.182.50\",8888\r\n");
    nrf_delay_ms(7000);

    uart_send("AT+CIPSEND=10\r\n");
    nrf_delay_ms(100);
    uart_send("HelloESP01\r\n");
    nrf_delay_ms(100);

    // Enter main loop.
    for (;;)
    {
    scan_init(td[0]);
    scan_start();

    //gatt_init();
    //db_discovery_init();
    idle_state_handle();
    scan_init(td[1]);
    scan_start();

    //gatt_init();
    //db_discovery_init();
    idle_state_handle();

    }
    }

  • And just to confirm, you're seeing this on your custom board correct, not the DK, correct? Because on the DK, pins P0.06 and P0.08 are connected to the interface MCU by default which would explain why it wouldn't be forwarded to the Wi-Fi module.

    Best regards,

    Simon

Related