Hi,
I have doubts regarding the default Settings for CC2500. I have referred to the datasheet have not changed any settings rather that a register called MCSM1, where I want the CC module to remain in the same state after a transmit or receive.
Is it enough for setting an initial transmission/reception? Cos, I am not able to receive the data sent from one CC with these default settings.
Please let me know if I had to configure any other configuration registers? In case needed, I have attached my code here. Please help me out in this.
#include <18F24J11.h>
static unsigned char TransmitData[40] = "Tiino";
void main()
{
output_high(SPI_SS); // Initial Slave Select to a high level
// Initialize the hardware SSP for SPI Master mode.
while(TRUE)
{
setup_spi(SPI_MASTER | SPI_MODE_0 | SPI_CLK_DIV_64);
CC_SetIdleMode();
CC_Initial_Check();
CC_WriteRFSettings();
CC_SetIdleMode();
CC_ClearTransmitFIFO();
CC_TransmitData();
CC_CheckNoOfBytesinTXFIFO();
CC_SetTransmitModeMode();
//CC_SetReceiveModeMode();
delay(50);
}
}
void CC_Initial_Check()
{
output_low(SPI_SS);
delay(5);
spi_write(VERSION_NUMBER);
ReceiveValue = spi_read(DUMMY);
delay(5);
spi_write(PART_NUMBER);
ReceiveValue = spi_read(DUMMY);
delay(5);
output_high(SPI_SS);
}
void CC_WriteRFSettings(void)
{
TI_CC_SPIWriteReg(TI_CCxxx0_MCSM1 , 0x3E);
}
void TI_CC_SPIWriteReg(char addr, char value)
{
output_low(SPI_SS);
delay(5);
spi_write(addr);
delay(5);
spi_write(value);
delay(5);
output_high(SPI_SS);
}
void CC_SetIdleMode()
{
output_low(SPI_SS);
delay(5);
spi_write(SIDLE);
ReceiveValue = spi_read(SNOP);
delay(5);
spi_write(SFTX);
ReceiveValue = spi_read(SNOP);
delay(5);
output_high(SPI_SS);
}
void CC_ClearTransmitFIFO()
{
output_low(SPI_SS);
delay(5);
spi_write(SFTX);
ReceiveValue = spi_read(SNOP);
delay(5);
output_high(SPI_SS);
}
void CC_TransmitData()
{
static unsigned char CountVar;
while(TransmitData[CountVar] != '\0')
{
TI_CC_SPIWriteReg(TX_FIFO , TransmitData[CountVar]);
++CountVar;
}
CountVar = 0;
}
void CC_CheckNoOfBytesinTXFIFO()
{
output_low(SPI_SS);
delay(5);
spi_write(NUMBER_TXBYTES_IN_FIFO);
ReceiveValue = spi_read(DUMMY);
delay(5);
output_high(SPI_SS);
}
void CC_SetReceiveModeMode()
{
output_low(SPI_SS);
delay(5);
spi_write(SFRX);
ReceiveValue = spi_read(SNOP);
spi_write(SRX);
ReceiveValue = spi_read(SNOP);
delay(5);
output_high(SPI_SS);
}
void CC_SetTransmitModeMode()
{
output_low(SPI_SS);
delay(5);
spi_write(SCAL);
ReceiveValue = spi_read(SNOP);
delay(5);
spi_write(STX);
ReceiveValue = spi_read(SNOP);
delay(250);
spi_write(SIDLE);
ReceiveValue = spi_read(SNOP);
delay(5);
spi_write(SFTX);
ReceiveValue = spi_read(SNOP);
delay(5);
output_high(SPI_SS);
}
BTW, I am using PIC18F for my transmitting side and an MBED LPC1768 for receiving data.
Thanks!!