This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

LCDK: Can't Re-Initialize Interrupt Handler

Other Parts Discussed in Thread: OMAP-L138

TestCode.c
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>


#include "L138_LCDK_aic3106_init.h"
#include "L138_LCDK_switch_led.h"

enum {inputting, transmitting, recieving, requestMedium, backoff} states;
int counter = 0;
int counter_recv = 0;
char ch;
int16_t sample;


interrupt void interrupt4(void) // interrupt service routine
{


	if(states == transmitting)
	{
        counter++;
	}

	if(states == recieving)
	{
		sample = input_left_sample();
		counter_recv++;

	}

	output_left_sample(0);
	return;
}



int main(void)
 {
	// Init string


    states = recieving;
	L138_initialise_intr(FS_8000_HZ,ADC_GAIN_0DB,DAC_ATTEN_0DB,LCDK_MIC_INPUT);

    while(1)
    {

    	if(counter_recv == 10)
    	{
    		states = inputting;
     		printf("What u want to transmit:");
      		//scanf("%[^\n]", &input[0]);
       		scanf(" %c", &ch);

       		states = transmitting;
       		counter = 0;
       		L138_initialise_intr(FS_8000_HZ,ADC_GAIN_0DB,DAC_ATTEN_0DB,LCDK_MIC_INPUT);
       		counter_recv = 0;
    	}

    }
}

In our L138/C6748 LCDK, the printf function halts the interrupt handler. We are able to re-initialize it if our input comes in through the "mic" input. Not so with the "line" input. 

Attached is our test code illustrating the problem. We go through the interrupt handler 10 times, then ask for keyboard input. After receiving the input from the keyboard, we re-initialize the interrupt handler. With LCDK_MIC_INPUT, no problem; the interrupt handler restarts. With LCDK_LINE_INPUT, restart does not happen. This can be observed by following "counter" in the watch window. 

What is causing this behavior? We would like to engage the user while bringing in data from the line input. We will be attempting a GUI solution as a work-around, but want to know why this problem is appearing.

Regards, Mike Briggs

  • Hi,
    Typically we won't have much work in ISR routine. We need to service the interrupt ASAP.
    Try to avoid much code in ISR.
    Which example code are you referring here ?
    Is it your own code or TI provided ?
  • Titus, thank you for your response. I apologize -- I must have messed up the posting of our test code. Althat we are doing in the ISR is deciding whether or not to bump a couple of counters. The rest of the work is done in the main. The code is short; I'll put it here (I hope the indents are retained):

    #include <stdio.h>
    #include <math.h>
    #include <string.h>
    #include <stdlib.h>
    #include <ctype.h>


    #include "L138_LCDK_aic3106_init.h"
    #include "L138_LCDK_switch_led.h"

    enum {inputting, transmitting, receiving, requestMedium, backoff} states;
    int counter = 0;
    int counter_recv = 0;
    char ch;
    int16_t sample;


    interrupt void interrupt4(void) // interrupt service routine
    {


    if(states == transmitting)
    {
             counter++;
    }

    if(states == receiving)
    {
            sample = input_left_sample();
            counter_recv++;

    }

    output_left_sample(0);
    return;

    }

    int main(void)

    {

    states = receiving;
    L138_initialise_intr(FS_8000_HZ,ADC_GAIN_0DB,DAC_ATTEN_0DB,LCDK_MIC_INPUT);

    while(1)
    {

    if(counter_recv == 10)
    {
             states = inputting;
             printf("What u want to transmit:");
             scanf(" %c", &ch);

                      states = transmitting;
                      counter = 0;
                      L138_initialise_intr(FS_8000_HZ,ADC_GAIN_0DB,DAC_ATTEN_0DB,LCDK_MIC_INPUT);
                      counter_recv = 0;
               }

    }

    }

  • Titus, did I do something wrong? I hope that I answered your question: the example code is our own, and is in the body of my previous response. 

    Mike Briggs

  • Hi,

    I assume you are referring a text book, "Digital Signal Processing and Applications with the OMAP-L138 eXperimenter".
    Here is why i am asking you because i tried to include header files "L138_LCDK_aic3106_init.h" and "L138_LCDK_switch_led.h" without success.

    Can you attach zipped project so that we can try out as our end also.