I use the AD software trigger but can not into the interrupt,can you help me look where is the problem。
the main procedure fellow:
const adc_converter_config_t adConv1_ConvConfig0 =
{
.clockDivide = ADC_CLK_DIVIDE_1,
.sampleTime = 12U,
.resolution = ADC_RESOLUTION_8BIT,
.inputClock = ADC_CLK_ALT_1,
.trigger = ADC_TRIGGER_SOFTWARE,
.dmaEnable = false,
.voltageRef = ADC_VOLTAGEREF_VREF,
.continuousConvEnable = false,
};
const adc_chan_config_t adConv1_ChnConfig0 =
{
.interruptEnable = true,
.channel = ADC_INPUTCHAN_AD0,
};
ADC_DRV_ConfigConverter(INST_ADCONV1, &adConv1_ConvConfig0);
INT_SYS_InstallHandler(ADC1_IRQn, &adISR,(isr_t *)0);
INT_SYS_EnableIRQ(ADC1_IRQn);
ADC_DRV_ConfigChan(INST_ADCONV1, 0U, &adConv1_ChnConfig0);
void adISR(void)
{
ADC_DRV_GetChanResult(INST_ADCONV1, 0U, &adcRawValue);
}
this can not into adISR
Hi,
Are you kind enough to provide the following details:
1) Design Studio version
2) SDK version;
3) Mask set for the microcontroller you are using.
These will help us narrow down the area where to look.
Thanks.
Hi jiangbolwj,
the SDK 0.8.2 supports the latest MCU revisions. These are mounted on S32K144EVB-Q100.
The FRDM board has MCU with first revision (mask 0N77P) mounted. There are differences in vector table, the vector for the ADC0 is the same but ADC1 not, that could be a reason why the ADC1 interrupt is not working on your board.
The S32 sdk ear 0.8.1 supports cut1 MCU (mask 0N77P).
BR, Petr
Hi jiangbolwj,
Thank you for sending the information and attaching the code.
I have found you problem!
In software trigger mode function "ADC_DRV_ConfigChan" always restarts the ADC conversion, regardless if another conversion was already started.
Because the CPU runs at a higher frequency than the ADC and you are calling "ADC_DRV_ConfigChan" continuously inside the while(1) loop, the ADC never gets a chance to complete a conversion, thus no interrupt is generated.
If you use a delay after calling "ADC_DRV_ConfigChan" then it will trigger the interrupt.
You can also use function "ADC_DRV_WaitConvDone" between two consecutive calls of "ADC_DRV_ConfigChan" function for the same ADC peripheral.
Our ADC also supports timer based triggering, this means you can use a LPIT timer to start the ADC conversion automatically at specific time intervals, please look in the examples.
I hope this helps you.
Sincerely,
Dragos.