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.

CC3200: Timer CC measures the RTC and GPIO interrupt not triggered

Part Number: CC3200


Hello,

I have a really strange problem with the CC3200. I'm trying to measure the time between edges on a input port. As example I used the timer_cc. My code is nearly the same, but instead of measuring the edges on the input line it is measuring the RTC clock. (Measured with an osci this line, there is no RTC.) And I don't get how this is possible. Here the code:

volatile uint32_t captureValue = 0;
volatile unsigned long debugReg = 0;

void MyTimerHandler()
{ 
    MAP_GPIOPinWrite(GPIOA0_BASE, GPIO_INT_PIN_0, 0);
    
    unsigned long ulTimerState =  MAP_TimerIntStatus(TIMERA1_BASE, 1);
    if (ulTimerState & TIMER_CAPA_EVENT)
    {
        captureValue = MAP_TimerValueGet(TIMERA1_BASE,TIMER_A);
        MAP_TimerIntClear(TIMERA1_BASE, TIMER_CAPA_EVENT);
        MAP_GPIOPinWrite(GPIOA0_BASE, GPIO_INT_PIN_0, 1);
    }
    else
    {
        __asm("nop");
    }  
}

 void BoardInit(void)
{
    MAP_IntMasterEnable();
    MAP_IntEnable(FAULT_SYSTICK);

    PRCMCC3200MCUInit();
}

int main(int argc, char * argv[])
{
   BoardInit();

  /* Debug LED */
  MAP_PRCMPeripheralClkEnable (PRCM_GPIOA0, PRCM_RUN_MODE_CLK);
  MAP_PinTypeGPIO(PIN_50, PIN_MODE_0, false);
  MAP_GPIODirModeSet (GPIOA0_BASE, GPIO_INT_PIN_0, GPIO_DIR_MODE_OUT);

  /* timer cc */
  MAP_PRCMPeripheralClkEnable( PRCM_TIMERA1, PRCM_RUN_MODE_CLK);
  MAP_PRCMPeripheralReset( PRCM_TIMERA1);
  MAP_PinTypeTimer(PIN_02, PIN_MODE_12);
  MAP_TimerIntRegister( TIMERA1_BASE, TIMER_A, MyTimerHandler);
  MAP_TimerConfigure( TIMERA1_BASE, (TIMER_CFG_SPLIT_PAIR | TIMER_CFG_A_CAP_TIME));
  MAP_TimerControlEvent(TIMERA1_BASE, TIMER_A, TIMER_EVENT_NEG_EDGE);
  MAP_TimerLoadSet(TIMERA1_BASE, TIMER_A, 0xFFFFuL); 
  MAP_TimerIntEnable( TIMERA1_BASE, TIMER_CAPA_EVENT);
  MAP_TimerEnable( TIMERA1_BASE, TIMER_A);

  while(1)
  {
    debugReg =  MAP_TimerIntStatus(TIMERA1_BASE, 1);
    __asm("nop");
  }
}

The edge it not detected at all. When I uncomment the line MAP_PinTypeTimer(PIN_02, PIN_MODE_12); the behavior doesn't change at all. The interrupt is coming in like as a RTC would be connected. But real edges on the Pin2 Port are not triggering an interrupt at all.

Then I tried to use the GPIO instead of the timer. I just wanted to have an interrupt on each edge. In that case the interrupt was not coming at all. But when I used the polling mode in the while loop, that was working fine. Here the code:

void MyGpioHandler()
{ 
	MAP_GPIOPinWrite(GPIOA0_BASE, GPIO_INT_PIN_0, 0);

	unsigned long ulPinState =  GPIOIntStatus(GPIOA1_BASE,1);
	if(ulPinState & GPIO_PIN_3)
	{
		MAP_GPIOIntClear(GPIOA1_BASE,GPIO_INT_PIN_3);
		MAP_GPIOPinWrite(GPIOA0_BASE, GPIO_INT_PIN_0, 1);
	}
}

int main(int argc, char * argv[])
{
   BoardInit();

  /* Debug LED */
  MAP_PRCMPeripheralClkEnable (PRCM_GPIOA0, PRCM_RUN_MODE_CLK);
  MAP_PinTypeGPIO(PIN_50, PIN_MODE_0, false);
  MAP_GPIODirModeSet (GPIOA0_BASE, GPIO_INT_PIN_0, GPIO_DIR_MODE_OUT);

  MAP_PRCMPeripheralClkEnable(PRCM_GPIOA1, PRCM_RUN_MODE_CLK);
  MAP_PRCMPeripheralReset( PRCM_GPIOA1);
  MAP_PinTypeGPIO(PIN_02, PIN_MODE_0, true);
  MAP_GPIODirModeSet(GPIOA1_BASE, GPIO_PIN_3, GPIO_DIR_MODE_IN);
  MAP_GPIOIntTypeSet(GPIOA1_BASE, GPIO_INT_PIN_3, GPIO_FALLING_EDGE);  
  MAP_IntPrioritySet(INT_GPIOA1, INT_PRIORITY_LVL_1);
  MAP_GPIOIntRegister(GPIOA1_BASE, MyGpioHandler);
  MAP_GPIOIntClear(GPIOA1_BASE,GPIO_INT_PIN_3);
  MAP_GPIOIntEnable(GPIOA1_BASE,GPIO_INT_PIN_3);
  
  while(1)
  {
    debugReg =  GPIOIntStatus(GPIOA1_BASE,1);
#if 0
	if(ulPinState & GPIO_PIN_3)
    {
      MAP_GPIOIntClear(GPIOA1_BASE,GPIO_INT_PIN_3);
      MAP_GPIOPinWrite(GPIOA0_BASE, GPIO_INT_PIN_0, 1);
    }
#endif
    __asm("nop");
  }
}

So my questions are why is the timer cc measuring the RTC? And why is the GPIO interrupt not coming?

Thank you in advance.
Daniel

  • Hi Daniel,

    In your first code snippet, you are using the Timer peripheral with an interrupt, and then toggling a GPIO output in the handler. I'm confused how you are trying to measure a GPIO interrupt here?

    On the second snippet, I only see you setting an interrupt on the falling edge (line 26). Have you tried the GPIO_BOTH_EDGES parameter?

    Best regards,

    Sarah

  • Hello Sarah, 

    thanks for your reply. The first snipped is exactly the example of timer_cc in the CC3200_SDK. The captureValue can then be used to calculate the time. (Not implemented here.) Don't get confused about the output GPIO. I'm using it just to see on an osci at which time the interrupt came. So to check if the timer capture is been done on the falling edge of the input GPIO or one something else. (And the else seems to be the RTC. How can that be?)

    No, on the second snippet I just want to have the falling edge. As I say the interrupt is not coming, but the polling mode is working. How can that be?

    Best regards,
    Daniel

  • I partly identified this issue came from the hardware. I have retested it with the evalboard and there it seems to work as expected. I still don't know what defect on the board/chip is causing this, but it's at least not the software.