AnsweredAssumed Answered

NO-OS get RSSI

Question asked by nipicai on Jun 6, 2017
Latest reply on Jul 21, 2017 by DragosB

Hi,

     I use Picozed SOM with no-os. I use the board in TDD mode and I write a part of code  use for get the signal 's rssi.Can anybody help me to see the code all right?

/*****************RSSI**************************/
    struct rf_rssi rssi;
    rssi.ant = 0;
    rssi.duration = 1;
    const uint8_t times=10;
    const uint32_t inc_freq=50;
    const uint32_t capture_points=16384;
    uint32_t base_freq=21326;
    uint16_t i;
    uint16_t j;
    uint32_t sum=0;
       /*********************************************************************/
    ad9361_set_rx_rf_bandwidth(ad9361_phy,5000000);
    for(i=0;i<7;i++){
     ad9361_set_rx_lo_freq(ad9361_phy,base_freq*100000);
     ad9361_set_rx_sampling_freq(ad9361_phy,61440000);
     for(j=0;j<times;j++){
     //get data
     mdelay(1000);
     adc_capture(capture_points, ADC_DDR_BASEADDR);
     Xil_DCacheInvalidateRange(ADC_DDR_BASEADDR, capture_points );
       //get RSSI
     ad9361_get_rx_rssi(ad9361_phy, 0, &rssi);
     sum+=rssi.symbol / rssi.multiplier *100 +rssi.symbol % rssi.multiplier;
     }
       /*****************************printf_rssi*******************************/
     sum=sum/times;
     xil_printf("freq= %d.%01d MHz  ",base_freq/10,base_freq%10);
     printf("rssi =- %d.%02d dB\n", sum/100, sum%100);
     /********************************change_freq****************************/
     base_freq+=inc_freq;
    }
       /**********************************change_ensm_mode*********************/
    ad9361_set_en_state_machine_mode(ad9361_phy,ENSM_MODE_ALERT);
    ad9361_set_en_state_machine_mode(ad9361_phy,ENSM_MODE_TX);
    /*****************RSSI**************************/

 

the result in console:

freq= 2132.6 MHz  rssi =- 96.25 dB
freq= 2137.6 MHz  rssi =- 99.50 dB
freq= 2142.6 MHz  rssi =- 98.02 dB
freq= 2147.6 MHz  rssi =- 112.35 dB
freq= 2152.6 MHz  rssi =- 117.96 dB
freq= 2157.6 MHz  rssi =- 118.27 dB
freq= 2162.6 MHz  rssi =- 116.90 dB

Outcomes