Tool/software: Code Composer Studio
Hi,
in my code I configure ADC0 for sequence 3 and a DMA transfer after sequence completion. The trigger for the conversion sequence is ADC_TRIGGER_PROCESSOR.
Now as soon as I trigger a conversion sequence my ADC HWI (ADC0 Sequence 0, #30 in vector table) is called with the following register contents at function entry:
ADC_ACTSS | 0x0101 |
ADC_RIS | 0x0001 |
ADC_IM | 0x0001 |
ADC_ISC | 0x0001 |
So now in order to clear the interrupt I call ADCIntClearEx(ADC0_BASE, ADC_INT_DMA_SS0);.
Nothing happens (regarding the register contents and the program flow), the interrupt remains active and the program reenters the HWI.
Thanks in advance for the help!
Here is my code:
/* * Copyright (c) 2015, Texas Instruments Incorporated * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of Texas Instruments Incorporated nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* * ======== empty_min.c ======== */ /* XDCtools Header files */ #include <xdc/std.h> #include <xdc/runtime/Log.h> #include <xdc/runtime/System.h> #include <xdc/runtime/Timestamp.h> #include <xdc/cfg/global.h> /* BIOS Header files */ #include <ti/sysbios/BIOS.h> #include <ti/sysbios/knl/Swi.h> #include <ti/sysbios/knl/Task.h> #include <ti/sysbios/knl/Clock.h> #include <ti/sysbios/knl/Semaphore.h> /* TI-RTOS Header files */ // #include <ti/drivers/EMAC.h> #include <ti/drivers/GPIO.h> // #include <ti/drivers/I2C.h> // #include <ti/drivers/SDSPI.h> // #include <ti/drivers/SPI.h> // #include <ti/drivers/UART.h> // #include <ti/drivers/USBMSCHFatFs.h> // #include <ti/drivers/Watchdog.h> // #include <ti/drivers/WiFi.h> /* Board Header file */ #include "Board.h" #include <stdbool.h> #include <driverlib/timer.h> #include <driverlib/sysctl.h> #include "inc/hw_ints.h" #include "inc/hw_memmap.h" #include "inc/hw_adc.h" #include "inc/hw_types.h" #include <driverlib/interrupt.h> #include <driverlib/adc.h> #include <driverlib/gpio.h> #include <driverlib/udma.h> #include <driverlib/pin_map.h> #define TASKSTACKSIZE 512 Task_Struct task0Struct; Char task0Stack[TASKSTACKSIZE]; uint32_t start, stop, result; uint32_t pui32ADC0Value[8]; uint32_t ADC_value[8]; uint32_t ADC_value1[8]; #pragma DATA_ALIGN(DMAcontroltable, 1024) uint8_t DMAcontroltable[1024]; //===================TASK Void heartBeatFxn(UArg arg0, UArg arg1) { while (1) { Task_sleep((unsigned int)arg0); GPIO_toggle(Board_LED0); } } //====================CONFIG void configure_ADC(){ //enable peripherals SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC0); ADCClockConfigSet(ADC0_BASE, ADC_CLOCK_SRC_MOSC | ADC_CLOCK_RATE_FULL, 1); //set ADC clock to 25MHZ (MOSC) //set pin function GPIOPinTypeADC(GPIO_PORTE_BASE, GPIO_PIN_3); //AIN0 GPIOPinTypeADC(GPIO_PORTE_BASE, GPIO_PIN_2); //AIN1 GPIOPinTypeADC(GPIO_PORTE_BASE, GPIO_PIN_1); //AIN2 GPIOPinTypeADC(GPIO_PORTE_BASE, GPIO_PIN_0); //AIN3 GPIOPinTypeADC(GPIO_PORTD_BASE, GPIO_PIN_7); //AIN4 GPIOPinTypeADC(GPIO_PORTD_BASE, GPIO_PIN_6); //AIN5 GPIOPinTypeADC(GPIO_PORTD_BASE, GPIO_PIN_5); //AIN6 GPIOPinTypeADC(GPIO_PORTD_BASE, GPIO_PIN_4); //AIN7 /*GPIOPinTypeADC(GPIO_PORTE_BASE, GPIO_PIN_5); //AIN8 GPIOPinTypeADC(GPIO_PORTE_BASE, GPIO_PIN_4); //AIN9 GPIOPinTypeADC(GPIO_PORTB_BASE, GPIO_PIN_4); //AIN10 GPIOPinTypeADC(GPIO_PORTB_BASE, GPIO_PIN_5); //AIN11*/ //enable sample sequence 3 ADCSequenceConfigure(ADC0_BASE, 0, ADC_TRIGGER_PROCESSOR, 3); 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_CH4); ADCSequenceStepConfigure(ADC0_BASE, 0, 5, ADC_CTL_CH5); ADCSequenceStepConfigure(ADC0_BASE, 0, 6, ADC_CTL_CH6); ADCSequenceStepConfigure(ADC0_BASE, 0, 7, ADC_CTL_CH7 | ADC_CTL_END); return; } void configure_DMA(){ //ADC DMA ADCSequenceDMAEnable(ADC0_BASE, 0); uDMAEnable(); uDMAControlBaseSet(DMAcontroltable); uDMAChannelAssign(UDMA_CHANNEL_ADC0); uDMAChannelControlSet(UDMA_CHANNEL_ADC0 | UDMA_PRI_SELECT, UDMA_SIZE_32 | UDMA_SRC_INC_NONE | UDMA_DST_INC_32 | UDMA_ARB_8); uDMAChannelTransferSet(UDMA_CHANNEL_ADC0 | UDMA_PRI_SELECT, UDMA_MODE_BASIC, (void *)(ADC0_BASE + ADC_O_SSFIFO0), pui32ADC0Value, 8); //uDMAChannelAttributeEnable(UDMA_CHANNEL_ADC0, UDMA_ATTR_USEBURST); return; } //====================HWI /*void timerInterrupt(UArg arg0){ TimerIntClear(TIMER2_BASE, TIMER_TIMA_TIMEOUT); Swi_post(swi0); return; }*/ void hwi_dma_error(){ return; } void hwi_adc0(){ //uDMAIntClear(UDMA_CHANNEL_ADC0); ADCIntClearEx(ADC0_BASE, ADC_INT_DMA_SS0); return; } //=====================CLOCK void ledToggle(UArg arg0){ start = Timestamp_get32(); GPIO_toggle(Board_LED1); //for (i = 0; i < 999999; i++){} //Log_info1("Toggled LED %d ", i); stop = Timestamp_get32(); result = stop - start; return; } /* * ======== main ======== */ int main(void) { uint32_t f_clk; f_clk = SysCtlClockFreqSet(SYSCTL_XTAL_25MHZ | SYSCTL_OSC_MAIN | SYSCTL_USE_PLL | SYSCTL_CFG_VCO_480, 120000000); Task_Params taskParams; /* Call board init functions */ Board_initGeneral(); // Board_initEMAC(); Board_initGPIO(); // Board_initI2C(); // Board_initSDSPI(); // Board_initSPI(); // Board_initUART(); // Board_initUSB(Board_USBDEVICE); // Board_initUSBMSCHFatFs(); // Board_initWatchdog(); // Board_initWiFi(); SysCtlPeripheralEnable(SYSCTL_PERIPH_UDMA); SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER2); /* Construct heartBeat Task thread */ Task_Params_init(&taskParams); taskParams.arg0 = 1000; taskParams.stackSize = TASKSTACKSIZE; taskParams.stack = &task0Stack; Task_construct(&task0Struct, (Task_FuncPtr)heartBeatFxn, &taskParams, NULL); //CONFIGURE CLOCK configure_ADC(); configure_DMA(); // // Configure the Timer0B interrupt for timer timeout. // TimerConfigure(TIMER2_BASE, TIMER_CFG_A_PERIODIC); TimerLoadSet(TIMER2_BASE, TIMER_A, 12000000); //TimerIntEnable(TIMER2_BASE, TIMER_TIMA_TIMEOUT); //IntEnable(INT_TIMER2A); TimerControlTrigger(TIMER2_BASE, TIMER_A, true); TimerEnable(TIMER2_BASE, TIMER_A); /* Turn on user LED */ GPIO_write(Board_LED0, Board_LED_ON); GPIO_write(Board_LED1, Board_LED_ON); ADCSequenceEnable(ADC0_BASE, 0); ADCIntEnableEx(ADC0_BASE, ADC_INT_DMA_SS0); ADCProcessorTrigger(ADC0_BASE, 0); /* Start BIOS */ BIOS_start(); //while(1); return (0); }