This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Again a CC2500 RSSI thread

Other Parts Discussed in Thread: CC2500

Hello,

 
sorry for opening another thread for my problem but i don't want to reanimate some old thread for this.

I'm trying to build a spectrum analyzer with the cc2500 and a Beaglebone Black. So far I'm able to read and write registers of the cc2500 over SPI. So I tried to set all configuration registers the same way RF Studio does for continuous RX-Mode, this step should be fine. After that I want to walk through all channels an read the RSSI register but what i get is always 0x1F for the first few channels and 0x6F for the the rest.

Here the important parts of my source code.

void initSensor(){
    // initialize the CC2500
   radio.init();
   // reset device (0x30)
   radio.reset();
   // reset device (0x30)
   radio.reset();

//Configuration Register Setting
   //CONTINUOUSLY RX MODE
    radio.sendCommand(CC2500_REG_IOCFG2, 0x0B);     // GDO2 output pin configuration
    radio.sendCommand(CC2500_REG_IOCFG1, 0x2E);     // GDO1 output pin configuration
    radio.sendCommand(CC2500_REG_IOCFG0, 0x0C);     // GDO0 output pin configuration
    radio.sendCommand(CC2500_REG_FIFOTHR, 0x07);     // RX FIFO and TX FIFO thresholds
    radio.sendCommand(CC2500_REG_SYNC1, 0xD3);     // Sync word, high byte
    radio.sendCommand(CC2500_REG_SYNC0, 0x91);     // Sync word, low byte
    radio.sendCommand(CC2500_REG_PKTLEN, 0x01 );     // Packet length
    radio.sendCommand(CC2500_REG_PKTCTRL1, 0x04);     // Packet automation control
    radio.sendCommand(CC2500_REG_PKTCTRL0, 0x12);     // Packet automation control
    radio.sendCommand(CC2500_REG_ADDR, 0x00);     // Device address
    radio.sendCommand(CC2500_REG_CHANNR, 0x00);     // Channel number
    radio.sendCommand(CC2500_REG_FSCTRL1, 0x0F);     // Frequency synthesizer control
    radio.sendCommand(CC2500_REG_FSCTRL0 , 0x00);     // Frequency synthesizer control
    radio.sendCommand(CC2500_REG_FREQ2, 0x5E);     // Frequency control word, high byte
    radio.sendCommand(CC2500_REG_FREQ1, 0xC4 );     // Frequency control word, middle byte
    radio.sendCommand(CC2500_REG_FREQ0, 0xEC);     // Frequency control word, low byte
    radio.sendCommand(CC2500_REG_MDMCFG4, 0x8C);     // Modem configuration
    radio.sendCommand(CC2500_REG_MDMCFG3, 0x22);     // Modem configuration
    radio.sendCommand(CC2500_REG_MDMCFG2, 0xF0);     // Modem configuration
    radio.sendCommand(CC2500_REG_MDMCFG1, 0x22 );     // Modem configuration
    radio.sendCommand(CC2500_REG_MDMCFG0, 0xF8);     // Modem configuration
    radio.sendCommand(CC2500_REG_DEVIATN, 0x47);     // Modem deviation setting
    radio.sendCommand(CC2500_REG_MCSM2, 0x07);     // Main Radio Control State Machine configuration
    radio.sendCommand(CC2500_REG_MCSM1, 0x30);     // Main Radio Control State Machine configuration
    radio.sendCommand(CC2500_REG_MCSM0, 0x04 );     // Main Radio Control State Machine configuration
    radio.sendCommand(CC2500_REG_FOCCFG, 0x36 );     // Frequency Offset Compensation configuration
    radio.sendCommand(CC2500_REG_BSCFG, 0x6C);     // Bit Synchronization configuration
    radio.sendCommand(CC2500_REG_AGCCTRL2, 0x03);     // AGC control
    radio.sendCommand(CC2500_REG_AGCCTRL1, 0x40);     // AGC control
    radio.sendCommand(CC2500_REG_AGCCTRL0, 0x91);     // AGC control
    radio.sendCommand(CC2500_REG_WOREVT1, 0x87);     // High byte Event0 timeout
    radio.sendCommand(CC2500_REG_WOREVT0, 0x6B);     // Low byte Event0 timeout
    radio.sendCommand(CC2500_REG_WORCTRL, 0xF8);     // Wake On Radio control           ???
    radio.sendCommand(CC2500_REG_FREND1, 0x56);     // Front end RX configuration
    radio.sendCommand(CC2500_REG_FREND0, 0x10);     // Front end TX configuration
    radio.sendCommand(CC2500_REG_FSCAL3, 0xEA);     // Frequency synthesizer calibration
    radio.sendCommand(CC2500_REG_FSCAL2, 0x0A  );     // Frequency synthesizer calibration
    radio.sendCommand(CC2500_REG_FSCAL1, 0x00);     // Frequency synthesizer calibration
    radio.sendCommand(CC2500_REG_FSCAL0, 0x11);     // Frequency synthesizer calibration
    radio.sendCommand(CC2500_REG_RCCTRL1, 0x41);     // RC oscillator configuration
    radio.sendCommand(CC2500_REG_RCCTRL0, 0x00);     // RC oscillator configuration
    radio.sendCommand(CC2500_REG_FSTEST, 0x59);     // Frequency synthesizer calibration control
    radio.sendCommand(CC2500_REG_PTEST, 0x7F);     // Production test
    radio.sendCommand(CC2500_REG_AGCTEST, 0x3F );     // AGC test
    radio.sendCommand(CC2500_REG_TEST2, 0x88);     // Various test settings
    radio.sendCommand(CC2500_REG_TEST1, 0x31);     // Various test settings
    radio.sendCommand(CC2500_REG_TEST0, 0x0B);     // Various test settings


// write power setting to PATABLE memory using single access write. See table 31 on page 47
   // of datasheet
   radio.sendCommand(CC2500_REG_PATABLE, 0xFF);
   // SIDLE: exit RX/TX
 radio.sendStrobeCommand(CC2500_CMD_SIDLE);
   // SIDLE: exit RX/TX
   radio.sendStrobeCommand(CC2500_CMD_SIDLE);
   // SPWD: enter power down mode when CSn goes high
   //radio.sendStrobeCommand(CC2500_CMD_SPWD);
   // SIDLE: exit RX/TX
   radio.sendStrobeCommand(CC2500_CMD_SIDLE);
}


void readRSSI(){
    int i;
    char rssi;
    for (i=0; i<256;i++){
        radio.sendCommand(CC2500_REG_CHANNR, i);        //set channel Number
        char channel=radio.ReadReg(CC2500_REG_CHANNR);   // testing the readReg Function    CC2500_REG_CHANNR = 0x0A
        qDebug("i=%d        Channelnumber=%d",i, int(channel));
        radio.sendStrobeCommand(CC2500_CMD_SRX);        //enter rx-mode      CC2500_CMD_SRX = 0x34
        rssi=radio.ReadReg(CC2500_REG_RSSI);                      // CC2500_REG_RSSI = 0x34
        qDebug("Channel: %d     RSSI: %X", i, rssi);
        out <<"channel " << i << "\t\t" << "RSSI: " << int(rssi) << endl;
        radio.sendStrobeCommand(CC2500_CMD_SIDLE);
    }
}

unsigned char CC2500::sendCommand(unsigned char command, unsigned char data)
{
    // enable device
    digitalWrite(m_pinCS, LOW);
    pinMode(66, INPUT);

    // wait for device
    while (digitalRead(66) == HIGH) {
    };

    // send command byte
    //spiTransfer(command);
   spi->transfer(command);
    // send data byte
    unsigned char result= spi->transfer(data);
    // disable device
    digitalWrite(m_pinCS, HIGH);

    // return result
    return result;
}


char CC2500::ReadReg(char addr)
{    pinMode(66, INPUT);

    addr = addr + 0x80;
    digitalWrite(m_pinCS,LOW);

       //wait for device
    while (digitalRead(66) == HIGH) {
    };
    char x = spi->transfer(addr);
    delay(10);
    char y = spi->transfer(0);
    digitalWrite(m_pinCS,HIGH);
    return y;
}

Hope you can help me.