Tool/software: Code Composer Studio
sorry for my bad English, I send a data packet (5 bits) from the master to the subordinate, but nothing comes back. Maybe I'm not using the functions correctly, please help
Look at my very simple project:
static unsigned char g_ucTxBuff[5]={0x9f,0x02,0x03,0x04,0x05};
static unsigned char g_ucRxBuff[5];
void MasterMain()
{
//
// Reset SPI
//
MAP_SPIReset(GSPI_BASE);
//
// Configure SPI interface
//
MAP_SPIConfigSetExpClk(GSPI_BASE,MAP_PRCMPeripheralClockGet(PRCM_GSPI),
SPI_IF_BIT_RATE,SPI_MODE_MASTER,SPI_SUB_MODE_0,
(SPI_SW_CTRL_CS |
SPI_4PIN_MODE |
SPI_TURBO_OFF |
SPI_CS_ACTIVEHIGH |
SPI_WL_8));
//
// Enable SPI for communication
//
MAP_SPIEnable(GSPI_BASE);
MAP_SPICSEnable(GSPI_BASE);
// Send the string to slave.
MAP_SPITransfer(GSPI_BASE, g_ucTxBuff, g_ucRxBuff, 5,
SPI_CS_ENABLE|SPI_CS_DISABLE);
MAP_UtilsDelay(8000000); //delay
Report("%s", g_ucTxBuff); // print tx buf
Report("1");
Report("%s", g_ucRxBuff); //print buf from slave between 1 and 2
Report("2");
MAP_SPICSDisable(GSPI_BASE);
}
static void
BoardInit(void)
{
/* In case of TI-RTOS vector table is initialize by OS itself */
#ifndef USE_TIRTOS
//
// Set vector table base
//
#if defined(ccs)
MAP_IntVTableBaseSet((unsigned long)&g_pfnVectors[0]);
#endif
#if defined(ewarm)
MAP_IntVTableBaseSet((unsigned long)&__vector_table);
#endif
#endif
//
// Enable Processor
//
MAP_IntMasterEnable();
MAP_IntEnable(FAULT_SYSTICK);
PRCMCC3200MCUInit();
}
void main()
{
//
// Initialize Board configurations
//
BoardInit();
//
// Muxing UART and SPI lines.
//
PinMuxConfig();
//
// Enable the SPI module clock
//
MAP_PRCMPeripheralClkEnable(PRCM_GSPI,PRCM_RUN_MODE_CLK);
//
// Initialising the Terminal.
//
InitTerm();
//
// Clearing the Terminal.
//
ClearTerm();
//
// Reset the peripheral
//
MAP_PRCMPeripheralReset(PRCM_GSPI);
MasterMain();
while(1)
{
}
}
So,on the way out I get:
from slave, the output is either empty, or what is sent to the slave is exactly the same
