Hello,
I have a problem using the ADC on the TivaBoard TM4C1294.
My program doesn’t work.
The busy flag in ADC0_ACTSS_R is set all the time.
I figured out the following work around.
1. Erase the flash by using the FlashProgrammer.
2. Program the original "blinky.bin" ( from Tivaware) file into the flash.
3. Start CCS6 , load and run my ADC program.
It works perfect until power off / power on.
When I try to run my program again ,it fails.
When I repeat the steps 1 to 3 again, it works fine again.
Do you have any idea ??
Best regards
------------------------------------------------------------------------------------------------
* ADC Input AIN3 = PE0 ADC TIVA Problem --
* busy flag in ADC0_ACTSS_R always high ???
* *
*/
#include "tm4c1294ncpdt.h"
#include "stdio.h"
void main(void)
{ long adcvalue, i;
SYSCTL_MOSCCTL_R =0x00000000; // switch to 25MHz
SYSCTL_RSCLKCFG_R =0x00300000;
SYSCTL_RCGCADC_R = 0x01; // ADC module 0 clock
SYSCTL_RCGCGPIO_R |= 0x10; // Port E clock
for(i=0;i<2;i++);
GPIO_PORTE_AHB_AFSEL_R = 0x01; // PE0 alternative function
GPIO_PORTE_AHB_DEN_R = 0x00; // PE0 = AI3 / disable digital function
GPIO_PORTE_AHB_AMSEL_R = 0x01; // PE0 enable analog function
ADC0_ACTSS_R = 0x00; // Disable SampleSequenzer SS3
ADC0_EMUX_R = 0x00; // set SampleSequenzer SS3 (EM3) TriggerEvent
// by setting SSn bit in ADCPSSI. -by default
ADC0_SSMUX3_R = 0x03; // sample input select AI3
ADC0_SSCTL3_R = 0x02; // first sample is end of sequence
ADC0_ACTSS_R = 0x08; // Enable SampleSequenzer SS3
ADC0_ISC_R = 0x0f;
ADC0_PSSI_R = 0x08; // start sampling
while(1) {
while((ADC0_SSFSTAT3_R & 0x00001000) ==0); // wait for FIFO full
adcvalue=ADC0_SSFIFO3_R; // read conversion result
ADC0_PSSI_R |= 0x08; // start sampling
printf("adcvalue=%d \n",adcvalue);
}
}