PDA

View Full Version : cc2500/pic18f2420 question



adamsje
- 25th September 2007, 16:43
I've searched CC1100 and CC2500 and didn't find anything on this subject. My apology if I missed it.

My understanding of the CC2500 is that when an address or data is shifted into the CC2500, the CC2500 status is simultaneously shifted out. I can see this on a scope. The 18F2420 data sheet seems to show that data can be shifted into the SSPSR reg simultaneosly as data is shifted out. The data sheet also says that data in the SSPSR reg can be accessed by reading the SSPBUF reg. I'm using the PBP SHIFTOUT command and loading a variable from SSPBUF after a few usec delay. My problem is that what I read from SSPBUF is NOT what I see going into the SDI pin.

I've checked the errata sheets and have found nothing that sees to apply.

Any explanation would be appreciated.

Darrel Taylor
- 30th September 2007, 06:35
If you want to use the MSSP, (Master Synchronous Serial Port) to receive data simultaneously while sending, then you should let the MSSP do them both.

It'll be a lot simpler.
This example might help, but it doesn't take the CC2500 into account, since I've never seen one ...
SDI VAR PORTC.4 ; Data IN Pin for 18F2420
SDO VAR PORTC.5 ; Data OUT
SCK VAR PORTC.3 ; Clock

BF VAR SSPSTAT.0 ; Buffer Full Flag
CKE VAR SSPSTAT.6 ; SPI Clock Select bit
TXbyte VAR BYTE ; Byte to Send
RXbyte VAR BYTE ; Received Byte

SSP_Init:
LOW SCK ; Start with clock and data out (OUTPUT LOW)
LOW SDO
INPUT SDI ; Input is already Default, but just in case
CKE = 1 ; Transmit occurs on transition from
; active to Idle clock state
SSPCON1 = %00100010 ; Enable MSSP, SPI Master, CLK idles low, FOSC/64 clk
;_________________________________________________ ____________________________

Main:
TXbyte = $69
GOSUB SendReceive
; at this point, RXbyte will hold the byte that was shifted in at
; the same time TXbyte was shifted out
PAUSE 1000
GOTO Main

SendReceive:
SSPBUF = TXbyte
REPEAT : UNTIL (BF = 1) ; wait for MSSP to finish shifting
RXbyte = SSPBUF
RETURN

HTH,