The signal strength of the frame of the open source projects indication RSSI UWB DWM1000

Before Bowen open source framework set uwb, behind several blog posts will be developed based on the simple open-source framework. Let uwb users a clearer understanding of this basecode based development work.

Signal strength indication RSSI, may be used to implement the zigbee positioned, although the RSSI does not need to locate UWB, but the quality of this signal is determined by the indicator.

Common reference scenario:

Multiple base station selects the optimal positioning station based on the RSSI strength, particularly in applications TDOA

Optimized RF design.

TDOA is currently doing and long-distance module, we do only consider two scenarios. For RF optimization, for example when the selection antenna, at the same distance, the RSSI value is smaller, the better the performance of the antenna change. Similarly, other parameters can be adjusted.

Official documentation in user_manual 4.7 Festival, the specific content of the reference user_manual Description

All developers are based basecode development before development takes about 2h. RSSI critical code (an open-source reference implementation):

static float calculatePower(float base, float N, uint8_t pulseFrequency) {
  float A, corrFac;

    if(DWT_PRF_16M == pulseFrequency) {
        A = 115.72;
        corrFac = 2.3334;
    } else {
        A = 121.74;
        corrFac = 1.1667;
    }

    float estFpPwr = 10.0 * log10(base / (N * N)) - A;

    if(estFpPwr <= -88) {
        return estFpPwr;
    } else {
        // approximation of Fig. 22 in user manual for dbm correction
        estFpPwr += (estFpPwr + 88) * corrFac;
    }

    return estFpPwr;
}

float dwGetReceivePower(void) {
    dwt_rxdiag_t *diagnostics;
    dwt_readdiagnostics(diagnostics);
  float C = (&diagnostics->stdNoise)[3];
  float N = diagnostics->rxPreamCount;

  float twoPower17 = 131072.0;
  return calculatePower(C * twoPower17, N, config.prf);
}

In rx_main, receiving a callback function, call dwGetReceivePower calculated RSSI value. Other redundant code previously removed, as callback code

At the same time added freq_count, to simple packet loss test

 if (status_reg & SYS_STATUS_RXFCG)//good message
    {
        /* A frame has been received, copy it to our local buffer. */
        frame_len = dwt_read32bitreg(RX_FINFO_ID) & RX_FINFO_RXFL_MASK_1023;
        if (frame_len <= FRAME_LEN_MAX)
        {
            dwt_readrxdata(rx_buffer, frame_len, 0);
            msg_f = (srd_msg_dsss*)rx_buffer;
            //copy source address as dest address
            msg_f_send.destAddr[0] = msg_f->sourceAddr[0];
            msg_f_send.destAddr[1] = msg_f->sourceAddr[1];
            //copy source seqNum
            msg_f_send.seqNum = msg_f->seqNum;

            switch(msg_f->messageData[0])
            {
                case 'D'://distance
                    led_on(LED_ALL);
                    uwb_rssi = dwGetReceivePower();
                    freq_count++;
                break;
                                
                default:
                    break;
            }
        }
        //enable recive again
        dwt_enableframefilter(DWT_FF_DATA_EN);
        dwt_setrxtimeout(0);
        dwt_rxenable(0);

rx main function, displayed periodically using the timer 4 and rssi freq_count

    while (1)
    {
            if(time4_overflow == 1)
            {
                time4_overflow = 0;
                sprintf(lcd_char,"RSSI:%2.2f, %d ",uwb_rssi,freq_count);
                freq_count = 0;
                OLED_ShowString(0,4,lcd_char);

without modifying the main tx, rx and tx compile two hex (note the difference between the short address, specifically explained with reference to basecode), two modules are downloaded to the test

End of this article, basecode Open Source Address: 51uwb.cn

Guess you like

Origin www.cnblogs.com/tuzhuke/p/12169538.html