This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Dear all,
I'm new with MSP430F5437 and I'm not able to configure the SPI interface with the transceiver cc1020 (slave). These are the functions that a certain main calls:
//SPI interface initialization on MSP430F5437
void SPI_init(void){
UCA1CTL1__SPI=UCSWRST; //Clock is denied
UCB0CTL1__SPI=UCSWRST; //Clock is denied
UCB1CTL1__SPI=UCSWRST; //Clock is denied
UCA0CTL1__SPI=UCSWRST; //Clock is denied
__bis_SR_register(GIE); //interrupts enable
UCA0CTL0__SPI=UCSYNC | UCMSB | UC7BIT; //set SPI mode, MSB first, the frame is 8 bits long
UCA0CTL0__SPI_bit.UCMODE0=1;
UCA0CTL0__SPI_bit.UCMODE1=0;
UCA0CTL1__SPI_bit.UCSSEL0=1; //clock coming from ACLK
UCA0CTL1__SPI_bit.UCSSEL1=0;
UCA0BRW=513; //16 bit to define the divison factor
UCA0CTL0__SPI_bit.UCMST=1; //clock is provided to cc1020
UCA0MCTL__SPI=0; //no modulation is required
UCA0CTL0__SPI_bit.UCCKPL=1; //0 phase and rising clock edge
UCA0CTL0__SPI_bit.UCCKPH=0;
UCA0CTL1__SPI&=~UCSWRST; //Clock starts
UCA0IE__SPI = UCTXIE | UCRXIE;
}
//Write a single configuration register of cc1020 by means of SPI
int cc1020_wr(unsigned char address, unsigned char data){
if(UCA0IFG_bit.UCTXIFG){
UCA0TXBUF=(address<<1)|0x01; //Copy address and the WRITE-command into the output register
while(!UCA0IFG_bit.UCTXIFG){} //waiting for the end of the last transmission
UCA0TXBUF=data; //Copy data the output register
while(!UCA0IFG_bit.UCTXIFG){} //waiting for the end of the last transmission
return 1;
}
return 0;
}
//Read a single configuration register of cc1020 by means of SPI
unsigned char cc1020_rd(unsigned char address){
if(UCA0IFG_bit.UCTXIFG){
UCA0TXBUF=address<<1; //Copy address and the READ-command into the output register
while(!UCA0IFG_bit.UCTXIFG && !UCA0IFG_bit.UCRXIFG){} //waiting for the end of the last transmission and the reception from cc1020
return UCA0RXBUF;
}
return '#';
}
My problem is that neither the flag UCTXIFG nor UCTRXIFG result to be set, so data are never sent.
Thank you!
**Attention** This is a public forum