Hello,
I am trying to find an example code that would help to communicate with RF430FRL152 SPI interface.
I have created a custom command which would send 0xBB data on SPI when triggered:
#pragma CODE_SECTION (userCustomCommand, ".fram_driver_code") //see .cmd file for details - all new firmware must go into fram_driver_code memory section space
void userCustomCommand()
{
if( RF13MFIFOFL_L == CRC_LENGTH_IN_BUFFER + 1) // CRC_LENGTH + 1 byte expected
{
P1SEL0 |= BIT3 + BIT2 + BIT1 + BIT0; // CLK, MOSI, MISO, CS option select registers
P1SEL1 |= BIT3 + BIT2 + BIT1 + BIT0;
P1DIR |= BIT3 + BIT2 + BIT0; // Enable, output direction
UCB0CTLW0 |= UCSWRST; // reset
UCB0CTLW0 |= UCMSB + UCMST + UCSYNC + UCMODE_2 + UCSTEM;
UCB0CTL1 |= UCSSEL_2; // SMCLK as clock source
UCB0BR0 = 0x02;
UCB0BR1 = 0;
UCB0CTLW0 &= ~UCSWRST;
UCB0TXBUF = 0xBB;
RF13MTXF_L = 0x0; // no error, send out
}
else
{
RF13MTXF_L = 0x1; // an error response
}
The problem is that I lack documentation on how to correctly implement SPI communication. What I have tried to develop is not working. I have checked with digital analyzer: MISO, MOSI, CLK lines are low, CS (P.1.3) periodically toggles on and off (looks like a clock signal). I haven’t expected that behavior.
Where I could find any working samples on how to implement SPI communication on RF430FRL152? Thank you.
P.S. I removed R20 resistor on the EVM board in order to use SPI communication.