Other Parts Discussed in Thread: CC3200
Tool/software: Code Composer Studio
Hello,
I am writing a program to control an amplifier with a CC3200. I started from the udma example program with some input on the dma programming of the system ADCs from the smartplug program.
In short I have DMA interrupts from the ADC about every 8 ms and every 0.125 s I have a SysTick interrupt task (SysTickHandler) for led management and system survey/control operations.
The program run as I wanted until I decided to put a trap to catch a potential initialization error on my I2C thermometers, sending the sequence into an infinite loop and I was expecting the Systick interrupt to continue to operate blinking an LED to signal the condition, but this is not the case.
It does not matter whether I add the instruction SysTickIntEnable() or not: the code, including the blinking routine, work as expected except when I force the thermometer initialization error and then it stays in the infinite loop, but the Systick interrupt does not execute.
I am obviously missing something about Systick interrupts, but I have not found an answer in the documentation.
Thanks in advance for your help. I am attaching the relevant code below:
void
main()
{
unsigned long time; // elapsed time for interrupt
extern unsigned char Tbuffer;
extern unsigned char Tlength;
extern unsigned char adc_error; // error flags: offset and init
extern unsigned char adc_error_delay;
extern unsigned char aux_error;
extern unsigned char calibrate_2;
extern unsigned short center_scale;
unsigned short seconds_to_cal = 0;
int iRetVal;
time_flag_count = 0;
//
// Initializing the board
//
BoardInit();
//
// Muxing for Enabling UART_TX and UART_RX, and LEDs
//
//All LEDS and pins off here
//
PinMuxConfig();
GPIO_IF_LedConfigure(LED1|LED2|LED3); //board LED green, yellow and red (also FAN_PWM)
GPIO_IF_LedOff(MCU_ALL_LED_IND);
GPIO_IF_Set(EXT_RED_LED, GPIOA2_BASE, 0x1, 0);
GPIO_IF_Set(PWR_BUS, GPIOA2_BASE, 0x2, 0);
GPIO_IF_Set(SPKR_SWITCH, GPIOA3_BASE, 0x10, 0);
GPIO_IF_Set(EXT_YELLOW_LED, GPIOA0_BASE, 0x80, 0);
GPIO_IF_Set(EXT_BLUE_LED, GPIOA1_BASE, 0x40, 0);
GPIO_IF_Set(ADC_CAL, GPIOA0_BASE, 0x40, 0);
//
GPIO_IF_Set(ADC_CAL, GPIOA0_BASE, 0x40, 1); // Start by calibrating ADCs
//
// Initializing the Terminal.
//
InitTerm();
//
// I2C Init
//
I2C_IF_Open(I2C_MASTER_MODE_FST);
//
// Display Welcome Message
//
DisplayBanner();
//
// SysTick Enabling
//
SysTickIntRegister(SysTickHandler);
SysTickPeriodSet(SYSTICK_RELOAD_VALUE);
SysTickEnable();
SysTickIntEnable();
//
// Blink green_led
//
green_led = 1; //green led toggle
//
MAP_UtilsDelay(2666666); //Wait 0.2 s for supplies power up
//
//PWM fan drive
//
InitPWMModule();
//
iRetVal = Thermometer_Init();
//
if(iRetVal == FAILURE)
{
while(FOREVER) //Halt on thermometer init. failure
{
green_led = 1;
}
}
// Read voltages here
//
// Turn power bus on
//
GPIO_IF_Set(PWR_BUS, GPIOA2_BASE, 0x2, 1);
//turn calibration on
//
calibrate_2 = 1;
GPIO_IF_Set(ADC_CAL, GPIOA0_BASE, 0x40, 1); //set hardware to adc calibration
//
// uDMA Initialization for ADCs
//
UDMAInit();
//
UART_PRINT("Completed DMA Initialization \n\r\n\r");
//
// Ping Pong UART Transfer
//
InitADC2Transfer();
//
UART_PRINT("Completed DMA Setup \n\r\n\r");
//
// Operation starts
//
green_led = 2; //green led on
while(FOREVER)
{
// Check to see if one second has elapsed. If so, make some updates.
//
if(time_flag)
{
time_flag = 0;