CC3200 Capture Compare PWM (CCP)

CC3200 Capture Compare PWM (CCP)

I needed to use external clock to count up/down the timer for my CC3200 project. CC3200 support this as I can see in the section 9.3.2.2 "Input Edge Count Mode" of CC3200 technical reference manual. The implementation was not so difficult, and here is how I tested it.
  1.  Assign GPIO pin and CCP/timer
    I decided to use GPIO0 pin
    (PIN_50) on CC3200 launchpad, and use the pin as GP_CCP00 that is assigned as timer0 clock input. Refer to technical reference manual for "pin mux config mode value". In my case, Pin 50 should be "7" to configure it as timer capture port.



    You can also refer to the same manual to see which timer that GP_CCP00 is connected. GT_CCP00 I use is for 16-bit timer 0 as below.




    The block diagram shown before the above table is quite useful to understand how it is internal connected.




    Based on above configuration, I added following lines
    in the pin configuration file.
    //
    // Enable Peripheral Clocks
    //
    MAP_PRCMPeripheralClkEnable(PRCM_GPIOA0, PRCM_RUN_MODE_CLK);

    //
    // Configure PIN_50(GPIO00) for EXTCLK GPIOInput
    //
    MAP_PinTypeGPIO(PIN_50, PIN_MODE_0, false);
    MAP_GPIODirModeSet(GPIOA0_BASE, 0x01, GPIO_DIR_MODE_IN);

    //
    // Configure PIN_50 for TIMERCP0 GT_CCP00
    //
    MAP_PinTypeTimer(PIN_50, PIN_MODE_7); // refer to datasheet pin list

  2. Configure Timer and Interrupt registers
    This is the configuration for my edge count timer and timer interrupt.
    void EXTCLKInit(P_INT_HANDLER EXTCLKInterruptHdl)
    {
        //
        // Register timer interrupt hander
        //
        MAP_TimerIntRegister(TIMERA0_BASE,TIMER_A,EXTCLKInterruptHdl);

        //
        // Configure the timer in edge count mode
        //
    MAP_TimerConfigure(TIMERA0_BASE,(TIMER_CFG_SPLIT_PAIR|TIMER_CFG_A_CAP_COUNT_UP));

        //
        // Set the detection edge
        //             
    MAP_TimerControlEvent(TIMERA0_BASE,TIMER_A,TIMER_EVENT_POS_EDGE);

        //
        // Set the reload value
        //
        MAP_TimerLoadSet(TIMERA0_BASE,TIMER_A,0xffff);

        //
        // Set Match Count Value for Timer Interrupt
        //
        MAP_TimerMatchSet(TIMERA0_BASE,TIMER_A,374);
    }
    You can change MAP_TimerMatchSet parameter to tune the timing. My setting is "374".
  3. Configure Interrupt handler
    This is the interrupt handler that is called by the above timer interrupt.
    For the quick test purpose, you can just add LED toggle function.

    void EXTCLKIntHandler(void)
    {
        //Clear EXTCLK Timer Interrupt Flag
        ClearEXTCLKInt();    // Toggle LED
        //LED1 = 1; //LED on

        //LED1 = 0; //LED off
    }
     
Hardware:
    CC3200 Launchpad
Summary:


Reference:     
CC3200 Technical Reference Manual

[AKM Chip Booster] Audio ADC AK5704 PCB Design

Designing a PCB prototype with AK5704 is not so difficult and I show an example with my design. People who are not familiar with AK5704,...