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

NGX LPC4330 Xplorer Board using LPCXpresso

NGX LPC4330 Xplorer Board using LPCXpresso

I got NGX LPC4330 Xplorer board, but it took a while to figure out the debug/program method
. The reason was that it actually came with LPC4337 mounted on the board, and I needed to change some configuration to make it work as below.

  1. Download NGX LPC4337 Xplorer board sample projects (LPCopen)
    Go to LPCware website and download "NGX Xplorer LPC4330 board" package for LPCXpresso. In my case, it is version 2.12.
    http://www.lpcware.com/content/nxpfile/lpcopen-software-development-platform-lpc43xx-packages

    *** You can also find LPC4337 NGX package in the LPCXpresso IDE package. ***
    This package does not include freertos examples that I wanted to use, so I used above package. In my case, the file is located as below.
    C:/nxp/LPCXpresso_6.1.2_177/lpcxpresso/Examples/NXP/LPC4000/LPC43xx/NGX_LPC4337-Xplorer.zip
  2. Load blinky project and change configuration in the property
    I loaded "freertos_blinky" project.
    Right click the project and select "Properties" and go to
    "C/C++ Build > MCU settings".
    Change the target to LPC4337 and press "OK".

    Then build the project and if it builds without errors, it is good to go.
  3. Using ULINK-ME and debugIf you are using ULINK-ME for debugger, change the debug configuration.
    Right click the project, select "Debug As > Debug Configurations..".
    Make sure the correct axf file is selected in the left window (freertos_blinky.axf), and go to "Debugger > Target Configuration". In the "Configuration Option", select "Debug Protocol" and change the value from "JTAG" to "SWD". Then press "Debug".

     


    Now the debug session starts and you will see LEDs on the board start blinking after "Resume" button is pressed.

Hardware:
    NGX LPC4330 Xplorer Board
    ULINK-ME

Reference:     

[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,...