/**
 * @brief  Write multiple bytes to TX FIFO of CC2500.
 * @param buffer buffer to read values from
 * @param NumByteToWrite number of bytes to write to TX FIFO
 * @retval void
 */
__inline void CC2500_write_tx(uint8_t* buffer, uint8_t NumByteToWrite) {
	if (NumByteToWrite == 1) {
		CC2500_Write(buffer, CC2500_TX_FIFO, NumByteToWrite);
	} else if (NumByteToWrite > 1) {
		CC2500_Write(buffer, CC2500_TX_FIFO_BURST, NumByteToWrite);	
	}
}
void test_read_write(void){
	
	uint8_t test_values[3] = {0x1F,0xDE,0xAD};
	uint8_t orig[3], res[3];
	
	CC2500_Read(orig, 0x00, 3);
	
	WIRELESS_TRY(orig[0], VAL_CC2500_IOCFG2);
	WIRELESS_TRY(orig[1], VAL_CC2500_IOCFG1);
	WIRELESS_TRY(orig[2], VAL_CC2500_IOCFG0);
	//CC2500_Read(&result, 0x00, 1);
	//printf("result = %d\n", result);
	
	//uint8_t val2[3] = {65,80,43};
	CC2500_Write(test_values, 0x00, 3);
	CC2500_Read(res, 0x00, 3);
	
	WIRELESS_TRY(res[0], test_values[0]);
	WIRELESS_TRY(res[1], test_values[1]);
	WIRELESS_TRY(res[2], test_values[2]);
	
	CC2500_Write(orig, 0x00, 3);
	CC2500_Read(res, 0x00, 3);
	WIRELESS_TRY(res[0], VAL_CC2500_IOCFG2);
	WIRELESS_TRY(res[1], VAL_CC2500_IOCFG1);
	WIRELESS_TRY(res[2], VAL_CC2500_IOCFG0);
	
	printf("result = %d, %d, %d\n", res[0], res[1], res[2]);
}	
Beispiel #3
0
/**
 * @brief This function transmits wireless a given data array
 * @param array The array to transmit
 * @param length The size of the array
 */
void transmit(uint8_t* array, int length) {
	uint8_t i = 0;
	uint8_t pending_write = 0;
	
	do {
		CC2500_Read(s2, CC2500_MARCSTATE | 0xC0, 1);
		if (s2[0] != 19) {
			CC2500_Read(s2 + 1, CC2500_STX | 0xC0, 1);
		} else {
			break;
		}
	} while (1);
	
	while (i < length) {
		CC2500_Read(s2, CC2500_MARCSTATE, 2);
		
		if (s2[0] == 22) {
			i = 1;
		} else if (s2[0] == 19 && pending_write == 0) {
			CC2500_Write(array + i, CC2500_FIFO, 1);
			i = i + 1;
			pending_write = 1;
		} else {
			CC2500_Read(s2 + 1, CC2500_STX, 1);
			pending_write = 0;
		}
		for (uint32_t j = 0; j < 18641351; j++);
	}
	
}
/*
	Transmit the pitch and roll over wireless
	Input:
	float pitch, float roll
	uint8_t ctrl2 = indicate what kind of packet we are sending
*/
void transmit_pitchroll(float pitch, float roll, uint8_t ctrl2) {

    packet_t pkt;
    pkt.f1 = pitch;
    pkt.f2 = roll;
    pkt.b1 = PACKET_CTRL1_PR;
    pkt.b2 = ctrl2;
    
    //printf("        pitch = %f ", pkt.f1);
    uint8_t *pnt = (uint8_t *) &pkt;
    //printf("        pitch = %f ", pkt.f1);
    //printf("Data: %x %x %x %x %x %x %x %x %x %x \n",pnt[0],pnt[1],pnt[2],pnt[3],pnt[4],pnt[5],pnt[6],pnt[7],pnt[8],pnt[9]);
    
    // Put data into the TX FIFO buffer  
    CC2500_Write(pnt, CC2500_FIFOADDR, WIRELESS_PKT_DATALEN); // Write to the TX buffer 
    
    //while ((CC2500_CommandProbe(CC2500_READBIT, CC2500_SNOP) & 0x70) !=); 
    //osDelay(1000);
    
    //print_status();
    
    // Move into transmit state
    uint8_t status = CC2500_CommandProbe(CC2500_WRITEBIT, CC2500_STX);
    //printf("Moved to TX (%x) \n",status);
    
    // The CC2500 will move back into the idle state when the transmission has been sent 
    //wait_for_idle();
    //osDelay(20);
    
}
/*
	Sends a single packet over wireless
	Input:
	uint8_t *pnt =  pointer to the packet being sent
*/
void send_packet(uint8_t *pnt) {
    // Put data into the TX FIFO buffer  
    CC2500_Write(pnt, CC2500_FIFOADDR, WIRELESS_PKT_DATALEN); // Write to the TX buffer 

    // Move into transmit state
    uint8_t status = CC2500_CommandProbe(CC2500_WRITEBIT, CC2500_STX);
    
    // The CC2500 will move back into the idle state when the transmission has been sent 
    osDelay(20);
}
Beispiel #6
0
/**
  * @brief  Transmits one packet
  * @param  Memory pointer to packet for Tx
  * @param 	Number of bytes to Tx (length of packet)
  * @note   Flushes FIFO before placing packet in buffer.
  */
void CC2500_TxPacket(uint8_t* pBuffer, uint16_t NumByteToWrite) {
   // Put the device to idle mode to flush the TX buffer
   CC2500_Strobe(CC2500_STROBE_SIDLE, 0x00);
   // flust the tx fifo
   CC2500_Strobe(CC2500_STROBE_SFTX, 0x00); 
   //write bytes to tx fifo
   CC2500_Write(pBuffer, CC2500_FIFO_ADDR, NumByteToWrite);
   //enable transmission   
   CC2500_Strobe(CC2500_STROBE_STX, 0x00);
   // status of device after TX will vary depending on MCSM1.TXOFF_MODE[1:0]
}
void test_transmit(void){

	uint8_t res2[3];
	uint8_t to_send = 0;
	CC2500_Read(res2, CC2500_FREQ_REG, 3);
	printf("result = %x, %x, %x\n", res2[0], res2[1], res2[2]);
	while(1){
		CC2500_Write(&to_send, 	CC2500_FIFO_REG, 1);
		to_send = (to_send + 2) % 10;
		printf("sent = %d\n", to_send);
		for (int i=0; i<168000000/12; i++);
	}
	
}	
Beispiel #8
0
/**
 * @brief Sends data from the transmitter to the reciever.
 *
 * @notes	Processes data and sends it to the reciever.
 * @param data: The angle data to send to the reciever.
 */
void CC2500_TXData(angle_data data){
	uint8_t transmitted_data[2];
	uint8_t bytes_in_txfifo;
	transmitted_data[PITCH_DATA] = data.pitch + 90;
	transmitted_data[ROLL_DATA] = data.roll + 90;
	CC2500_Strobe(SIDLE);
	while(CC2500_Strobe(SNOP) != 0);
	CC2500_Strobe(SFTX);
	CC2500_Write(transmitted_data, 0x3F, 2);
	
	CC2500_Strobe(STX);
	while(CC2500_Strobe(SNOP) != 2);
	while(CC2500_Strobe(SNOP) != 0);
}
Beispiel #9
0
void transmit(uint8_t* array, int length) {
	uint8_t i = 0;
	uint8_t pending_write = 0;
	
	do {
		CC2500_Read(s2, CC2500_MARCSTATE | 0xC0, 1);
		if (s2[0] != 19) {
			CC2500_Read(s2 + 1, CC2500_STX | 0xC0, 1);
		} else {
			break;
		}
	} while (1);
	
	while (1) {
		/*set_transmit_mode();
		uint8_t a = 2;
		CC2500_Write(&a, CC2500_FIFO, 1);
		int i;
		for (i = 0; i < 16900000; i++);
		a = 5;
		CC2500_Write(&a, CC2500_FIFO, 1);
		for (i = 0; i < 16900000; i++);*/
		
		
		
		
		CC2500_Read(s2, CC2500_MARCSTATE, 2);
		
		if (s2[0] == 22) {
			i = 1;
		} else if (s2[0] == 19 && pending_write == 0) {
			CC2500_Write(write_test + i, CC2500_FIFO, 1);
			i = (i + 1) % 5;
			pending_write = 1;
		} else {
			CC2500_Read(s2 + 1, CC2500_STX, 1);
			pending_write = 0;
		}
		for (uint32_t j = 0; j < 18641351; j++);
		
		
	}
	
}
/**
  * @brief  Function that transmits data to receiver.
  * @param  *transmitter: pointer to a Transmitter structure. 
  * @retval None.
  */
void wireless_TX(struct Transmitter *transmitter) {
	osMutexWait(transmitter->mutexID, osWaitForever);
	uint8_t tripleData[3*sizeof(transmitter->data)/sizeof(transmitter->data[0])];
	uint32_t i;
	
	for (i=0; i<sizeof(transmitter->data)/sizeof(transmitter->data[0]); i++) {
		tripleData[3*i] = transmitter->data[i] | ((3*i)<<4);
		tripleData[3*i+1] = transmitter->data[i] | ((3*i+1)<<4);
		tripleData[3*i+2] = transmitter->data[i] | ((3*i+2)<<4);
	}

	tripleData[0] = tripleData[0] | 0xF0;
	CC2500_Write(tripleData, FIFO_REG, 3*sizeof(transmitter->data)/sizeof(transmitter->data[0]));
	osMutexRelease(transmitter->mutexID);
	osDelay(STROBE_DELAY);
	
	osMutexWait(transmitter->mutexID, osWaitForever);
	CC2500_StrobeSend(SNOP_T,&(transmitter->state),&(transmitter->buffer_space));
	osMutexRelease(transmitter->mutexID);	
	osDelay(STROBE_DELAY);
}
/**
 * @brief  Write one byte to CC2500.
 * @param  WriteAddr : address to write to
 * @retval void
 */
__inline void CC2500_write_one(uint8_t* value, uint8_t WriteAddr) {
	CC2500_Write(value, WriteAddr, 1);
}
Beispiel #12
0
void flush_TXFIFO() {
	CC2500_Write(&dummy_byte, CC2500_SFTX, 1);
}
Beispiel #13
0
void flush_RXFIFO() {
	CC2500_Write(&dummy_byte, CC2500_SFRX, 1);
}
Beispiel #14
0
/**
 * @brief Configures wireless chip.
 * 
 * @notes	Configures configures the wireless chip settings by writing to the
 *				config registers.
 */
void CC2500_Init(void){
	uint8_t ctrl[16];
	//Configure the low level interface ----------------------------
	CC2500_LowLevel_Init();
	
	//TUESDAY
	ctrl[0] = SMARTRF_SETTING_IOCFG2;
	CC2500_Write(ctrl, IOCFG2, 1);
	CC2500_Write(ctrl, IOCFG2, 1);
	while(!CC2500_CheckRegisters(ctrl, IOCFG2, 1));
	
	ctrl[0] = SMARTRF_SETTING_IOCFG0D;
	ctrl[1] = SMARTRF_SETTING_FIFOTHR;
	CC2500_Write(ctrl, IOCFG0, 2);
	while(!CC2500_CheckRegisters(ctrl, IOCFG0, 2))CC2500_Write(ctrl, IOCFG0, 2);
	
	ctrl[0]  = SMARTRF_SETTING_PKTLEN;
	ctrl[1]  = SMARTRF_SETTING_PKTCTRL1;
	ctrl[2]  = SMARTRF_SETTING_PKTCTRL0;
	ctrl[3]  = SMARTRF_SETTING_ADDR;
	ctrl[4]  = SMARTRF_SETTING_CHANNR;
	ctrl[5]  = SMARTRF_SETTING_FSCTRL1;
	ctrl[6]  = SMARTRF_SETTING_FSCTRL0;
	ctrl[7]  = SMARTRF_SETTING_FREQ2;
	ctrl[8]  = SMARTRF_SETTING_FREQ1;
	ctrl[9]  = SMARTRF_SETTING_FREQ0;
	ctrl[10] = SMARTRF_SETTING_MDMCFG4;
	ctrl[11] = SMARTRF_SETTING_MDMCFG3;
	ctrl[12] = SMARTRF_SETTING_MDMCFG2;
	ctrl[13] = SMARTRF_SETTING_MDMCFG1;
	ctrl[14] = SMARTRF_SETTING_MDMCFG0;
	ctrl[15] = SMARTRF_SETTING_DEVIATN;
	CC2500_Write(ctrl, PKTLEN, 16);
	while(!CC2500_CheckRegisters(ctrl, PKTLEN, 16))CC2500_Write(ctrl, PKTLEN, 16);;
	
	ctrl[0] = SMARTRF_SETTING_MCSM1;
	ctrl[1] = SMARTRF_SETTING_MCSM0;
	ctrl[2] = SMARTRF_SETTING_FOCCFG;
	ctrl[3] = SMARTRF_SETTING_BSCFG;
	ctrl[4] = SMARTRF_SETTING_AGCCTRL2;
	ctrl[5] = SMARTRF_SETTING_AGCCTRL1;
	ctrl[6] = SMARTRF_SETTING_AGCCTRL0;
	CC2500_Write(ctrl, MCSM1, 7);
	while(!CC2500_CheckRegisters(ctrl, MCSM1, 7))CC2500_Write(ctrl, MCSM1, 7);;
	
	ctrl[0] = SMARTRF_SETTING_FREND1;
	ctrl[1] = SMARTRF_SETTING_FREND0;
	ctrl[2] = SMARTRF_SETTING_FSCAL3;
	ctrl[3] = SMARTRF_SETTING_FSCAL2;
	ctrl[4] = SMARTRF_SETTING_FSCAL1;
	ctrl[5] = SMARTRF_SETTING_FSCAL0;
	ctrl[6] = SMARTRF_SETTING_FSTEST;
	CC2500_Write(ctrl, FREND1, 7);
	while(!CC2500_CheckRegisters(ctrl, FREND1, 7))CC2500_Write(ctrl, FREND1, 7);;
	
	ctrl[0] = SMARTRF_SETTING_TEST2;
	ctrl[1] = SMARTRF_SETTING_TEST1;
	ctrl[2] = SMARTRF_SETTING_TEST0;
	CC2500_Write(ctrl, TEST2, 3);
	while(!CC2500_CheckRegisters(ctrl, TEST2, 3))CC2500_Write(ctrl, TEST2, 3);;
	
	ctrl[0] = SMARTRF_SETTING_SYNC1;
	ctrl[1] = SMARTRF_SETTING_SYNC0;
	CC2500_Write(ctrl, SYNC1, 2);

}
Beispiel #15
0
/**
  * @brief  Set CC2500 Initialization.
  * @param  None
  * @retval None
  */
void CC2500_Init(void) {
   
   CC2500_LowLevel_Init();
   
	 // Wireless configuration as defined on project specification page 9
   uint8_t reg;
   
	 // reset the device first
	 CC2500_Strobe(CC2500_STROBE_SRES, DUMMY_BYTE);
	 osDelay(50);
	
	 // put the device in idle mode
	 CC2500_Strobe(CC2500_STROBE_SIDLE, DUMMY_BYTE);
	
	 osDelay(50);
	
   reg = (uint8_t)CC2500_SETTING_FSCTRL1;
   CC2500_Write(&reg, CC2500_CFG_REG_FSCTRL1, 1);
   
   reg = (uint8_t)CC2500_SETTING_FSCTRL0;
   CC2500_Write(&reg, CC2500_CFG_REG_FSCTRL0, 1);
   
   reg = (uint8_t)CC2500_SETTING_FREQ2;
   CC2500_Write(&reg, CC2500_CFG_REG_FREQ2, 1);
   
   reg = (uint8_t)CC2500_SETTING_FREQ1;
   CC2500_Write(&reg, CC2500_CFG_REG_FREQ1, 1);
   
   reg = (uint8_t)CC2500_SETTING_FREQ0;
   CC2500_Write(&reg, CC2500_CFG_REG_FREQ0, 1);   
   
   reg = (uint8_t)CC2500_SETTING_MDMCFG4;
   CC2500_Write(&reg, CC2500_CFG_REG_MDMCFG4, 1);
   
   reg = (uint8_t)CC2500_SETTING_MDMCFG3;
   CC2500_Write(&reg, CC2500_CFG_REG_MDMCFG3, 1);
   
   reg = (uint8_t)CC2500_SETTING_MDMCFG2;
   CC2500_Write(&reg, CC2500_CFG_REG_MDMCFG2, 1);
   
   reg = (uint8_t)CC2500_SETTING_MDMCFG1;
   CC2500_Write(&reg, CC2500_CFG_REG_MDMCFG1, 1);
   
   reg = (uint8_t)CC2500_SETTING_MDMCFG0;
   CC2500_Write(&reg, CC2500_CFG_REG_MDMCFG0, 1);
   
   reg = (uint8_t)CC2500_SETTING_CHANNR;
   CC2500_Write(&reg, CC2500_CFG_REG_CHANNR, 1);
   
   reg = (uint8_t)CC2500_SETTING_DEVIATN;
   CC2500_Write(&reg, CC2500_CFG_REG_DEVIATN, 1);
   
   reg = (uint8_t)CC2500_SETTING_FREND1;
   CC2500_Write(&reg, CC2500_CFG_REG_FRIEND1, 1);
   
   reg = (uint8_t)CC2500_SETTING_FREND0;
   CC2500_Write(&reg, CC2500_CFG_REG_FRIEND0, 1);
   
   reg = (uint8_t)CC2500_SETTING_MCSM0;
   CC2500_Write(&reg, CC2500_CFG_REG_MCSM0, 1);
   
	 reg = (uint8_t)0x33;
   CC2500_Write(&reg, CC2500_CFG_REG_MCSM1, 1);
	 
   reg = (uint8_t)CC2500_SETTING_FOCCFG;
   CC2500_Write(&reg, CC2500_CFG_REG_FOCCFG, 1);
   
   reg = (uint8_t)CC2500_SETTING_BSCFG;
   CC2500_Write(&reg, CC2500_CFG_REG_BSCFG, 1);
	 
   reg = (uint8_t)CC2500_SETTING_AGCCTRL2;
   CC2500_Write(&reg, CC2500_CFG_REG_AGCCTRL2, 1);
   
   reg = (uint8_t)CC2500_SETTING_AGCCTRL1;
   CC2500_Write(&reg, CC2500_CFG_REG_AGCCTRL1, 1);
   
   reg = (uint8_t)CC2500_SETTING_AGCCTRL0;
   CC2500_Write(&reg, CC2500_CFG_REG_AGCCTRL0, 1);
   
   reg = (uint8_t)CC2500_SETTING_FSCAL3;
   CC2500_Write(&reg, CC2500_CFG_REG_FSCAL3, 1);
   
   reg = (uint8_t)CC2500_SETTING_FSCAL2;
   CC2500_Write(&reg, CC2500_CFG_REG_FSCAL2, 1);
   
   reg = (uint8_t)CC2500_SETTING_FSCAL1;
   CC2500_Write(&reg, CC2500_CFG_REG_FSCAL1, 1);
   
   reg = (uint8_t)CC2500_SETTING_FSCAL0;
   CC2500_Write(&reg, CC2500_CFG_REG_FSCAL0, 1);
   
   reg = (uint8_t)CC2500_SETTING_FSTEST;
   CC2500_Write(&reg, CC2500_CFG_REG_FSTEST, 1);
   
   reg = (uint8_t)CC2500_SETTING_TEST2;
   CC2500_Write(&reg, CC2500_CFG_REG_TEST2, 1);
   
   reg = (uint8_t)CC2500_SETTING_TEST1;
   CC2500_Write(&reg, CC2500_CFG_REG_TEST1, 1);
   
   reg = (uint8_t)CC2500_SETTING_TEST0;
   CC2500_Write(&reg, CC2500_CFG_REG_TEST0, 1);
   
   reg = (uint8_t)CC2500_SETTING_FIFOTHR;
   CC2500_Write(&reg, CC2500_CFG_REG_FIFOTHR, 1);
   
   reg = (uint8_t)CC2500_SETTING_IOCFG2;
   CC2500_Write(&reg, CC2500_CFG_REG_IOCFG2, 1);
   
   reg = (uint8_t)CC2500_SETTING_IOCFG0;
   CC2500_Write(&reg, CC2500_CFG_REG_IOCFG0, 1);
   
   reg = (uint8_t)CC2500_SETTING_PKTCTRL1;
   CC2500_Write(&reg, CC2500_CFG_REG_PKTCTRL1, 1);
   
   reg = (uint8_t)CC2500_SETTING_PKTCTRL0;
   CC2500_Write(&reg, CC2500_CFG_REG_PKTCTRL0, 1);
   
   reg = (uint8_t)CC2500_SETTING_ADDR;
   CC2500_Write(&reg, CC2500_CFG_REG_ADDR, 1);
   
   reg = (uint8_t)CC2500_SETTING_PKTLEN;
   CC2500_Write(&reg, CC2500_CFG_REG_PKTLEN, 1);
   
	 // flush the rx and tx buffer
	 CC2500_Strobe(CC2500_STROBE_SFTX, DUMMY_BYTE);
	 CC2500_Strobe(CC2500_STROBE_SFRX, DUMMY_BYTE);
}
void CC2500_config_transmitter(){
	uint8_t tmp;
	
	// FSCTRL1   Frequency synthesizer control.
	//Frequency offset = 457kHz
	tmp = CC2500_CFG_FSCTRL1;
	CC2500_Write(&tmp, CC2500_REG_FSCTRL1, 1);
	
	// FSCTRL0   Frequency synthesizer control.
	tmp = CC2500_CFG_FSCTRL0;
	CC2500_Write(&tmp, CC2500_REG_FSCTRL0, 1);
	
	// FREQ2     Frequency control word, high byte.
	tmp = CC2500_CFG_FREQ2;
	CC2500_Write(&tmp, CC2500_REG_FREQ2, 1);	
	
	// FREQ1     Frequency control word, middle byte.
	tmp = CC2500_CFG_FREQ1;
	CC2500_Write(&tmp, CC2500_REG_FREQ1, 1);	
	
	// FREQ0     Frequency control word, low byte.
	tmp = CC2500_CFG_FREQ0;
	CC2500_Write(&tmp, CC2500_REG_FREQ0, 1);
	
	// MDMCFG4   Modem configuration.
	//BW of channel = 541.666kHz
	tmp = CC2500_CFG_MDMCFG4;
	CC2500_Write(&tmp, CC2500_REG_MDMCFG4, 1);
	
	// MDMCFG3   Modem configuration.
	// Baud Rate = 125kb,
	tmp = CC2500_CFG_MDMCFG3;
	CC2500_Write(&tmp, CC2500_REG_MDMCFG3, 1);
	
	// MDMCFG2   Modem configuration.
	//Disable digital DC blocking filter before demodulator, MSK modulation, 16/16 sync word bits detected
	tmp = CC2500_CFG_MDMCFG2;
	CC2500_Write(&tmp, CC2500_REG_MDMCFG2, 1);
	
	// MDMCFG1   Modem configuration.
	tmp = CC2500_CFG_MDMCFG1;
	CC2500_Write(&tmp, CC2500_REG_MDMCFG1, 1);
	
	// MDMCFG0   Modem configuration.
	// Default Channel Spacing of 200kHz
	tmp = CC2500_CFG_MDMCFG0;
	CC2500_Write(&tmp, CC2500_REG_MDMCFG0, 1);
	
	// CHANNR    Channel number.
	//Channel 0
	tmp = CC2500_CFG_CHANNR;
	CC2500_Write(&tmp, CC2500_REG_CHANNR, 1);
	
	// DEVIATN   Modem deviation setting (when FSK modulation is enabled).
	// 1785kHz
	tmp = CC2500_CFG_DEVIATN;
	CC2500_Write(&tmp, CC2500_REG_DEVIATN, 1);
	
	// FREND1    Front end RX configuration.
	tmp = CC2500_CFG_FREND1;
	CC2500_Write(&tmp, CC2500_REG_FREND1, 1);
	
	// FREND0    Front end RX configuration.
	tmp = CC2500_CFG_FREND0;
	CC2500_Write(&tmp, CC2500_REG_FREND0, 1);

	// MCSM0     Main Radio Control State Machine configuration.
	// Automatically calibrate When going from IDLE to RX or TX (or FSTXON) check CC2500_CFG datasheet
	tmp = CC2500_CFG_MCSM0;
	CC2500_Write(&tmp, CC2500_REG_MCSM0, 1);
	
	// FOCCFG    Frequency Offset Compensation Configuration.
	tmp = CC2500_CFG_FOCCFG;
	CC2500_Write(&tmp, CC2500_REG_FOCCFG, 1);	
	
	// BSCFG     Bit synchronization Configuration.
	tmp = CC2500_CFG_BSCFG;
	CC2500_Write(&tmp, CC2500_REG_BSCFG, 1);	
	
	// AGCCTRL2  AGC control.
	tmp = CC2500_CFG_AGCCTRL2;
	CC2500_Write(&tmp, CC2500_REG_AGCCTRL2, 1);
	
	// AGCCTRL1  AGC control.
	tmp = CC2500_CFG_AGCCTRL1;
	CC2500_Write(&tmp, CC2500_REG_AGCCTRL1, 1);
	
	// AGCCTRL0  AGC control.
	tmp = CC2500_CFG_AGCCTRL0;
	CC2500_Write(&tmp, CC2500_REG_AGCCTRL0, 1);
	
	// FSCAL3    Frequency synthesizer calibration.
	tmp = CC2500_CFG_FSCAL3;
	CC2500_Write(&tmp, CC2500_REG_FSCAL3, 1);
	
	// FSCAL2    Frequency synthesizer calibration.
	tmp = CC2500_CFG_FSCAL2;
	CC2500_Write(&tmp, CC2500_REG_FSCAL2, 1);
	
	// FSCAL1    Frequency synthesizer calibration.
	tmp = CC2500_CFG_FSCAL1;
	CC2500_Write(&tmp, CC2500_REG_FSCAL1, 1);
	
	// FSCAL0    Frequency synthesizer calibration.
	tmp = CC2500_CFG_FSCAL0;
	CC2500_Write(&tmp, CC2500_REG_FSCAL0, 1);
	
	// FSTEST    Frequency synthesizer calibration.
	tmp = CC2500_CFG_FSTEST;
	CC2500_Write(&tmp, CC2500_REG_FSTEST, 1);
	
	
	// TEST2     Various test settings.
	tmp = CC2500_CFG_TEST2;
	CC2500_Write(&tmp, CC2500_REG_TEST2, 1);
	
	// TEST1     Various test settings.
	tmp = CC2500_CFG_TEST1;
	CC2500_Write(&tmp, CC2500_REG_TEST1, 1);
	
	// TEST0     Various test settings.
	tmp = CC2500_CFG_TEST0;
	CC2500_Write(&tmp, CC2500_REG_TEST0, 1);
	
	// FIFOTHR   RXFIFO and TXFIFO thresholds.
	tmp = CC2500_CFG_FIFOTHR;
	CC2500_Write(&tmp, CC2500_REG_FIFOTHR, 1);
	
	/*---- I/O Config ----*/
	// IOCFG2    GDO2 output pin configuration.
	tmp = CC2500_CFG_IOCFG2;
	CC2500_Write(&tmp, CC2500_REG_IOCFG2, 1);
	
	// IOCFG0D   GDO0 output pin configuration.
	tmp = CC2500_CFG_IOCFG0D;
	CC2500_Write(&tmp, CC2500_REG_IOCFG0, 1);
	
	
	// PKTCTRL1  Packet automation control.
	tmp = CC2500_CFG_PKTCTRL1;
	CC2500_Write(&tmp, CC2500_REG_PKTCTRL1, 1);
	
	// PKTCTRL0  Packet automation control.
	// Fixed Packet Length (0x05)
	tmp = CC2500_CFG_PKTCTRL0;
	CC2500_Write(&tmp, CC2500_REG_PKTCTRL0, 1);
	
	// ADDR      Device address.
	// Global Broadcast Address
	tmp = CC2500_CFG_ADDR;
	CC2500_Write(&tmp, CC2500_REG_ADDR, 1);
	
	// PKTLEN    Packet length.
	 // Packet Length of 10bytes
	tmp = CC2500_CFG_PKTLEN;
	CC2500_Write(&tmp, CC2500_REG_PKTLEN, 1);
	
	// PKTLEN    Packet length.
	 // Packet Length of 10bytes
	tmp = CC2500_CFG_MCSM1;
	CC2500_Write(&tmp, CC2500_REG_MCSM1, 1);
}