Other Parts Discussed in Thread: CC2500
Tool/software:
Hello guys im in need of help, im trying to read the chip ID of the CC2500 module (shown bellow) via SPI communication to further down the line use it.
This is the write and read operations for the CC2500:
This is the code to try and read and write to the CC2500: the P1.0 LED never turns on
#include "intrinsics.h" #include "msp430f5529.h" #include <msp430.h> #include "msp430f5xx_6xxgeneric.h" #include <stdint.h> uint8_t Dados = 0x00; void send(); void read(); int main(void) { WDTCTL = WDTPW + WDTHOLD; // Stop WDT P1DIR |= 0x01; // P1.0 output P4DIR |= BIT7; // P4.7 output // LED desligados P1OUT &= ~BIT0; P4OUT &= ~BIT7; // SPI init - UCB0 UCB0CTL1 |= UCSWRST; UCB0CTL0 |= UCMST + UCSYNC + UCMODE_0; // Master mode + Slave enabled - CS low UCB0CTL1 |= UCSSEL_3; // SMCLK // Bit rate UCB0BR0 = 1; UCB0BR1 = 0; // Port SPI init - 3.0, 3.1, 3.2 e 2.7 P3SEL |= BIT0 + BIT1 + BIT2; P2DIR |= BIT7; P2OUT |= BIT7; //UCB0IE |= UCTXIE + UCRXIE; UCB0CTL1 &= ~UCSWRST; //__bis_SR_register(GIE); // enable interrupts send(); while (1) { read(); // Verificar leitura do registo - ID do modulo RF if (Dados == 0x80) { P4OUT |= BIT7; //__delay_cycles(160000); } else { P4OUT &= ~BIT7; //__delay_cycles(160000); } } } void send() { P2OUT &= ~BIT7; __delay_cycles(50); while(!(UCB0IFG & UCTXIFG)); UCB0TXBUF = 0x30; P2OUT |= BIT7; } void read() { //UCB0IFG &= ~(UCTXIFG + UCRXIFG); //UCB0IE |= UCRXIE; P2OUT &= ~BIT7; __delay_cycles(50); while(!(UCB0IFG & UCTXIFG)); UCB0TXBUF = 0xC0 | 0x30; while(!(UCB0IFG & UCRXIFG)); volatile uint8_t dummy = UCB0RXBUF; while(!(UCB0IFG & UCTXIFG)); UCB0TXBUF = 0x00; while(!(UCB0IFG & UCRXIFG)); Dados = UCB0RXBUF; P1OUT |= BIT0; //__bis_SR_register(GIE); //__bis_SR_register(LPM0_bits + GIE); //__no_operation(); P2OUT |= BIT7; }
This is what i see on the logic analyzer:
If anyone could help me to try and figure out whats wrong i would gladly appreciate it thank you!