Hi,
my name is Davide Marchei and I bought the CC2520 EMK.
I should connect a F28027 with CC2520 via SPI. I connected the RESETn and VREG_EN pins of the CC2520 to VDD. I connected two devices in 4-wire mode.
I'm trying to ping with the CC2520 by sending a byte with all 0, in order to receive the status of the RF, but I get no response.
The GPIO ports configuration of the F28027 is:
GpioCtrlRegs.GPAMUX2.bit.GPIO16 = 1; // 0=GPIO, 1=SPISIMO-A, 2=Resv, 3=TZ2
GpioCtrlRegs.GPADIR.bit.GPIO16 = 1; // 1=OUTput, 0=INput
//--------------------------------------------------------------------------------------
GpioCtrlRegs.GPAMUX2.bit.GPIO17 = 1; // 0=GPIO, 1=SPISOMI-A, 2=Resv, 3=TZ3
GpioCtrlRegs.GPADIR.bit.GPIO17 = 0; // 1=OUTput, 0=INput
//--------------------------------------------------------------------------------------
GpioCtrlRegs.GPAMUX2.bit.GPIO18 = 1; // 0=GPIO, 1=SPICLK-A, 2=SCITX-A, 3=XCLKOUT
GpioCtrlRegs.GPADIR.bit.GPIO18 = 1; // 1=OUTput, 0=INput
GpioDataRegs.GPASET.bit.GPIO18 = 1; // uncomment if --> Set High initially
//--------------------------------------------------------------------------------------
GpioCtrlRegs.GPAMUX2.bit.GPIO19 = 1; // 0=GPIO, 1=SPISTE-A, 2=SCIRX-A, 3=ECAP1
GpioCtrlRegs.GPADIR.bit.GPIO19 = 1; // 1=OUTput, 0=INput
The SPI configuration is:
EALLOW;
SpiaRegs.SPICCR.bit.SPISWRESET = 0;
SpiaRegs.SPICCR.bit.SPICHAR = 7;
SpiaRegs.SPICCR.bit.SPILBK = 0;
SpiaRegs.SPICCR.bit.CLKPOLARITY = 0;
SpiaRegs.SPICTL.bit.TALK = 1;
SpiaRegs.SPICTL.bit.MASTER_SLAVE = 1;
SpiaRegs.SPICTL.bit.CLK_PHASE = 0;
SpiaRegs.SPIPRI.bit.FREE = 1;
SpiaRegs.SPIBRR = 126;
SpiaRegs.SPIFFCT.all= 0;
SpiaRegs.SPIPRI.bit.TRIWIRE=0;
SpiaRegs.SPICCR.bit.SPISWRESET = 1;
EDIS;
The code that I use to send and receive is the following:
//Send
if(cmd==1){
if (SpiaRegs.SPISTS.bit.BUFFULL_FLAG!= 1) {
SpiaRegs.SPITXBUF = dataTX;// non-FIFO mode
null = SpiaRegs.SPIRXBUF;
cmd=0;
}}
//Receive
if (SpiaRegs.SPISTS.bit.INT_FLAG == 1) {
dataRX = SpiaRegs.SPIRXBUF;
}
where:
char dataTX;
char dataRX;
char null;
char cmd;
The communication must be 8-bit or 16 bit? Create a problem that the SPIRXBUF register of SPI is 16 bit, while the commands that should receive the RF is 8 bits?! There is more detailed material on communication between the F28027 (or others of the same family) with CC2520?!
Regards.
Davide Marchei