Hai,I have been facing a problem with interrupt priority......
OBJECTIVE:
I need to trigger the ADC for every 2 sec and the same time UART interrupt should be rise for this i tried with interrupt priority but no use.Here i am not getting triggering the UART interrupt. The control is always stays in TIMER handler.What is the problem with this?
Please give me a valuable suggestions.
This is my code what i written:
ROM_SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN |
SYSCTL_XTAL_16MHZ);
IntPrioritySet(INT_TIMER0A,0x00);
IntPrioritySet(INT_ADC0SS0,0x02);
IntPrioritySet(INT_UART0,0x04);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
// SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOG);
// GPIOPinTypeGPIOOutput(GPIO_PORTG_BASE, GPIO_PIN_6);
// GPIOPinTypeGPIOOutput(GPIO_PORTG_BASE, GPIO_PIN_7);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);
GPIOPinConfigure(GPIO_PA0_U0RX);
GPIOPinConfigure(GPIO_PA1_U0TX);
ROM_GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);
ROM_UARTConfigSetExpClk(UART0_BASE, SysCtlClockGet(), 9600,
(UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE |
UART_CONFIG_PAR_NONE));
ROM_UARTClockSourceSet(UART0_BASE, UART_CLOCK_PIOSC);
ROM_UARTFIFOEnable(UART0_BASE);
ROM_UARTFIFOLevelSet(UART0_BASE, UART_FIFO_TX1_8, UART_FIFO_RX1_8);
ROM_UARTTxIntModeSet(UART0_BASE, UART_TXINT_MODE_FIFO);
ROM_UARTIntEnable(UART0_BASE, UART_INT_RX | UART_INT_RT);
ROM_IntEnable(INT_UART0);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER0);
ROM_IntMasterEnable();
ROM_TimerConfigure(TIMER0_BASE, TIMER_CFG_PERIODIC);
ROM_TimerLoadSet(TIMER0_BASE, TIMER_A, ROM_SysCtlClockGet());
// ROM_TimerLoadSet(TIMER0_BASE, TIMER_A, 3*(SysCtlDelay(SysCtlClockGet() / 12)));
ROM_IntEnable(INT_TIMER0A);
ROM_TimerIntEnable(TIMER0_BASE, TIMER_TIMA_TIMEOUT);
ROM_TimerEnable(TIMER0_BASE, TIMER_A);
GPIOPinTypeADC(GPIO_PORTE_BASE, GPIO_PIN_0 | GPIO_PIN_1); //for ADC0.3 and ADC0.2 //PE0 & PE1
GPIOPinTypeADC(GPIO_PORTE_BASE, GPIO_PIN_2 | GPIO_PIN_3); //for ADC0.1 and ADC0.0 //PE2 & PE3
GPIOPinTypeADC(GPIO_PORTD_BASE, GPIO_PIN_6 | GPIO_PIN_7 | GPIO_PIN_4); //for ADC0.4 and ADC0.5 //PD6 & PD7
GPIOPinTypeADC(GPIO_PORTD_BASE, GPIO_PIN_5 );
ROM_SysCtlClockSet(SYSCTL_SYSDIV_10 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ);
ADCSequenceDisable(ADC0_BASE, 0); //for ADC0
// ADCSequenceConfigure(ADC0_BASE, 0, ADC_TRIGGER_PROCESSOR, 0);
ADCSequenceConfigure(ADC0_BASE, 0, ADC_TRIGGER_TIMER, 0);
ADCSequenceStepConfigure(ADC0_BASE, 0,0,ADC_CTL_CH0); //channel 0 for vlotage
ADCSequenceStepConfigure(ADC0_BASE, 0,1,ADC_CTL_CH1); //chnnael 1
ADCSequenceStepConfigure(ADC0_BASE, 0,2,ADC_CTL_CH2); //channel 2
ADCSequenceStepConfigure(ADC0_BASE, 0,3,ADC_CTL_CH3); //channel 3
ADCSequenceStepConfigure(ADC0_BASE, 0,4,ADC_CTL_CH4);
ADCSequenceStepConfigure(ADC0_BASE, 0,5,ADC_CTL_CH5);
ADCSequenceStepConfigure(ADC0_BASE, 0,6,ADC_CTL_CH6 | ADC_CTL_IE | ADC_CTL_END); //channel 5
ADCSequenceEnable(ADC0_BASE, 0);
ADCIntEnable(ADC0_BASE, 0);
IntEnable(INT_ADC0SS0);
SysCtlDelay(SysCtlClockGet() / 12);
SysCtlDelay(SysCtlClockGet() / 12);
while(1)
{
data12();
SysCtlDelay(SysCtlClockGet() / 12);
SysCtlDelay(SysCtlClockGet() / 12);
//SysCtlDelay(SysCtlClockGet() / 12);
//SysCtlDelay(SysCtlClockGet() / 12);
//SysCtlDelay(SysCtlClockGet() / 12);
}
}
void
ADCHandler(void)
{
++adc_handler;
SysCtlDelay(SysCtlClockGet() / 12);
flag=1;
ADCIntClear(ADC0_BASE, 0);
// ROM_IntMasterDisable();
// ROM_IntMasterEnable();
}
void
UARTIntHandler(void)
{
++count44;
SysCtlDelay(10000);
uint32_t ui32Status;
// Get the interrrupt status.
//
ui32Status = ROM_UARTIntStatus(UART0_BASE, true);
//
// Clear the asserted interrupts.
//
UARTIntClear(UART0_BASE, ui32Status);
//
// Loop while there are characters in the receive FIFO.
//
while(UARTCharsAvail(UART0_BASE))
{
m[count]=UARTCharGetNonBlocking(UART0_BASE);
// UARTCharPutNonBlocking(UART0_BASE,m[count]);
count++;
if(count>=70)
{
//clearbuff();
// if(count==100)
count=0;
// clearbuff((unsigned char *)m);
}
}
// IntDisable(INT_ADC0SS0);
// IntDisable(INT_TIMER0A);
// ROM_IntMasterEnable();
ROM_IntMasterDisable();
ROM_IntMasterEnable();
// count10=0;
}
void
Timer0IntHandler(void)
{
//
// Clear the timer interrupt.
//
++counta;
ROM_TimerIntClear(TIMER0_BASE, TIMER_TIMA_TIMEOUT);
ROM_TimerControlTrigger(TIMER0_BASE,TIMER_A,1);
// ROM_IntEnable(INT_TIMER0A);
if(flag==1)
{
ADC_fun();
}
//ROM_IntDisable(INT_TIMER0A);
// IntDisable(INT_UART0);
SysCtlDelay(SysCtlClockGet() / 12);
//
// Update the interrupt status on the display.
//
check_intrpt=ROM_IntIsEnabled(INT_UART0);
ROM_IntEnable(INT_UART0);
ROM_IntMasterDisable();
ROM_IntMasterEnable();
}