I have had to go through a lot of memory mapping hoops to get the TMS320 example files to work within DSP/Bios. My latest hurtle is getting SPI working.
When I enter into my SPI interrupt routine I set SpiaRegs.SPIFFTX.bit.TXFFINTCLR in order to clear the transmit interrupt. However, in my watch window I can see that SpiaRegs.SPIFFTX.bit.TXFFINT bit does not change after the command. I have seen this type of behavior before, when implementing other peripherals, from improper memory allocation. As a result, the program keeps entering the interrupt routine. I have attached except of relevant code sections below.
Please help figure out why I can not clear my interrupt. If you know of an alternative way of getting the examples to work with DSP/BIOS, please let me know, since the process is been very fustrating and time consuming. Thank you for your help.
==INTERRUPT ROUTINE (*.C)== Void writeSpi(){ ==GLOBAL VARIABLE DEFS (*.C)== #pragma DATA_SECTION(SpiaRegs,"SpiaRegsFile"); #pragma DATA_SECTION(PieVectTable,"PieVectTableFile"); ==MEMORY MAP (*.CMD)== { /*** Peripheral Frame 2 Register Structures ***/ } ==DSP/BIOS SETTINGS (*.TCF)== /* Serial Peripheral Interface */ /* Peripheral Interrupt Expansion */ /* Interrupt Assignment */
SpiaRegs.SPIFFTX.bit.TXFFINTCLR=1; // clear interrupt flag
PieCtrlRegs.PIEACK.all|= M_INT6; // issue PIE acknowledgement
}
volatile struct SPI_REGS SpiaRegs;
#pragma DATA_SECTION(PieCtrlRegs,"PieCtrlRegsFile");
volatile struct PIE_CTRL_REGS PieCtrlRegs;
struct PIE_VECT_TABLE PieVectTable;
SECTIONS
/*** The PIE Vector table is called PIEVECT by DSP/BIOS ***/
PieVectTableFile : > PIEVECT, PAGE = 1, TYPE = DSECT
PieCtrlRegsFile : > PIE_CTRL PAGE = 1
SpiaRegsFile : > SPIA PAGE = 1
bios.MEM.create("SPIA");
bios.MEM.instance("SPIA").base = 0x007040;
bios.MEM.instance("SPIA").len = 0x0010;
bios.MEM.create("PIE_CTRL");
bios.MEM.instance("PIE_CTRL").base = 0x000ce0;
bios.MEM.instance("PIE_CTRL").len = 0x0020;
bios.PIE.instance("PIE_INT6_1").fxn = prog.extern("readSpi");
bios.PIE.instance("PIE_INT6_1").useDispatcher = 1;
bios.PIE.instance("PIE_INT6_1").monitor = "Data Value";
bios.PIE.instance("PIE_INT6_2").fxn = prog.extern("writeSpi");
bios.PIE.instance("PIE_INT6_2").useDispatcher = 1;
bios.PIE.instance("PIE_INT6_2").monitor = "Data Value";