Quantcast
Channel: MSP low-power microcontrollers
Viewing all articles
Browse latest Browse all 62309

Forum Post: RE: SPI communication

$
0
0
Hi Wei. Jetim Zhao, I have tried to code for the cc2500 where i am trying to send data using cc2500 , so is there a way to verify if data is transmitted or if the buffer is filled with data? Below i have mentioned the code for transmission, also can you tell me the significance of GDO2 pin (Chip_rdy) as i am getting confused with its functioning. #include "include.h" #include #include "msp430f5528.h" #include "math.h" #include extern char paTable[]; extern char paTableLen; char txBuffer[5]; int test[10]; void main(void) { WDTCTL = WDTPW + WDTHOLD; // Stop WDT PMMCTL0 = PMMPW; // Open PMM Module PM5CTL0 &= ~LOCKLPM5; // 5ms delay to compensate for time to startup between MSP430 and CC1100/2500 __delay_cycles(1000000); TI_CC_SPISetup(); // Initialize SPI port TI_CC_PowerupResetCCxxxx(); // Reset CCxxxx __delay_cycles(1000000); writeRFSettings(); // Write RF settings to config reg TI_CC_SPIWriteBurstReg(TI_CCxxx0_PATABLE, paTable, paTableLen);//Write PATABLE test[0]=TI_CC_SPIReadReg(TI_CCxxx0_IOCFG2); test[1]=TI_CC_SPIReadReg(TI_CCxxx0_IOCFG0); test[2]=TI_CC_SPIReadReg(TI_CCxxx0_PKTLEN); test[3]=TI_CC_SPIReadReg(TI_CCxxx0_PKTCTRL1); test[4]=TI_CC_SPIReadReg(TI_CCxxx0_PKTCTRL0); test[5]= TI_CC_SPIReadReg(TI_CCxxx0_ADDR); test[6]=TI_CC_SPIReadStatus(TI_CCxxx0_PARTNUM); test[7]=TI_CC_SPIReadStatus(TI_CCxxx0_VERSION); if(test[0] == 41) { puts("cc2500 intialised"); __delay_cycles(3000000); } else { puts("cc2500 not initialised"); __delay_cycles(1000000); } while(1){ TI_CC_SPIStrobe(TI_CCxxx0_SIDLE); TI_CC_SPIStrobe(TI_CCxxx0_STX); txBuffer[0] = 4; // Packet length txBuffer[1] = 0x01; // Packet address txBuffer[2] = 0x41; // red txBuffer[3] = 0x42; // green txBuffer[4] = 0x43; // blue RFSendPacket(txBuffer, 5); __delay_cycles(10000); } } Thank you Pratiksha Bhuta

Viewing all articles
Browse latest Browse all 62309

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>