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.

MSP430FR5969: eSCU_A1 SPI Master Clock not read on output pin

Part Number: MSP430FR5969
Other Parts Discussed in Thread: MSP430WARE, , MSP-EXP430FR5969

I am having a problem with the SPI CLK output for the eSCU_A1 module. Since my code wasn't working, I pulled the TI example for the eSCU_A0 module example code for a 3-SPI Master and modified it for the eSCU_A1 module. Unfortunately, that code doesn't work either. I have put an oscilloscope on the SPI pins

A1 SPI CLK  -> (Expected = Clock, Measured = noise, no clk)
A1 SPI SIMO -> (Expected = Data packets, Measured = Data packets)
A1 SPI SOMI -> No Driver (Expected value = noise, Measured = noise)

Here is the test code. I have searched the forums and cannot find a similar problem with a solution that worked for me. Any ideas?

/* --COPYRIGHT--,BSD_EX
 * Copyright (c) 2012, Texas Instruments Incorporated
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * *  Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *
 * *  Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * *  Neither the name of Texas Instruments Incorporated nor the names of
 *    its contributors may be used to endorse or promote products derived
 *    from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 *******************************************************************************
 *
 *                       MSP430 CODE EXAMPLE DISCLAIMER
 *
 * MSP430 code examples are self-contained low-level programs that typically
 * demonstrate a single peripheral function or device feature in a highly
 * concise manner. For this the code may rely on the device's power-on default
 * register values and settings such as the clock configuration and care must
 * be taken when combining code from several examples to avoid potential side
 * effects. Also see www.ti.com/grace for a GUI- and www.ti.com/msp430ware
 * for an API functional library-approach to peripheral configuration.
 *
 * --/COPYRIGHT--*/
//******************************************************************************
//   MSP430F59xx Demo - eUSCI_A1, SPI 3-Wire Master Incremented Data
//
//   Description: SPI master talks to SPI slave using 3-wire mode. Incrementing
//   data is sent by the master starting at 0x01. Received data is expected to
//   be same as the previous transmission TXData = RXData-1.
//   USCI RX ISR is used to handle communication with the CPU, normally in LPM0.
//   ACLK = 32.768kHz, MCLK = SMCLK = DCO ~1MHz.  BRCLK = ACLK/2
//
//
//                   MSP430FR5969
//                 -----------------
//            /|\ |                 |
//             |  |                 |
//             ---|RST              |
//                |                 |
//                |             P2.5|-> Data Out (UCA1SIMO)
//                |                 |
//                |             P2.6|<- Data In (UCA1SOMI)
//                |                 |
//                |             P2.4|-> Serial Clock Out (UCA1CLK)
//
//******************************************************************************
#include <msp430.h>

volatile unsigned char RXData = 0;
volatile unsigned char TXData;

int main(void)
{
  WDTCTL = WDTPW | WDTHOLD;                 // Stop watchdog timer

  // Configure GPIO
  P2SEL1 |= BIT4 | BIT5 | BIT6;             // USCI_A1 operation
//  P2SEL0 &= ~(BIT4 | BIT5 | BIT6);

  // Disable the GPIO power-on default high-impedance mode to activate
  // previously configured port settings
  PM5CTL0 &= ~LOCKLPM5;

  // Configure USCI_A1 for SPI operation
  UCA1CTLW0 = UCSWRST;                      // **Put state machine in reset**
  UCA1CTLW0 |= UCMST | UCSYNC | UCCKPL | UCMSB; // 3-pin, 8-bit SPI master
                                            // Clock polarity high, MSB
  UCA1CTLW0 |= UCSSEL__SMCLK;               // SMCLK
  UCA1BR0 = 0x02;                           // /2
  UCA1BR1 = 0;                              //
  UCA1MCTLW = 0;                            // No modulation
  UCA1CTLW0 &= ~UCSWRST;                    // **Initialize USCI state machine**
  UCA1IE |= UCRXIE;                         // Enable USCI_A1 RX interrupt
  TXData = 0x1;                             // Holds TX data

  while(1)
  {
    UCA1IE |= UCTXIE;
    __bis_SR_register(LPM0_bits | GIE);     // CPU off, enable interrupts
    __delay_cycles(2000);                   // Delay before next transmission
    TXData++;                               // Increment transmit data
  }
}

#if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)
#pragma vector=USCI_A1_VECTOR
__interrupt void USCI_A1_ISR(void)
#elif defined(__GNUC__)
void __attribute__ ((interrupt(USCI_A1_VECTOR))) USCI_A1_ISR (void)
#else
#error Compiler not supported!
#endif
{
  switch(__even_in_range(UCA1IV, USCI_SPI_UCTXIFG))
  {
    case USCI_NONE: break;
    case USCI_SPI_UCRXIFG:
      RXData = UCA1RXBUF;
      UCA1IFG &= ~UCRXIFG;
      __bic_SR_register_on_exit(LPM0_bits); // Wake up to setup next TX
      break;
    case USCI_SPI_UCTXIFG:
      UCA1TXBUF = TXData;                   // Transmit characters
      UCA1IE &= ~UCTXIE;
      break;
    default: break;
  }
}

**Attention** This is a public forum