Hi.
I try use function ADCSequenceDataGet in interrupt ADC Sequence 0.
void ADCIntHandler(void) {int I; uint32_t pui32ADC0Value[6]; ADCIntClear(ADC0_BASE, 0); while(!ADCIntStatus(ADC0_BASE, 0, false)) { } ADCSequenceDataGet(ADC0_BASE, 0, &pui32ADC0Value[0]); }
Inteerupt properly executed, but then there is an interrupt FaultISR (Hard Fault 0x3).
If I don't use ADCSequenceDataGet everything is working properly:
void ADCIntHandler(void) {int I; uint32_t pui32ADC0Value[6]; ADCIntClear(ADC0_BASE, 0); while(!ADCIntStatus(ADC0_BASE, 0, false)) { } //ADCSequenceDataGet(ADC0_BASE, 0, &pui32ADC0Value[0]); }
SysCtrl init:
ui32SysClk =SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ | SYSCTL_OSC_MAIN | SYSCTL_USE_PLL | SYSCTL_CFG_VCO_480), 120000000);
ADC Init:
SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC0); // // For this example ADC0 is used with AIN0/1 on port E7/E6. // The actual port and pins used may be different on your part, consult // the data sheet for more information. GPIO port E needs to be enabled // so these pins can be used. // TODO: change this to whichever GPIO port you are using. // SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE); SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOK); // // Select the analog ADC function for these pins. // Consult the data sheet to see which functions are allocated per pin. // TODO: change this to select the port/pin you are using. // GPIOPinTypeADC(GPIO_PORTE_BASE, GPIO_PIN_1 | GPIO_PIN_3 ); GPIOPinTypeADC(GPIO_PORTK_BASE, GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_3 ); // Enable sample sequence 3 with a processor signal trigger. Sequence 3 // will do a single sample when the processor sends a signal to start the // conversion. Each ADC module has 4 programmable sequences, sequence 0 // to sequence 3. This example is arbitrarily using sequence 3. // ADCClockConfigSet(ADC0_BASE, ADC_CLOCK_SRC_PLL | ADC_CLOCK_RATE_EIGHTH, 30); ADCSequenceConfigure(ADC0_BASE, 0, ADC_TRIGGER_TIMER, 0); // // Configure step 0 on sequence 3. Sample channel 0 (ADC_CTL_CH0) in // differential mode (ADC_CTL_D) and configure the interrupt flag // (ADC_CTL_IE) to be set when the sample is done. Tell the ADC logic // that this is the last conversion on sequence 3 (ADC_CTL_END). Sequence // 3 has only one programmable step. Sequence 1 and 2 have 4 steps, and // sequence 0 has 8 programmable steps. Since we are only doing a single // conversion using sequence 3 we will only configure step 0. For more // information on the ADC sequences and steps, refer to the datasheet. // ADCSequenceStepConfigure(ADC0_BASE, 0, 0, ADC_CTL_CH0 ); ADCSequenceStepConfigure(ADC0_BASE, 0, 1, ADC_CTL_CH2 ); ADCSequenceStepConfigure(ADC0_BASE, 0, 2, ADC_CTL_CH16); ADCSequenceStepConfigure(ADC0_BASE, 0, 3, ADC_CTL_CH17); ADCSequenceStepConfigure(ADC0_BASE, 0, 4, ADC_CTL_CH18); ADCSequenceStepConfigure(ADC0_BASE, 0, 5, ADC_CTL_CH19 | ADC_CTL_IE | ADC_CTL_END); // // Since sample sequence 3 is now configured, it must be enabled. // ADCSequenceEnable(ADC0_BASE, 0); // // Clear the interrupt status flag. This is done to make sure the // interrupt flag is cleared before we sample. // ADCIntEnable(ADC0_BASE, 0); IntEnable(INT_ADC0SS0); ADCIntClear(ADC0_BASE, 0);
Timer init
SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER0); TimerConfigure(TIMER0_BASE, TIMER_CFG_PERIODIC); ui32Period1 = (ui32SysClk / 100) / 2; TimerLoadSet(TIMER0_BASE, TIMER_A, ui32Period1 -1); //TimerADCEventSet(TIMER0_BASE, TIMER_ADC_TIMEOUT_A); TimerControlTrigger(TIMER0_BASE, TIMER_A, true); TimerEnable(TIMER0_BASE, TIMER_A);
Please help, I do not know what to do