Esempio n. 1
0
File: hal_rf.c Progetto: gxp/node
/***********************************************************************************
* @fn      halRfInit
*
* @brief   Power up, sets default tuning settings, enables autoack, enables random
*          generator.
*
* @param   none
*
* @return  SUCCESS always (for interface compatibility)
*/
uint8 halRfInit(void)
{
    uint8 i;

    // turning on power to analog part of radio and waiting for voltage regulator.
    RFPWR = 0x04;
    while( RFPWR & 0x10 );

    // Setting for AUTO CRC and AUTOACK
    MDMCTRL0L |= (AUTO_CRC | AUTO_ACK);

    // Turning on AUTO_TX2RX
    FSMTC1 = ((FSMTC1 & (~AUTO_TX2RX_OFF & ~RX2RX_TIME_OFF))  | ACCEPT_ACKPKT);

    // Turning off abortRxOnSrxon.
    FSMTC1 &= ~0x20;

    // Set FIFOP threshold to maximum
    IOCFG0 = 0x7F;
    // tuning adjustments for optimal radio performance; details available in datasheet */
    RXCTRL0H = 0x32;
    RXCTRL0L = 0xF5;

    // Turning on receiver to get output from IF-ADC
    ISRXON();
    halMcuWaitUs(1);

    // Enable random generator
    ADCCON1 &= ~0x0C;

    for(i = 0 ; i < 32 ; i++)
    {
        RNDH = ADCTSTH;
        // Clock random generator
        ADCCON1 |= 0x04;
    }
    ISRFOFF();

    // Enable CC2591 with High Gain Mode
    halPaLnaInit();

    halRfEnableRxInterrupt();

    return SUCCESS;
}
Esempio n. 2
0
/***********************************************************************************
* @fn      halRfInit
*
* @brief   Power up, sets default tuning settings, enables autoack, enables random
*          generator.
*
* @param   none
*
* @return  SUCCESS always (for interface compatibility)
*/
uint8 halRfInit(void)
{
    // Enable auto ack and auto crc
    FRMCTRL0 |= (AUTO_ACK | AUTO_CRC);

    // Recommended RX settings
    TXFILTCFG = 0x09;
    AGCCTRL1 = 0x15;
    FSCAL1 = 0x00;

    // Enable random generator -> Not implemented yet

    // Enable CC2591 with High Gain Mode
    halPaLnaInit();

    // Enable RX interrupt
    halRfEnableRxInterrupt();

    return SUCCESS;
}