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 on pin2 measures the RTC

Part Number: CC3200
Other Parts Discussed in Thread: UNIFLASH, , , CC3100

Hello, 

I have again the same problem like the last time. See related question. The last time I thought that the hardware is defect, but I'm not so sure anymore. 

The problem is still the same: Instead of measuring the time between flags on the pin2, it's measuring somehow the RTC frequency. On the Evalboard (CC3200-Lauchxl) was it working but on the real hardware not. 

But this time I was able to reproduce this issue with the CC3200-Lauchxl board! And it doesn't matter what software I put with the debugger on the board it is now also measuring the RTC and not pin2.  

Normally I was flashing the Evalboard via the internal TI debugger directly from the IAR environment. The real hardware was flashed via UART and uniflash. I tried now the same with the evalboard and here we go the problem is the same... and the really strange thing is that it doesn't matter what software I flash with the debugger the problems stays the same. But the software is still be flashed! When I change a pin from low to high it is working. 

So something is the uniflash doing that has impact on the behavior on pin2 edge detection and even overwriting the software with the debugger is not changing it. 

Some clues what it could be? 

  • Hi Daniel,

    Let me understand, are you still using the timer_cc example? Can you please state which SDK version you are using? 

  • mostly yes. I made few changes but the code was working on the eval with the debugger. But after flashing it with uniflash I don't get the same code working. 

    I have checked the versions and it seems that the flashed servicepack with uniflash comes from v1.4. But I found some header files that seems to be from v1.2. I will clean it up and retest it with the new v1.5. Unfortunately it will take a while, because it's only possible to get it as installer that also needs admin rights. 

  • Hi Sabeeh,

    it really changed again. I created clean new projects with v1.4 and v1.5. Now I don't see some RTC clock anymore but the interrupt is now also not coming at all. Because of this I thought that maybe MAP_ is messed up, so in the project v1.4 I removed all MAP_ functions. But that didn't change anything. Seems like that I can't attach the project so here is the main.c file of the v1.5 project:

    #include <stdint.h>
    #include "hw_types.h"
    #include "hw_ints.h"
    #include "prcm.h"
    #include "interrupt.h"
    #include "timer.h"
    #include "gpio.h"
    #include "hw_memmap.h"
    #include "pin.h"
    #include "rom_map.h"
    
    
    volatile uint32_t pingCaptureValue = 0;
    uint32_t timeDiffInTicks = 0;
    
    void MyTimerHandler()
    { 
        static uint8_t ping = true;
        uint32_t timerValue = MAP_TimerValueGet(TIMERA1_BASE, TIMER_A);
        uint32_t intStatus = MAP_TimerIntStatus(TIMERA1_BASE, true);
        
        MAP_TimerIntClear (TIMERA1_BASE, intStatus);
        
        if (ping == true)
        {
            ping = false;
            MAP_GPIOPinWrite (GPIOA0_BASE, GPIO_PIN_0, GPIO_PIN_0);
            /* falling edge detected */
            MAP_TimerControlEvent (TIMERA1_BASE, TIMER_A, TIMER_EVENT_POS_EDGE);
            pingCaptureValue = timerValue;
        }
        else
        {
            ping = true;
            MAP_GPIOPinWrite (GPIOA0_BASE, GPIO_PIN_0, 0);
            /* rising edge detected */
            MAP_TimerControlEvent (TIMERA1_BASE, TIMER_A, TIMER_EVENT_NEG_EDGE);
            timeDiffInTicks = (timerValue - pingCaptureValue) & 0xFFFFFFuL; 
        }  
    }
    
     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_PRCMPeripheralReset (PRCM_GPIOA0);
      
      MAP_PinTypeGPIO(PIN_50, PIN_MODE_0, false);
      MAP_GPIODirModeSet (GPIOA0_BASE, GPIO_PIN_0, GPIO_DIR_MODE_OUT);
      MAP_PinTypeGPIO(PIN_55, PIN_MODE_0, false);
      MAP_GPIODirModeSet (GPIOA0_BASE, GPIO_PIN_1, GPIO_DIR_MODE_OUT);
      MAP_GPIOPinWrite (GPIOA0_BASE, GPIO_PIN_1, GPIO_PIN_1);
    
      /* 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_UP));
      MAP_TimerControlEvent(TIMERA1_BASE, TIMER_A, TIMER_EVENT_NEG_EDGE);
      MAP_TimerLoadSet(TIMERA1_BASE, TIMER_A, 0xFFFFFFuL); 
      MAP_TimerIntEnable( TIMERA1_BASE, TIMER_CAPA_EVENT);
      MAP_TimerEnable( TIMERA1_BASE, TIMER_A);
    
      while(1)
      {
        __asm("nop");
      }
    }

    I'm using the CC3200-Lunchxl. Connected jumbers are: J8, J9, J10, J11, J12 and J13. I connect J6 and J7 in the middle to get a rising and falling edge. The rest is not connected.

    For flashing with uniflash I'm using the default settings and connected J15. J6 and J7 is connected to flash.

    The exact version of v1.4 is:
    CC3200SDK_1.4.0
    CC3100_CC3200_ServicePack_1.0.1.13-2.11.0.1

    for v1.5:
    CC3200SDK_1.5.0
    CC3100_CC3200_ServicePack_1.0.1.15-2.14.0.0

  • Ok in this project I forgot to set the vector table. Here the current version:

    #include <stdint.h>
    #include "hw_types.h"
    #include "hw_ints.h"
    #include "prcm.h"
    #include "interrupt.h"
    #include "timer.h"
    #include "gpio.h"
    #include "hw_memmap.h"
    #include "pin.h"
    #include "rom_map.h"
    
    
    extern uVectorEntry __vector_table;
    
    volatile uint32_t pingCaptureValue = 0;
    uint32_t timeDiffInTicks = 0;
    
    /* SET this to TIMERA2_BASE for Pin4 and TIMERA1_BASE for Pin2 */
    unsigned long timerBase = TIMERA1_BASE;
    
    void MyTimerHandler()
    { 
        static uint8_t ping = true;
        uint32_t timerValue = MAP_TimerValueGet(timerBase, TIMER_A);
        uint32_t intStatus = MAP_TimerIntStatus(timerBase, true);
        
        MAP_TimerIntClear (timerBase, intStatus);
        
        if (ping == true)
        {
            ping = false;
            MAP_GPIOPinWrite (GPIOA0_BASE, GPIO_PIN_0, GPIO_PIN_0);
            /* falling edge detected */
            MAP_TimerControlEvent (timerBase, TIMER_A, TIMER_EVENT_POS_EDGE);
            pingCaptureValue = timerValue;
        }
        else
        {
            ping = true;
            MAP_GPIOPinWrite (GPIOA0_BASE, GPIO_PIN_0, 0);
            /* rising edge detected */
            MAP_TimerControlEvent (timerBase, TIMER_A, TIMER_EVENT_NEG_EDGE);
            timeDiffInTicks = (timerValue - pingCaptureValue) & 0xFFFFuL; 
        }  
    }
    
    
     void BoardInit(void)
    {
        
        MAP_IntVTableBaseSet((unsigned long)&__vector_table);
      
        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_PRCMPeripheralReset (PRCM_GPIOA0);
      
      MAP_PinTypeGPIO(PIN_50, PIN_MODE_0, false);
      MAP_GPIODirModeSet (GPIOA0_BASE, GPIO_PIN_0, GPIO_DIR_MODE_OUT);
      MAP_PinTypeGPIO(PIN_55, PIN_MODE_0, false);
      MAP_GPIODirModeSet (GPIOA0_BASE, GPIO_PIN_1, GPIO_DIR_MODE_OUT);
      MAP_GPIOPinWrite (GPIOA0_BASE, GPIO_PIN_1, GPIO_PIN_1);
    
      /* timer cc */
      if (timerBase == TIMERA1_BASE)
      {
        MAP_PRCMPeripheralClkEnable( PRCM_TIMERA1, PRCM_RUN_MODE_CLK);
        MAP_PRCMPeripheralReset( PRCM_TIMERA1);
        MAP_PinTypeTimer(PIN_02, PIN_MODE_12);
      }
      else
      {
        MAP_PRCMPeripheralClkEnable(PRCM_TIMERA2, PRCM_RUN_MODE_CLK);
        MAP_PRCMPeripheralReset( PRCM_TIMERA2);
        MAP_PinTypeTimer(PIN_04, PIN_MODE_12);
      }
      
      MAP_TimerIntRegister(timerBase, TIMER_A, MyTimerHandler);
      MAP_TimerConfigure(timerBase, (TIMER_CFG_SPLIT_PAIR | TIMER_CFG_A_CAP_TIME));
      MAP_TimerControlEvent(timerBase,TIMER_A,TIMER_EVENT_POS_EDGE);
      MAP_TimerLoadSet(timerBase,TIMER_A,0xffff);
      MAP_TimerIntEnable(timerBase,TIMER_CAPA_EVENT);
      MAP_TimerEnable(timerBase,TIMER_A);
    
      while(1)
      {
        __asm("nop");
      }
    }

    I added also the variable timerBase. By setting it to TIMERA2_BASE it is the same like in the example and pin4 will be used. Interrupts are coming so it seems to be working. By setting it to TIMERA1_BASE the pin2 will be used and no interrupts are coming.... The difference is only the 3 lines in the if else. I don't get what the problem is. The mode is for both pins 12. So what I'm missing here?

  • Ok another mistake. I checked the wrong pin now. So the new projects are working. But I think I get a clue what was the issue before.

    When flashing with uniflash I have choosen for /sys/mcuimg.bin my own bin file. After that I connected with the debugger and reflashed it. I thing I should flash with uniflash only the service pack so: click on format (1MB) and then flash service pack. After that the debugger can be used. Is that right?

    Or which areas is the debugger reprogramming?

  • Ok finally found the real root cause. The MAP_ functions were partly wrong pointing. I thought this came from TI, but the original file rom_map.h was working correct. The evalboard and the real hardware was flashed in different ways and that's why it was working on the one hardware and not on the other. On top there were also a version conflict (MAP_function expected a lib version before v1.4 but v1.4 was flashed). Now it's clean and hopefully working. xD