Hi all,
I have some issues related to handling interrupts on EVM5515 board. If I can get some examples on this issue I can figure out my problems. Any documentation or advice is welcomed.
Regards,
***.
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hi all,
I have some issues related to handling interrupts on EVM5515 board. If I can get some examples on this issue I can figure out my problems. Any documentation or advice is welcomed.
Regards,
***.
Hey Ekrem,
http://software-dl.ti.com/dsps/dsps_public_sw/dsps_swops_houston/C55X/CSL-c55x-lowpower-versions.htm
Download:
TMS320C55XXCSL-LOWPWR-2.50.00.00-Setup.exe
There are many examples of interrupts!
Generally you have to include the csl in your project!
when #include "csl_intc.h" in file and use the IQR functions.
begin with
/* Reference the start of the interrupt vector table */
/* This symbol is defined in file vectors.asm */
extern void VECSTART(void);
and call
IRQ_setVecs((Uint32)(&VECSTART));
/* Plug the xxx_isr into the vector table */
IRQ_plug(xxx);
/* Enabling Interrupt */
IRQ_enable(xxx);
....
maybe you have to fit the .cmd file!
hope it helps!?
Regards
Basti
Hello Basti,
I appreciate your help. I have already installed CSL library examples but I only see one example about SAR usage. I am still dealing with this interrupt issue, I want to implement a loop to read data but I think I have a confusion about interrupt usage. This is the reason that I request extra more examples.
Regards.
Ekrem.
Hello Ekrem,
can you give more information about your programm???
I need some infromation about the order of events. What is your problem exactly ? You see in debug that you jump in isr or you can´t call it?!
Regards
Basti
Hello Basti,
You are really fast in response :) As far as I understand you are also working with ADS1298. My problem is to read data in RDATA mode but not in RDATAC mode. I have already achieved to take continuous data in RDATAC mode. In the data sheet it states that DRDY signal is continuously produced independent of the reading mode. That is, DRDY signal will be periodically produced whether or not I send RDATA command.
After IRQ_globalEnable(); CPU enters into IR since it does not require an RDATA command. But the data will not be ready if I do not send an RDATA command. My confusion starts at this point. CPU enters interrupt periodically and I cannot prevent this.
Please see the code below (I omit variable declerations):
interrupt void intISR()
{
wLen=24;
fLen=9;
IRQ_disable(INT1_EVENT);
Modified_SPI_Read(ECGDataSample, wLen, fLen);
dataOut[evenFlag] = ECGDataSample[4]; //reading one channel data for now.
if (evenFlag==16384)
{
*CPU_IER0_ADDR = *CPU_IER0_ADDR & 0x0000;
*CPU_TIM0_CTRL = *CPU_TIM0_CTRL & 0x0000;
asm("\tBIT (ST1, #ST1_INTM) = #1");
}
evenFlag++;
return;
}
When use this code my data will not be ready during reading. Therefore I added another part to send RDATA command.
interrupt void intISR()
{
wLen=24;
fLen=9;
IRQ_disable(INT1_EVENT);
Command[0]=0x0012; //RDATA
Command[1]=0x0000;
CSL_FINS(CSL_SPI_REGS->SPICMD1,SPI_SPICMD1_FLEN,2);
CSL_FINS(CSL_SPI_REGS->SPICMD2,SPI_SPICMD2_CLEN,SPI_WORD_LENGTH_16);
SPI_write(hSpi, Command, 2);
Modified_SPI_Read(ECGDataSample, wLen, fLen); ............... (rest is the same).
But there is an egg-chicken dilemma in this code since it executes RDATA command after entering interrupt but not before the interrupt. In addition, when I look at the memory for dataOut register, it is filled by zeros.
I tried to explain my problem in detail, I am always in front of the computer therefore I really appreciate your help if you guide me to solve this issue.
Regards.
Hello Ekrem,
IRQ_disable(INT1_EVENT); so you disable the interrupt every time! Why you do this?
You don´t need to disable it every time.
pleace comment out! // IRQ_disable(INT1_EVENT);
make the programstructure like this:
main()
{
init all you need and enable interrupts
take a while loop like
while(xxx)
{
read data in buffer
....
}
}
interrupt isr()
{
if sar is ready write data in buffer...
}
disable it only if you want only 1 times a value!
hope it helps, if not i need more time for next answer!^^
Regards
Basti.
Hello Basti,
I have followed your recommendations but could not succeed to read data. I think the problem stems form interrupt return procedure. I added the below code, if you comment on it I will appreciate.
Regards.
Command[0]=0x0011; //SDATAC
Command[1]=0x0000;
SPI_write(hSpi, Command, 2);
wait(74000);
hwConfig.frLen = 0x1A; //Write to registers
result = SPI_config(hSpi, &hwConfig);
SPI_write(hSpi, ADS1298RegVal, 26);
wait(1);
Command[0]=0x0021; //RREG
Command[1]=0x0018;
SPI_write(hSpi, Command, 2);
wait(74000);
SPI_read(hSpi, comReadBuff, 24);
Command[0]=0x0012; //RDATA
Command[1]=0x0000;
SPI_write(hSpi, Command, 2);
intFunc();
}
void intFunc (void)
{
/* Initialize Interrupt Vector table */
IRQ_setVecs((Uint32)(&VECSTART));
IRQ_plug(INT1_EVENT,&intISR);
/* Enabling Interrupt */
IRQ_enable(INT1_EVENT);
IRQ_globalEnable();
while(1) //finite loop to take 16384 data
{
sendRDATA();
if (evenFlag==16384)
{
*CPU_IER0_ADDR = *CPU_IER0_ADDR & 0x0000;
*CPU_TIM0_CTRL = *CPU_TIM0_CTRL & 0x0000;
asm("\tBIT (ST1, #ST1_INTM) = #1");
break;
}
}
}
interrupt void intISR()
{
readData(ECGData, wLen, fLen);
dataOut[evenFlag] = ECGData;
evenFlag++;
IRQ_clear(INT1_EVENT);
}
void readData(Uint32* InpBuf, Uint16 wordLength, Uint16 FremLen)
{
Uint8 bufIndex = 0;
Uint16 spiStatusReg;
Uint16 spiWcStaus;
Uint16 spiBusyStatus;
Uint32 ReadVal = 0;
CSL_FINS(CSL_SPI_REGS->SPICMD1,SPI_SPICMD1_FLEN,FremLen);
CSL_FINS(CSL_SPI_REGS->SPICMD2,SPI_SPICMD2_CLEN,wordLength);
for(bufIndex = 0; bufIndex < FremLen; bufIndex++)
{
CSL_SPI_REGS->SPIDR1 = 0x00;
CSL_SPI_REGS->SPIDR2 = 0x00;
/* set operation */
/* set start CMD - Read */
CSL_FINS(CSL_SPI_REGS->SPICMD2, SPI_SPICMD2_CMD,
CSL_SPI_SPICMD2_CMD_READ);
do
{
spiStatusReg = CSL_SPI_REGS->SPISTAT1;
spiBusyStatus = (spiStatusReg & CSL_SPI_SPISTAT1_BSY_MASK);
spiWcStaus = (spiStatusReg & CSL_SPI_SPISTAT1_CC_MASK);
}while((spiBusyStatus == CSL_SPI_SPISTAT1_BSY_BUSY) &&
(spiWcStaus != CSL_SPI_SPISTAT1_CC_MASK));
ReadVal = CSL_SPI_REGS->SPIDR2;
ReadVal = ReadVal << 16;
ReadVal |= CSL_SPI_REGS->SPIDR1 ;
ReadVal &= 0x00FFFFFF;
InpBuf[bufIndex] = ReadVal;
}
}
void sendRDATA(void)
{
Uint16 spiStatusReg;
Uint16 spiWcStaus;
Uint16 spiBusyStatus;
CSL_SPI_REGS->SPIDR1 = 0x0000;
CSL_SPI_REGS->SPIDR2 = 0x0012; //RDATA opcode
/* set operation */
/* set start CMD - Write */
CSL_FINS(CSL_SPI_REGS->SPICMD2, SPI_SPICMD2_CMD, SPI_WRITE_CMD);
do
{
spiStatusReg = CSL_SPI_REGS->SPISTAT1;
spiBusyStatus = (spiStatusReg & CSL_SPI_SPISTAT1_BSY_MASK);
spiWcStaus = (spiStatusReg & CSL_SPI_SPISTAT1_CC_MASK);
}while((spiBusyStatus == CSL_SPI_SPISTAT1_BSY_BUSY) &&
(spiWcStaus != CSL_SPI_SPISTAT1_CC_MASK));
}
Hmm, sorry i can not help! But i hope ti will help you.
Maybe a timing problem!?
Regards
Sebastian