Beispiel #1
0
/***********************************************************************************
* @fn      halRfInit
*
* @brief   Power up, sets default tuning settings, enables autoack and configures
*          chip IO
*
* @param   none
*
* @return  HAL_RF_SUCCESS if the radio has started, FAILURE otherwise
*/
uint8 halRfInit(void)
{
    regVal_t* p;

    DEBUG_MSG_FUNC_START;

    // Avoid GPIO0 interrupts during reset
#if 0 // POOH
    halDigioIntDisable(&pinRadio_GPIO0);
#else
    CC2520_GPIO_0_Interrupt_Setting(DISABLE);
#endif

    // Make sure to pull the CC2520 RESETn and VREG_EN pins low
    CC2520_RESET_OPIN(0);
    CC2520_SPI_END();
    CC2520_VREG_EN_OPIN(0);
#if 0 // POOH
    halMcuWaitUs(1100);
#else
    Delay(110);
#endif

    // Make sure MISO is configured as output.
#if 0 // POOH
    CC2520_MISO_DIR_OUT();
#endif

    // Enable the voltage regulator and wait for it (CC2520 power-up)
    CC2520_VREG_EN_OPIN(1);
#if 0 // POOH
    halMcuWaitUs(CC2520_VREG_MAX_STARTUP_TIME);
#else
    Delay(200);
#endif

    // Release reset
    CC2520_RESET_OPIN(1);

#if 0 // POOH
    // Wait for XOSC stable to be announced on the MISO pin
    if (halRfWaitRadioReady()==HAL_RF_FAILED)
        return HAL_RF_FAILED;
#else
    Delay(200);
#endif

    // Write non-default register values
    p= regval;
    while (p->reg!=0) {
        CC2520_MEMWR8(p->reg,p->val);
        p++;
    }

    return HAL_RF_SUCCESS;
}
Beispiel #2
0
/***********************************************************************************
* @fn      halRfInit
*
* @brief   Power up, sets default tuning settings, enables autoack and configures
*          chip IO
*
* @param   none
*
* @return  SUCCESS if the radio has started, FAILURE otherwise
*/
uint8 halRfInit(void)
{
    regVal_t* p;
    uint8 val;

    // Avoid GPIO0 interrupts during reset
//	halDigioIntDisable(&pinRadio_GPIO0);

    // Make sure to pull the CC2520 RESETn and VREG_EN pins low
    CC2520_RESET_OPIN(0);
    CC2520_SPI_END();
    CC2520_VREG_EN_OPIN(0);
    halMcuWaitUs(1100);

    // Make sure MISO is configured as output.
//	CC2520_MISO_DIR_OUT();
	
    // Enable the voltage regulator and wait for it (CC2520 power-up)
    CC2520_VREG_EN_OPIN(1);
    halMcuWaitUs(CC2520_VREG_MAX_STARTUP_TIME);

    // Release reset
    CC2520_RESET_OPIN(1);

    // Wait for XOSC stable to be announced on the MISO pin
    if (halRfWaitRadioReady()==FAILED)
        return FAILED;

    // Write non-default register values
    p = regval;
    while (p->reg!=0) {
        CC2520_MEMWR8(p->reg,p->val);
        p++;
    }

    // Verify a register
    val= CC2520_MEMRD8(CC2520_MDMCTRL0);

    return val==0x85? SUCCESS : FAILED;
}
Beispiel #3
0
/***********************************************************************************
 * @fn      halRfInit
 *
 * @brief   Power up, sets default tuning settings, enables autoack and configures
 *          chip IO
 *
 * @param   none
 *
 * @return  SUCCESS if the radio has started, FAILURE otherwise
 */
uint8 halRfInit(void) {
	regVal_t* p;
	uint8 val;

	// Avoid GPIO0 interrupts during reset
	halRfDisableRxInterrupt();

	// Make sure to pull the CC2520 RESETn pin low
	CC2520_RESET_OPIN(0);
	CC2520_SPI_END();
	chThdSleepMilliseconds(2);

	// Make sure MISO is configured as output.
	CC2520_MISO_DIR_OUT();

	// Release reset
	CC2520_RESET_OPIN(1);

	// Wait for XOSC stable to be announced on the MISO pin
	if (halRfWaitRadioReady() == FAILED) {
		return FAILED;
	}

	// Write non-default register values
	p = regval;
	while (p->reg != 0) {
		CC2520_MEMWR8(p->reg, p->val);
		p++;
	}

	// ISR Thread
	chThdCreateStatic(waIsrTx, sizeof(waIsrTx), NORMALPRIO + 2, isrThread, NULL );

	// Verify a register
	val = CC2520_MEMRD8(CC2520_MDMCTRL0);
	return val == 0x85 ? SUCCESS : FAILED;
}