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.

MSP430F1611: MSP430F1611 SPI problem

Part Number: MSP430F1611
Other Parts Discussed in Thread: MSP430F5324, MSP430G2553

Hi,
I want to communicate the MSP430F1611 with any other controller (e.g Arduino ) or other MSP430F1611 using SPI communication, I visited this (gist.github.com/.../3326502) link and try to load this code but there is a problem,

These code line show errors,

  P1SEL = BIT1 + BIT2 + BIT4;
  P1SEL2 = BIT1 + BIT2 + BIT4;
  UCA0CTL1 = UCSWRST;                       // **Put state machine in reset**
  UCA0CTL0 |= UCMSB + UCSYNC;               // 3-pin, 8-bit SPI master
  UCA0CTL1 &= ~UCSWRST;                     // **Initialize USCI state machine**
  IE2 |= UCA0RXIE;  

the errors is,

Error[Pe020]: identifier "P1SEL2" is undefined
Error[Pe020]: identifier "UCA0CTL1" is undefined 
Error[Pe020]: identifier "UCSWRST" is undefined 
Error[Pe020]: identifier "UCA0CTL0" is undefined 
Error[Pe020]: identifier "UCMSB" is undefined 
Error[Pe020]: identifier "UCSYNC" is undefined 
Error[Pe020]: identifier "UCA0RXIE" is undefined 


Please help me to solve this problem.

Thank you

Regard.
Engr. Rizwan Khalid

  • Hi,

    that is because those identifiers are not defined in the msp430.h, respectively in msp430f1611.h for the MSP430F1611. They belong to a different MSP430. If I click your link, I get a 404 error.

    The MSP430F1611 has not an USCI (Universal Serial Communication Interface), but a universal synchronous/asynchronous receive/transmit (USART).

    Please check our code examples which can be found on the product folder MSP430F1611 under the tab "Tools & software".

    fet140_spi0_05.c - Master SPI

    fet140_spi0_06.c - Slave SPI

    You can also find both in our TI Resource Explorer.

    The MSP430F1611 is one of our older generation of micro controllers. I would recommend to go with a newer version which would be the MSP430F5324. It has comparable specification, but comes at a much lower price point $9.34 vs $2.14.

    Best regards,

    Andre

  • Its shows no error,
    Now I'll check that whether is send data to slave or not.
    Thank you so much
  • Now I want to send any data from the master to slave, e.g when I press any button that is attached on any PIN (e.g P2.0) of the master, the LED will be ON attached on any PIN (e.g P4.0) of the slave.
    please tell me how it will do??
  • Hi Rizwan,

    please understand that we can't provide example code for complete applications. In your case you have three components.

    1. I2C communication

    2. Push button event

    3. LED on or blinking

    For LED blink please see this examples in the code examples: fet140_1.c

    We don't have an example for the push button event for the MSP430F1611, but you can use one of the MSP430G2553. The only difference is, that the MSP430G2553 has an internal pull up and the MSP430F1611 has not. You need to place one external. The pull up is necessary to have a defined signal and to not leave the pin floating.

    http://dev.ti.com/tirex/#/Device/MSP430G2553/?link=Software%2FMSP430Ware%2FDevices%2FMSP430G2553%2FPeripheral%20Examples%2FRegister%20Level%2Fmsp430g2xx3_P1_04.c

    #include <msp430.h>
    
    int main(void)
    {
      WDTCTL = WDTPW + WDTHOLD;                 // Stop watchdog timer
      P1DIR = 0x01;                             // P1.0 output, else input
      P1OUT =  0x10;                            // P1.4 set, else reset
    // The MSP430F1611 has no internal pull-ups 

    // P1REN |= 0x10; // P1.4 pullup P1IE |= 0x10; // P1.4 interrupt enabled P1IES |= 0x10; // P1.4 Hi/lo edge P1IFG &= ~0x10; // P1.4 IFG cleared __bis_SR_register(LPM4_bits + GIE); // Enter LPM4 w/interrupt } // Port 1 interrupt service routine #if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__) #pragma vector=PORT1_VECTOR __interrupt void Port_1(void) #elif defined(__GNUC__) void __attribute__ ((interrupt(PORT1_VECTOR))) Port_1 (void) #else #error Compiler not supported! #endif { P1OUT ^= 0x01; // P1.0 = toggle P1IFG &= ~0x10; // P1.4 IFG cleared }

    Best regards,

    Andre

  • ok
    Thanks your time...!

**Attention** This is a public forum