Other Parts Discussed in Thread: SYSBIOS, AM3359
Hello,
i have the AM3359 with the ICE-Board. Using CCS5, Sysbios 6.35.01.29, ind_sdk_1.1.01.
I want to use the SPI with DMA and want to write/read via SPI/EDMA continously with a 20kHz DMTimer.
At first i´ve took the example McspiFlash_Edma and sent data out via SPI. (it works, but only one time (single shot)
At which point or with which API function / Registry entry i must work within the DMTimer interrupt to call this procedure (McSPITransfer) ?
Now in the example the function WriteEnable() would be called:
static void WriteEnable(void)
{
unsigned int dummy = 0;
unsigned short length = 0;
//txBuffer[0] = FLASH_WRITE_ENABLE;
txBuffer[0] = OUTPUTBYTE;
txBuffer[1] = 0x51;
txBuffer[2] = 0x53;
txBuffer[3] = 0x57;
txBuffer[4] = 0x59;
length = 5;
/* Configure the write enable parameters for Edma transfer.*/
McSpiTxEdmaParamSet(MCSPI_TX_EVENT, MCSPI_TX_EVENT, txBuffer,
length);
/* Configure the write enable parameters for Edma receive.*/
McSpiRxEdmaParamSet(MCSPI_RX_EVENT, MCSPI_RX_EVENT, (unsigned char *)dummy,
length, FALSE);
/* Register the call-back function for Tx/Rx events of McSPI.*/
cb_Fxn[MCSPI_TX_EVENT] = &CallBack;
cb_Fxn[MCSPI_RX_EVENT] = &CallBack;
McSPITransfer(length);
}
/*
** This function will Assert the Chip select line before transmission, will
** enable the Edma events for Tx/Rx of McSPI peripheral, will De-assert the
** Chip select once communication is complete.
*/
static void McSPITransfer(unsigned short length)
{
/* Set the word count field with the data length to be transferred.*/
McSPIWordCountSet(SOC_SPI_0_REGS, length);
/* Force the SPIEN to low state.*/
McSPICSAssert(SOC_SPI_0_REGS, MCSPI_CH_NUM);
/* Enable the Tx/Rx DMA events for McSPI. */
McSPIDMAEnable(SOC_SPI_0_REGS, (MCSPI_DMA_RX_EVENT | MCSPI_DMA_TX_EVENT),
MCSPI_CH_NUM);
/* Enable the McSPI channel for communication.*/
McSPIChannelEnable(SOC_SPI_0_REGS, MCSPI_CH_NUM);
/* wait for IPR18 is set / TX complection code
* EDMA3CC_IPR_I18 (0x00040000u)
* EDMA3CC_IPR_I18_SHIFT (0x00000012u)
*
*/
unsigned int val = 0;
val = HWREG(SOC_EDMA30CC_0_REGS + EDMA3CC_IPR); //check in debug
while(EDMA3CC_IPR_I18 !=
(HWREG(SOC_EDMA30CC_0_REGS + EDMA3CC_IPR) &
EDMA3CC_IPR_I18));
val = (HWREG(SOC_EDMA30CC_0_REGS + EDMA3CC_IPR) & EDMA3CC_IPR_I18); //check in debug
/* Force the SPIEN to high state.*/
McSPICSDeAssert(SOC_SPI_0_REGS, MCSPI_CH_NUM);
/* Disable the McSPI channel for communication.*/
McSPIChannelDisable(SOC_SPI_0_REGS, MCSPI_CH_NUM);
}
After McSPIChannelEnable i can see the 5bytes from txBuffer[] sent via SPI out.
After the breakpoint @while() i let the program run with F6 (step over) and when i run the McSPIDeAssert function I can see in Debug-window that the CortexA8 (running) is in in running mode.
But i cannot find the debug cursor.
In the example are also two ISR function Edma3ComplHandlerIsr and Edma3ErrorHandlerIsr, i have a breakpoint in this functions, but i never reach them?!
1. With which funtion/register i can start the SPI/EDMA transfer everaytime in 20kHz period?
2. Is it necassary after data transceive to use these functions McSPICSDeAssert(), McSPIChannelDisable() and then before new transfer-data to Assert and ChannEnable the McSPI ? ?
Can anyone give me a hint to use SPI/EDMA periodically?
Thank you