Hi,
i'm trying to configurate and use ADC peripherials with no result. I attached part of code below.
When i'm in ADCConfig at line ADCSequenceConfigure(ADC0_BASE, 0, ADC_TRIGGER_TIMER, 0); deguger freezes and stop responding. I have no idea what is wrong. Please help me to solve this problem. Best regards
void ADCConfig(void){
//
// Enable the ADC peripherals and the associated GPIO port
//
SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC0);
//SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC1);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);
//
// Configure the pins to be used as analog inputs.
//
GPIOPinTypeADC(GPIO_PORTE_BASE, GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2 |
GPIO_PIN_2 | GPIO_PIN_3);// konfiguracja pinó na złączu ark
GPIOPinTypeADC(GPIO_PORTD_BASE, GPIO_PIN_3); // 5 pin na goldpin pd3 ain12
//AIN3 AIN2 AIN 1 AIN 0 i AIN12
// ADCIntEnable(ADC0_BASE,1);
// ADCIntEnable(ADC1_BASE,1);
ADCSequenceDisable(ADC0_BASE, 0);
// ADCSequenceDisable(ADC1_BASE, 1);
//ustawienie próbkowania
SysCtlADCSpeedSet(SYSCTL_ADCSPEED_125KSPS);
//SysCtlDelay(1000);
// while(!SysCtlPeripheralReady(SYSCTL_PERIPH_ADC0)){;}
ADCSequenceConfigure(ADC0_BASE, 0, ADC_TRIGGER_TIMER, 0);
ADCSequenceStepConfigure(ADC0_BASE,0,0,ADC_CTL_CH0);
ADCSequenceStepConfigure(ADC0_BASE,0,1,ADC_CTL_CH1);
ADCSequenceStepConfigure(ADC0_BASE,0,2,ADC_CTL_CH2);
ADCSequenceStepConfigure(ADC0_BASE,0,3,ADC_CTL_CH3);
ADCSequenceStepConfigure(ADC0_BASE,0,4,ADC_CTL_CH12 | ADC_CTL_IE | ADC_CTL_END);
ADCIntEnable(ADC0_BASE, 3);
ADCSequenceEnable(ADC0_BASE, 0);
ADCIntEnable(ADC0_BASE, 0);
IntEnable(INT_ADC0SS0);
}////////////////////////////////////////////////////////////////////////////////////////////////////////
//*******************************************************************************
//////////////////////////////////////////////////////////////////////////
////////////////////////////// TIMER///////////////
void TimerSet(void){
SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER0);
//SysCtlPeripheralReset(SYSCTL_PERIPH_TIMER0);
ulPeriod = (SysCtlClockGet() / ulFrequency); //60K is close to max freq. period of 250
TimerConfigure(TIMER0_BASE, TIMER_CFG_PERIODIC);
TimerLoadSet(TIMER0_BASE, TIMER_A, SysCtlClockGet() / ulFrequency);
TimerControlTrigger(TIMER0_BASE,TIMER_A,true);
TimerEnable(TIMER0_BASE, TIMER_A);
TimerIntEnable(TIMER0_BASE, TIMER_TIMA_TIMEOUT);
SysCtlDelay(1000);
// ADCIntClear(ADC0_BASE, 0); // Clear any outstanding Interrupts
SysCtlDelay(1000);
; //ALLOW -- start of the collection Chain
IntEnable(INT_ADC0SS1); // Turn on Sequence Interrupts fo Seq. 1
IntMasterEnable(); // Finally -- enable all interrupts and go.
//
}