I am attempting to ulitize the EDMA to loop out data that I have in a 1d array on a OMAPL137. I am getting no activity on the SPI line when I execute my program but if i manually change the data found in SPIDAT1 I get line activity. It is almost as if I am missing something in my EDMA configuration but it looks correct to me with what I have read. I am using CSL for the SPI setup and am manually setting the EDMA registers (CSL headers for EDMA do not properly compile). I see all my settings when I look in memory while the program executes but see no actual SPI activity. This is my Code (based off the spi csl example). Any insight into what the problem might be would be greatly appreciated.
#include <stdio.h>
#include <ti/pspiom/cslr/soc_OMAPL137.h>
#include <ti/pspiom/cslr/cslr_spi.h>
#define SPI_NUM_OF_TXBITS 16
#define SPI_NEW_DATA_NO 0x01
CSL_SpiRegsOvly spiRegs=(CSL_SpiRegsOvly)CSL_SPI_0_REGS;
static void Spi_dev_init();
static void Spi_test();
static Uint32 txlist[3];
void main(void)
{
/* now initialise the SPI controller with appropriate settings */
Spi_dev_init();
/* test the SPI interface by sending the data */
Spi_test();
}
static void Spi_dev_init(void)
{
/* First reset the SPI chip */
spiRegs->SPIGCR0 = CSL_FMK(SPI_SPIGCR0_RESET, CSL_SPI_SPIGCR0_RESET_IN_RESET);
/* now bring the chip out of reset state */
spiRegs->SPIGCR0 = CSL_FMK(SPI_SPIGCR0_RESET, CSL_SPI_SPIGCR0_RESET_OUT_OF_RESET);
/* enable the CLKMOD and MASTER bits in the SPI global control reg */
spiRegs->SPIGCR1 |= CSL_FMK( SPI_SPIGCR1_MASTER,0x01)
| CSL_FMK(SPI_SPIGCR1_CLKMOD,0x01);
/* enable the pins so that they are used for the SPI interface(Multiplex) */
spiRegs->SPIPC0 = CSL_FMK(SPI_SPIPC0_CLKFUN ,0x01)
| CSL_FMK(SPI_SPIPC0_SOMIFUN ,0x01)
| CSL_FMK(SPI_SPIPC0_SIMOFUN ,0x01)
| CSL_FMK(SPI_SPIPC0_SCS0FUN ,0x01);
/* configure the data format in SPIFMT */
spiRegs->SPIFMT[0] = CSL_FMK(SPI_SPIFMT_CHARLEN,SPI_NUM_OF_TXBITS)
| CSL_FMK(SPI_SPIFMT_PRESCALE,0x04);
/* set the preconfigure data format as 0 which is already set above */
spiRegs->SPIDAT1 = CSL_FMKT(SPI_SPIDAT1_DFSEL,FORMAT0)
| CSL_FMK(SPI_SPIDAT1_CSNR,2);
spiRegs->SPIGCR1 |= CSL_FMK(SPI_SPIGCR1_ENABLE,0x01);
/* set txlist */
txlist[0] = 0xFFFFFFFF;
txlist[1] = 0xFFFFFFFF;
txlist[2] = 0xFFFFFFFF;
/* setup registers for PaRAM Set 1 */
/* OPT */
*( volatile Uint32* )0x01C04000 = 0x00000000;
/* SRC */
*( volatile Uint32* )0x01C04004 = ( Uint32 )txlist;
/* A_B_CNT */
*( volatile Uint32* )0x01C04008 = 0x00010001;
/* DST */
*( volatile Uint32* )0x01C0400C = 0x01C41038;
/* SRC_DST_BIDX */
*( volatile Uint32* )0x01C04010 = 0x00000000;
/* LINK_BCNTRLD */
*( volatile Uint32* )0x01C04014 = 0x00004800;
/* SRC_DST_CIDX */
*( volatile Uint32* )0x01C04018 = 0x00000000;
/* CCNT */
*( volatile Uint32* )0x01C0401C = 0x00000001;
/* setup registers for PaRAM Set 64 */
/* OPT */
*( volatile Uint32* )0x01C04800 = 0x00000000;
/* SRC */
*( volatile Uint32* )0x01C04804 = ( Uint32 )txlist;
/* A_B_CNT */
*( volatile Uint32* )0x01C04808 = 0x00010001;
/* DST */
*( volatile Uint32* )0x01C0480C = 0x01C41038;
/* SRC_DST_BIDX */
*( volatile Uint32* )0x01C04810 = 0x00000000;
/* LINK_BCNTRLD */
*( volatile Uint32* )0x01C04814 = 0x00004800;
/* SRC_DST_CIDX */
*( volatile Uint32* )0x01C04818 = 0x00000000;
/* CCNT */
*( volatile Uint32* )0x01C0481C = 0x00000001;
/* EESR */
*( volatile Uint32* )0x01C01030 = 0x8000;
}
static void Spi_test(void)
{
Uint8 tx= 0x40; /* test string to transmit*/
//CSL_FINS(spiRegs->SPIDAT1,SPI_SPIDAT1_TXDATA, tx);
while(1)
{
}
}