MSP430F6638的例程代码SPI通信验证

2019-03-24 08:39发布

各位大神!!求问啊,我在使用MSP430F6638的SPI主从机例程时,主机的数据UCA0TXBUF确实在增加,我调试从机时,发现没有进入USCI_A0_ISR中断里面进行数据接收啊,请问这是怎么回事啊?而且从机里面有一个p1.4的中断,主机里面也没有啊,不太明白到底是怎么做的额?下面是例程中主机和从机的功能注释,主机:MSP430F66x Demo - USCI_A0, 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.  USCI RX ISR is used to handle
//   communication with the CPU, normally in LPM0. If high, P1.0 indicates
//   valid data reception.  Because all execution after LPM0 is in ISRs,
//   initialization waits for DCO to stabilize against ACLK.
//
//   ACLK = ~32.768kHz, MCLK = SMCLK = DCO ~ 1048kHz.  BRCLK = SMCLK/2
//
//   Use with SPI Slave Data Echo code example. The master code example uses
//   a GPIO P1.1 to reset the SPI slave state machine.
从机: MSP430F66x Demo - USCI_A0, SPI 3-Wire Slave Data Echo
//
//   Description: SPI slave talks to SPI master using 3-wire mode. Data received
//   from master is echoed back.  USCI RX ISR is used to handle communication,
//   CPU normally in LPM0.  Prior to initial data exchange, master pulses
//   slaves USCI RST using an interrupt on P1.4.
//
//   ACLK = ~32.768kHz, MCLK = SMCLK = DCO ~ 1048kHz
//
//   Use with SPI Master Incremented Data code example.

我把程序下载进去,连接好两块单片机的引脚,那个指示灯也没有亮啊!有人知道怎么验证这个代码吗?
此帖出自小平头技术问答
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
8条回答
下雨天不洗澡
2019-03-25 10:00
qwerghf 发表于 2017-3-3 10:41
先看主机发出的数据时什么,有没有逻辑分析仪,可以直接看到总线数据,先要看到总线上有数据

我单步调试主机,看到UCA0TXBUF__SPI        寄存器的值是在递增的额,(我设置的发送数据就是递增的),但是UCA0RXBUF__SPI始终没有读回数据,一直为零。我再调试从机,发现在__bis_SR_register(LPM0_bits+GIE)        这里就停了,没有进入下面的接收数据中断,所以没有把值传回主机,用逻辑分析仪就是查看主机和从机的输入输出引脚有没有值吗?

一周热门 更多>

相关问题

    相关文章