I have a project that uses PWM1 to trigger an ADC conversion on a 28335 DSP. The conversion complete generates an interrupt. This is setup as an HWI using DSP Bios. Most of the time the execution of the read takes less than 1 us. Sometimes the execution is taking 13 us to execute. The section of code is below that I am referencing. I am using a GPIO pin that gets set at the beginning of execution and cleared at the end. I have checked that there are no other places where this pin is being set. It seems to me that the HWI may be getting interrupted somehow. There is only one other HWI defined and this is for UART communication coming in periodically. Both HWI are set to use the dispatcher with the interrupt mask set to self. Any way that I can prevent this from being interrupted?
void F2833X_adcb_seq_drv_read(ADCVALSB *p)
{
int16 DatQ15;
int32 Tmp;
////ch 0
p->Ch1RAW = AdcRegs.ADCRESULT0 >> 4;
DatQ15 = AdcRegs.ADCRESULT0^0x8000; // Convert raw result to Q15 (bipolar signal)
Tmp = (int32)p->Ch1Gain*(int32)DatQ15; // Tmp = gain*dat => Q28 = Q13*Q15
p->Ch1Out = (int16)(Tmp>>13); // Convert Q28 to Q15
p->Ch1Out += p->Ch1Offset; // Add offset */
////ch 1
p->Ch2RAW = AdcRegs.ADCRESULT1 >> 4;
DatQ15 = AdcRegs.ADCRESULT1^0x8000; // Convert raw result to Q15 (bipolar signal)
Tmp = (int32)p->Ch2Gain*(int32)DatQ15; // Tmp = gain*dat => Q28 = Q13*Q15
p->Ch2Out = (int16)(Tmp>>13); // Convert Q28 to Q15
p->Ch2Out += p->Ch2Offset; // Add offset */
////ch 2
p->Ch3RAW = AdcRegs.ADCRESULT2 >> 4;
DatQ15 = AdcRegs.ADCRESULT2^0x8000; // Convert raw result to Q15 (bipolar signal)
Tmp = (int32)p->Ch3Gain*(int32)DatQ15; // Tmp = gain*dat => Q28 = Q13*Q15
p->Ch3Out = (int16)(Tmp>>13); // Convert Q28 to Q15
p->Ch3Out += p->Ch3Offset; // Add offset */
////ch 3
p->Ch4RAW = AdcRegs.ADCRESULT3 >> 4;
DatQ15 = AdcRegs.ADCRESULT3^0x8000; // Convert raw result to Q15 (bipolar signal)
Tmp = (int32)p->Ch4Gain*(int32)DatQ15; // Tmp = gain*dat => Q28 = Q13*Q15
p->Ch4Out = (int16)(Tmp>>13); // Convert Q28 to Q15
p->Ch4Out += p->Ch4Offset; // Add offset
p->Ch5RAW = AdcRegs.ADCRESULT4 >> 4;
DatQ15 = AdcRegs.ADCRESULT4^0x8000; // Convert raw result to Q15 (bkipolar signal)
Tmp = (int32)p->Ch5Gain*(int32)DatQ15; // Tmp = gain*dat => Q28 = Q13*Q15
p->Ch5Out = (int16)(Tmp>>13); // Convert Q28 to Q15
p->Ch5Out += p->Ch5Offset; // Add offset
p->Ch6RAW = AdcRegs.ADCRESULT5 >> 4;
p->Ch7RAW = AdcRegs.ADCRESULT6 >> 4;
p->Ch8RAW = AdcRegs.ADCRESULT7 >> 4;
AdcRegs.ADCTRL2.all |= 0x4000; // Reset the sequence
AdcRegs.ADCTRL2.bit.RST_SEQ1 = 1; // Reset SEQ1
AdcRegs.ADCST.bit.INT_SEQ1_CLR = 1;
}