AnsweredAssumed Answered

21489 SPORT in slave receive mode generates interrupt before receiving all the bits.

Question asked by esterling on May 16, 2018
Latest reply on Jun 6, 2018 by Jithul_Janardhanan

I am using an AD7671 ADC in master serial mode tied to my ADSP-21489 SPORT2. The conversion rate to the ADC is 200KHz. The data that I read from the serial port doesn't seem to be correct, so I added a signal that I toggle when get into the SPORT 2 ISR. The signal is toggling while data is still being shifted in. So it seems that I get an interrupt at the beginning of the serial transfer and not when all the data bits are being received.

 

I read the serial port, do some processing, and output to another serial port to a DAC in the ISR.

 

This is the basic scaled down code.

 

// *********Set up port

// AC A/D SPORT 2 (SLAVE)
SRU(LOW,DAI_PBEN12_I); // SCLK
SRU(LOW,DAI_PBEN13_I); // SYNC
SRU(LOW,DAI_PBEN14_I); // SDOUT

SRU(DAI_PB12_O,SPORT2_CLK_I);
SRU(DAI_PB13_O,SPORT2_FS_I);
SRU(DAI_PB14_O,SPORT2_DA_I);

 

// *********Set up SPORT

r0 = 0;
dm(SPMCTL2) = r0;
dm(SPCTL2) = r0;

 

r0 = 8;
dm(DIV2) = r0;

 

r0 = SPEN_A | SLEN16 | LAFS | FSR | CKRE;
dm(SPCTL2) = r0;

 

// ***********Enable Interrupts

 

BIT CLR MODE1 NESTM; // Disable Nested Interrupts
NOP;
NOP;

 

BIT SET MODE1 CBUFEN; // Enable Circular Buffering

NOP;
NOP;

 

BIT SET MODE1 IRPTEN; // Enable global interrupts
LIRPTL = SP2IMSK;
NOP;
NOP;

 

// **************ISR

_sport2_isr:

PUSH STS;
BIT SET MODE1 SRD1L | SRD1H | SRD2L | SRD2H | SRRFL | SRRFH;
NOP; NOP;

SRU(LOW,DPI_PB13_I);
SRU(HIGH,DPI_PB13_I);

 

r2 = dm(RXSP2A);

r2 = LSHIFT r2 BY -4;

dm(TXSP5A) = r2;

POP STS;
RTI;

_sport2_isr.end:

 

Of coarse there is another interrupt that is used to convert the ADC. The ADC then sends the serial data when done.

 

Anyone with some help?

 

Thanks,

Ed

Outcomes