hi,
i use TM4C123GH6PGE and keil development, CAN in interrupt Handler, SPI and ADC (PE4 (IN09)) in ADC_TRIGGER_PROCESSOR. The problem is : when i send a SDO CAN to the board, ADC value register is not refresh all the time and i have a bad value! I think the trigger generated by the processor is stopped by CAN task!
in debug mode, Under task CAN SDO, i watch ADC register refreshed periodically but when i send CAN SDO, ADC register stop to refresh and refresh step when i send CAN SDO. SPI works good
the configuration:
SysCtlClockSet(SYSCTL_SYSDIV_2_5|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|SYSCTL_OSC_MAIN);
init ADC:
//Enable ADC peripheral
SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC0);
//Configure pin for ADC reading
GPIOPinTypeADC(GPIO_PORTE_BASE, GPIO_PIN_4);
//Disable sample sequencer before configure it
ADCSequenceDisable(ADC0_BASE, 0);
//Configure sample sequencer
ADCSequenceConfigure(ADC0_BASE, 0, ADC_TRIGGER_PROCESSOR , 0);
//Configure sample step for the sample sequencer
ADCSequenceStepConfigure(ADC0_BASE, 0, 0, ADC_CTL_CH9 | ADC_CTL_END);
//Configure number of sample used to calculate average
ADCHardwareOversampleConfigure(ADC0_BASE,64);
//Once sample sequencer has been configured, enable it
ADCSequenceEnable(ADC0_BASE, 0);
i have a task to call ADCProcessorTrigger(ADC0_BASE, 0); before to call task UpdateADC value:
uint32_t tmpArray_ADCValue[1];
isADCBusy = ADCBusy(ADC0_BASE);
if( isADCBusy == TRUE )
{}
else
{ //ADC is not busy
//ADC has finished sampling, we can get the data.
nbrSamplesCopiedToBuffer = ADCSequenceDataGetADC0_BASE, 0,tmpArray_ADCValue);
if(nbrSamplesCopiedToBuffer > 0)
{
//Update model with new HOB angle value.
HOB_Model.fields.HOB_Raw_Value = tmpArray_ADCValue[0];
}
}
ADC configuration is it correct? is it a problem of priority between CAN and ADC (DMA, etc..)
first i would not use ADC in interrupt Handler mode., is it possible to force processor event to refresh ADC register?
Thanks for your help