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.

关于MSP430G2202中USI模块的SPI通讯问题

有没有大佬用过MSP430G系列中的USI模块啊?

它的USI中断是在哪种情况满足才触发?(中断源是啥?)

实际控制时能否通过条件中断来实现数据发送和接收啊?

期待大佬指教0.0

  • 通用同步串行通讯 (USI) ,对于一个 GPIO 数量少的设备来说,是一个高性能串行接口。它是一个 8 或 16bit 移位寄存器,可被用作输出数据,或配合软件一起使用时,可以实现串行通讯。而且 USI 包含了一个能轻松实现 SPI 和 I2C 通讯的硬件功能。

    USI的中断标志为 USIIFG, USISTTIFG

    SPI:

    The bit counter counts the number of sampled bits and sets the USI interrupt flag USIIFG when the USICNTx value becomes zero, either by decrementing or by directly writing zero to the USICNTx bits

    I2C:

    USIIFG is set when USICNTx becomes zero, either by counting or by directly writing 0 to the USICNTx bits. USIIFG is cleared by writing a value > 0 to the USICNTx bits when USIIFGCC = 0, or directly bysoftware.

    USISTTIFG is set when a START condition is detected. The USISTTIFG flag must be cleared by software.


    您可以看一下

    www.ti.com/.../slau144j.pdf

    的14.1 USI Introduction

    Figure 14-1. USI Block Diagram: SPI Mode 和 Figure 14-2. USI Block Diagram: I2C Mode

    以及

    processors.wiki.ti.com/.../I2C_Communication_with_USI_Module
  • 用户手册我已经看过好多遍,USIIFG是USI模块SPI模式的中断标志,但它在程序里是一个宏定义,没有办法赋值,它是随着USICNT是否为0而变化。是否意味着,每次给USICNT赋值,USI中断就会触发呢?
  • 关于您的疑问,请看一下用户指南中的描述

    The bit counter counts the number of sampled bits and sets the USI interrupt flag USIIFG when the USICNTx value becomes zero, either by decrementing or by directly writing zero to the USICNTx bits.

    当USICNTx递减为0或者直接写入0时会置位USIIFG

    Writing USICNTx with a value > 0 automatically clears USIIFG when USIIFGCC = 0, otherwise USIIFG is not affected.

    USICNTx是大于0且USIIFGCC = 0的时候会自动清除USIIFG
  • 网上有这个模块 spi模式使用的中文讲解和例程,楼主可以看看
    blog.csdn.net/.../88013825
  • 这个博客我看过,讲的是eUSCI的,跟USI不一样。