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.

MSP430f5529 launchpad SPI loopback test USCI_B0

Other Parts Discussed in Thread: MSP430F5529

Hi

I want to test my MSP430F5529 launchpad's SPI configuration so I have a code to loopback test. I modified the code provided in the below thread so that it is compliant with my version of MSP430. While debugging, when the control goes into the ISR and exits, I get this message:

No source available for "0x200" 

Deassembly code:

        Port_1_2_P1IN, Port_A_PAIN:
000200:   FDFC 0000           AND.B   @R13+,0x0000(R12)
        Port_1_2_P1DIR, Port_A_PADIR:
000204:   0001                MOVA    @PC,SP
        Port_1_2_P1REN, Port_A_PAREN:
000206:   0000                BRA     @PC
        Port_1_2_P1DS, Port_A_PADS:
000208:   0000                BRA     @PC
        Port_1_2_P1SEL, Port_A_PASEL:
00020a:   0000                BRA     @PC
00020c:   0000                BRA     @PC

Kindly suggest what could be the issue. Please find my code, pin connections and the actual thread below:

Main code:

#include <msp430.h>

void initSPI_USCIA(void);                           //initializes SPI on USCIB0 for the sd card reader/writer
void initLED(void);                                 //initializes led so we can toggle it
__interrupt void USCI_B0_ISR(void);

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

    while (!(UCB0IFG & UCTXIFG))
    {
        //wait for ready to transmit
    }
    UCB0TXBUF = 0x11;                                   //writes to spi data register

    _BIS_SR(LPM4_bits + GIE);                           // Enter LPM4 w/interrupts enabled

}



void initSPI_USCIA(void)
{
    UCB0CTL1 |= UCSWRST;                            //set software reset to 1 so we can configure SPI

    UCB0STAT |= UCLISTEN;                           //the launchpad listens to itself (use for testing)
    UCB0CTL0 |= UCCKPH +UCCKPL+ UCMSB + UCMST + UCSYNC;    //clkphase,clkpolarity,MSBfirst,8-bit,master mode, 3-pin, synchronous SPI
    UCB0CTL1 |= UCSSEL_2;                           //choose SMCLK as our clock. SMCLK is 1.1 MHz. We divise it with the baud register
    UCB0BR0 |= 0x02;                                //Baud rate is 1.1MHZ/(2+1) = 366 KHz
    UCB0BR1 = 0;                                    //upper byte of br register. set to zero


    P3SEL |= (BIT0 | BIT1 | BIT2);          //configures pins for three pin SPI. MISO P1.1, MOSI P1.2, CLK P1.4

    UCB0CTL1 &= ~UCSWRST;                   //enables the SPI to work

    UCB0IE |= UCRXIE;                        // Enable USCI0 RX interrupt
}

void initLED(void)
{
         P1DIR |= BIT0;                     //sets red led to output and turns it on
         P1OUT &= ~BIT0;                    //turn red led off
}


#pragma vector=USCI_B0_VECTOR
__interrupt void USCI_B0_ISR(void)
{
	if(UCB0RXBUF == 0x11)
	    {
	        P1OUT = 0x01;                   //turn red led on
	        __delay_cycles(255);
	        P1OUT = 0x00;
	    }
	else
	{
		            P1OUT = 0x01;                   //turn red led on
			        __delay_cycles(255);
			        P1OUT = 0x00;
			        P1OUT = 0x01;                   //turn red led on
			       __delay_cycles(255);
			         P1OUT = 0x00;

	}

	}

PIN CONFIGURATION

P3.0 -->MOSI --> CONNECTED TO MISO

P3.1 -->MISO -->CONNECTED TO MOSI

P3.2 -->SCLK (not connected to anything)

Reference thread

Please suggest some solutions.

Thanks,

  • Hi Vignesh,

    The good news is that your initialization works as expected since your code correctly enters the ISR. However your code enters LPM4 during the main function and is never exited at any point, whether inside of the ISR or otherwise. Therefore when you exit the ISR the MSP430 resumes LPM4 at which point the CPU is unresponsive to debugger control, hence why you get the error message seen. You can either choose to never enter LPM4 or exit LPM4 upon ISR exit but in either of these instances you will have an active CPU and will need to use a while(1) loop at the end of your main function so that the MSP430 never exits main.

    Regards,
    Ryan

**Attention** This is a public forum