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.

[参考译文] MSP430FR5994:SPI 通信中的 ISR 陷阱错误

Guru**** 2390735 points
请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/microcontrollers/msp-low-power-microcontrollers-group/msp430/f/msp-low-power-microcontroller-forum/1037135/msp430fr5994-isr-trap-error-in-spi-communication

器件型号:MSP430FR5994

您好!

我正在尝试使用 SPI 通信发送数据包。 但是、当我从第一个 IF 条件切换到第二个 IF 条件时、我会遇到 ISR_TRAP 错误。 请删除您对此错误的见解。请提前感谢

#include <msp430.h> 
#include <stdio.h>
#include <stdint.h>

void init_SPI()
{
    UCB1CTLW0 |=UCSWRST;
    UCB1CTLW0 &=~UCMSB;
    UCB1CTLW0 |=UCMST;
    UCB1CTLW0 |=UCMODE0;
    UCB1CTLW0 |= UCSSEL__SMCLK;

    UCB1BRW   =10;

    P5SEL0 |= BIT0 | BIT1 | BIT2;

    PM5CTL0 &=~LOCKLPM5;
    UCB1CTLW0 &=~UCSWRST;

    UCB1IE |=~UCTXIE;

    __bis_SR_register(GIE);
}

/**
 * main.c
 */
void main(void)
{
    WDTCTL = WDTPW | WDTHOLD;   // stop watchdog timer
    int i=0;
    init_SPI();
 while(1)
 {
    if(UCB1IFG & UCTXIFG0)
    {
        UCB1TXBUF |=0X4D;
    }
    if(UCB1IFG & UCTXIFG0)
    {
        UCB1TXBUF |=0X5D;
    }
    if(UCB1IFG & UCTXIFG0)
    {
        UCB1TXBUF |=0X6D;
    }
 }
}