TI中文支持网
TI专业的中文技术问题搜集分享网站

MIBSPI问题

我对该程序的理解是MIBSPI自收自发,以TG0~TG3依次软件触发,TG0的收发完成触发TG1的收发,依次类推,但问题是DEBUG结束一直停留在wait的地方,观察RXDATA数组也没有收到数据,不知道哪里的问题,硬件上需要做什么连接吗? 程序如下:

/* USER CODE BEGIN (0) */
/* USER CODE END */

/* Include Files */

#include "sys_common.h"

/* USER CODE BEGIN (1) */
#include "sys_core.h"
#include "mibspi.h"
/* USER CODE END */

/** @fn void main(void)
*@brief Application main function
*@note This function is empty by default.
*
*This function is called after startup.
*The user can use this function to implement the application.
*/

/* USER CODE BEGIN (2) */

uint16 TG0_TX_DATA[8] = {0x1000, 0x1111, 0x1222, 0x1333, 0x1444, 0x1555, 0x1666, 0x1777};
uint16 TG0_RX_DATA[8]= {0};

uint16 TG1_TX_DATA[8] = {0x2000, 0x2111, 0x2222, 0x2333, 0x2444, 0x2555, 0x2666, 0x2777};
uint16 TG1_RX_DATA[8]= {0};

uint16 TG2_TX_DATA[8] = {0x3000, 0x3111, 0x3222, 0x3333, 0x3444, 0x3555, 0x3666, 0x3777};
uint16 TG2_RX_DATA[8]= {0};

uint16 TG3_TX_DATA[8] = {0x4000, 0x4111, 0x4222, 0x4333, 0x4444, 0x4555, 0x4666, 0x4777};
uint16 TG3_RX_DATA[8]= {0};

uint32_t TG3_IS_Complete;

/* USER CODE END */

void main(void)
{
/* USER CODE BEGIN (3) */

	TG3_IS_Complete = 0x55555555;

	/* Enable IRQ Interrupt in Cortex R4 CPU */
	_enable_interrupt_();

	/* - initializing mibspi - enabling tg 0,1,2,3 , length 8 bytes each* TG 0 - Configured for TICK Trigger* TG 1, 2, 3, are SOftware Triggered* CS 0 is used. - CS0 is in HOLD Mode,* CS 0 Toggles only after Each TG ( Every 8 byte) is complete* Trigger is One Shot, so only once the TG will transmit.*/
	mibspiInit();

	/* - enabling loopback ( this is to emulate data transfer without external wires */
	mibspiEnableLoopback(mibspiREG1,Digital_Lbk);


	/* Enable TG 0,1,2,3 complete interrupt to INT 0 */
	mibspiEnableGroupNotification(mibspiREG1,0,0);
	mibspiEnableGroupNotification(mibspiREG1,1,0);
	mibspiEnableGroupNotification(mibspiREG1,2,0);
	mibspiEnableGroupNotification(mibspiREG1,3,0);

	/* Fill the transfer Groups */
	mibspiSetData(mibspiREG1,0,TG0_TX_DATA);
	mibspiSetData(mibspiREG1,1,TG1_TX_DATA);
	mibspiSetData(mibspiREG1,2,TG2_TX_DATA);
	mibspiSetData(mibspiREG1,3,TG3_TX_DATA);

	/* Enable TG0 to start, once tickCNT triggers */
	mibspiTransfer(mibspiREG1,0);

	/* Configure TICKCNT* DATA FORMAT 0 is selected which has SPICLK set as 1000KHz* So tick is 0xFFFF * (1/1000KHz) = 65.5535 msec*/
	mibspiREG1->TICKCNT = 0x8000FFFF;

	/* Wait until this flag is set in TG3 ISR */
	while(TG3_IS_Complete != 0xA5A5A5A5);

	mibspiGetData(mibspiREG1,0,TG0_RX_DATA);
	mibspiGetData(mibspiREG1,1,TG1_RX_DATA);
	mibspiGetData(mibspiREG1,2,TG2_RX_DATA);
	mibspiGetData(mibspiREG1,3,TG3_RX_DATA);

	while(1);


/* USER CODE END */
}

/* USER CODE BEGIN (4) */

void mibspiGroupNotification(mibspiBASE_t *mibspi, uint32 group)
{
	switch (group){
		case 0 :
			/* Enable TG1 to start, SW Trigger */
			mibspiTransfer(mibspiREG1,1);
			break;
		case 1 :
			/* Enable TG1 to start, SW Trigger */
			mibspiTransfer(mibspiREG1,2);
			break;
		case 2 :
			/* Enable TG1 to start, SW Trigger */
			mibspiTransfer(mibspiREG1,3);
			break;
		case 3 :
			/* Enable TG0 to start, SW Trigger */
			//mibspiTransfer(mibspiREG1,0);
			TG3_IS_Complete = 0xA5A5A5A5;
			break;
		default :
			while(1);
			break;
	}
}

/* USER CODE END */

希望得到指导谢谢!

whong zhao:

朋友 您好!

我也正在看mibpsi方面的资料,我想实现一个功能,通过SPI 发送的数据量很大,大约70个  ;uint16 TG0_TX_DATA[70] 

1000多位,连续发送的。

通过mibspi能够实现吗?请指点

 感谢

minchao cai:

回复 whong zhao:

朋友你好,我现在是自发自收都存在问题,是不是即使是自发自收,还是需要把同一块芯片再设置一次,设置成从机然后才可以实现自发自收?

赞(0)
未经允许不得转载:TI中文支持网 » MIBSPI问题
分享到: 更多 (0)