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.
Hi,
is this the complete code? Do you go into a LPM mode or stay in active mode? If you maybe go to LPM3 SMCLK might be turned off. In
So the code example below should work for UCA0 and P2.4 and P2.5 and it only turns of CPU by going to LPM0. Is this maybe something you missed.
From the Init I do not see a big issue assuming UCMODE_0 = represents 0x00 to really go into 3 pin mode. Maybe you can post the register settings (debug view register) once the TX buffer was filled.
#include <msp430.h>
unsigned char MST_Data,SLV_Data;
int counter;
int main(void)
{
volatile unsigned int i;
WDTCTL = WDTPW+WDTHOLD; // Stop watchdog timer
FLL_CTL0 |= XCAP11PF; // Configure load caps
// Wait for xtal to stabilize
do
{
IFG1 &= ~OFIFG; // Clear OSCFault flag
for (i = 0x47FF; i > 0; i--); // Time for flag to set
}
while ((IFG1 & OFIFG)); // OSCFault flag still set?
for(i=2100;i>0;i--); // Now with stable ACLK, wait for
// DCO to stabilize.
P5OUT = BIT2; // P5 setup for LED and slave reset
P5DIR |= BIT1+BIT2; //
P2SEL |= BIT4+BIT5;
P3SEL |= BIT0;
UCA0CTL0 |= UCMST+UCSYNC+UCCKPL+UCMSB; //3-pin, 8-bit SPI master
UCA0CTL1 |= UCSSEL_2; // SMCLK
UCA0BR0 = 0x0F; // /2
UCA0BR1 = 0; //
UCA0MCTL = 0; // No modulation
UCA0CTL1 &= ~UCSWRST; // **Initialize USCI state machine**
IE2 |= UCA0RXIE; // Enable USCI_A0 RX interrupt
P5OUT &= ~BIT2; // Now with SPI signals initialized,
P5OUT |= BIT2; // reset slave
for(i=5000;i>0;i--); // Wait for slave to initialize
MST_Data = 0x001; // Initialize data values
SLV_Data = 0x000; //
UCA0TXBUF = MST_Data; // Transmit first character
__bis_SR_register(LPM0_bits + GIE); // CPU off, enable interrupts
}
#if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)
#pragma vector=USCIAB0RX_VECTOR
__interrupt void USCIA0RX_ISR (void)
#elif defined(__GNUC__)
void __attribute__ ((interrupt(USCIAB0RX_VECTOR))) USCIA0RX_ISR (void)
#else
#error Compiler not supported!
#endif
{
volatile unsigned int i;
while (!(IFG2 & UCA0TXIFG)); // USART1 TX buffer ready?
if (UCA0RXBUF==SLV_Data) // Test for correct character RX'd
P5OUT |= BIT1; // If correct, light LED
else
P5OUT &= ~BIT1; // If incorrect, clear LED
MST_Data++; // Increment data
SLV_Data++;
UCA0TXBUF = MST_Data; // Send next value
for(i=30;i>0;i--); // Add time between transmissions to
}
Hi,
did the post above helped to resolve your problem? If not please let us know otherwise I will close this thread latest by 12th February '21.
Hi,
today I programmed the spi_09 example on a F41777 example as shown below and I can see the data out and clock signals on the corresponding pins (put a scope shot below).
Please check if the LFO crystal is connected and the jumps over the fault flag routine of the sample code. If this does not work post a picture of the HW setup.
Hi,
did you had a chance to review my last post? Is there anything which can be done for your?
**Attention** This is a public forum