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.

TIVA TM4C129ENCPDT - how to configure Buffered version of 32.768 clock on RTCCLK on GPIO PIN

Hello,

    We want to configure the Tiva so that we can monitor the 32.768 KHz hibernate clock source on the RTCCLK pin (GPIO PP3).  I've looked through the chip sheet and its not real clear.  Also could one set this all up using the ROM_ API functions that come with the chip?

Thanks,

Bill

  • Hello Bill,,

    To get a buffered version of the 32K Clock there are the following steps you would need to do

    1. Program the GPIO Mux Select (along with the other control signals) to get the 32K Clock Out

    2. Enable the Hibernate Module and configure it in RTC Mode.

    3. Program the HIBCC register to source the 32K Clock to the System

    Regards

    Amit

  • Amit,

         I did the following, but still no output.  I know our RTC is working because  I can set and read the date and time and see it change.  Here is what  I have to try to get the RTC output:

    // Enable the hibernate module.
    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_HIBERNATE);

    // Configure Hibernate module clock.
    ROM_HibernateEnableExpClk(32768);
    ROM_HibernateClockConfig(HIBERNATE_OSC_LOWDRIVE);//Configure the crystal settings

    // Enable RTC mode.
    ROM_HibernateRTCEnable();

    // Configure the hibernate module counter to 24-hour calendar mode.
    ROM_HibernateCounterMode(HIBERNATE_COUNTER_24HR);

    //Now configure Pin PP3
    ROM_GPIOPinConfigure(GPIO_PP3_RTCCLK);

    // Configure HIBCC for RTCOSC available
    HIB_CC_R |= HIB_CC_SYSCLKEN;

    Thanks,

    Bill

  • Hello Bill,

    There were more intiialization that needed to be done for the GPIO in terms of the GPIOAFSEL and GPIODEN bit for Pin-3 to be set. Also some of the hibernate function were not correctly done.

    Attached is the code (modified on top of yours)

    //*****************************************************************************
    //
    // TM4C129_HibernateClockOut.c - Example demonstrating how to configure the
    //						TM4C129 Hibernate Clock Out on a Port Pin
    //
    // Copyright (c) 2014 Texas Instruments Incorporated.  All rights reserved.
    // Software License Agreement
    //
    //   Redistribution and use in source and binary forms, with or without
    //   modification, are permitted provided that the following conditions
    //   are met:
    //
    //   Redistributions of source code must retain the above copyright
    //   notice, this list of conditions and the following disclaimer.
    //
    //   Redistributions in binary form must reproduce the above copyright
    //   notice, this list of conditions and the following disclaimer in the
    //   documentation and/or other materials provided with the
    //   distribution.
    //
    //   Neither the name of Texas Instruments Incorporated nor the names of
    //   its contributors may be used to endorse or promote products derived
    //   from this software without specific prior written permission.
    //
    // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
    // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
    // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
    // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
    // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
    // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    //
    // This is part of revision 2.1.0.12573 of the Tiva Firmware Development Package.
    //
    //*****************************************************************************
    
    #include <stdbool.h>
    #include <stdint.h>
    #include "inc/hw_memmap.h"
    #include "inc/hw_types.h"
    #include "inc/hw_gpio.h"
    #include "inc/hw_ints.h"
    #include "inc/hw_uart.h"
    #include "inc/hw_hibernate.h"
    #include "driverlib/gpio.h"
    #include "driverlib/pin_map.h"
    #include "driverlib/sysctl.h"
    #include "driverlib/uart.h"
    #include "driverlib/hibernate.h"
    #include "driverlib/interrupt.h"
    #include "utils/uartstdio.h"
    
    //*****************************************************************************
    //
    // System clock rate in Hz.
    //
    //*****************************************************************************
    volatile uint32_t g_ui32SysClock;
    
    //*****************************************************************************
    //
    // This function sets up UART0 to be used for a console to display information
    // as the example is running.
    //
    //*****************************************************************************
    void
    InitConsole(void)
    {
        //
        // Enable GPIO port A which is used for UART0 pins.
        // TODO: change this to whichever GPIO port you are using.
        //
        SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
    
        //
        // Configure the pin muxing for UART0 functions on port A0 and A1.
        // This step is not necessary if your part does not support pin muxing.
        // TODO: change this to select the port/pin you are using.
        //
        GPIOPinConfigure(GPIO_PA0_U0RX);
        GPIOPinConfigure(GPIO_PA1_U0TX);
    
        //
        // Enable UART0 so that we can configure the clock.
        //
        SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);
    
        //
        // Use the internal 16MHz oscillator as the UART clock source.
        //
        UARTClockSourceSet(UART0_BASE, UART_CLOCK_PIOSC);
    
        //
        // Select the alternate (UART) function for these pins.
        // TODO: change this to select the port/pin you are using.
        //
        GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);
    
        //
        // Initialize the UART for console I/O.
        //
        UARTStdioConfig(0, 115200, 16000000);
    }
    
    //*****************************************************************************
    //
    // Main Test Code...
    //
    //*****************************************************************************
    int
    main(void)
    {
        //
        // Run from the PLL at 120 MHz.
        //
        g_ui32SysClock = SysCtlClockFreqSet((SYSCTL_XTAL_16MHZ |
                    SYSCTL_OSC_INT | SYSCTL_USE_PLL |
                    SYSCTL_CFG_VCO_480), 120000000);
    
    
    	//
    	// Initalize UART-0 COM
    	//
    	InitConsole();
        UARTprintf("UART Is Working...\n");
    
        //
        // Enable GPIO Module and Configure the Pin Mux.
        //
    	SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOP);
    	while(!(SysCtlPeripheralReady(SYSCTL_PERIPH_GPIOP)));
    	GPIOPinConfigure(GPIO_PP3_RTCCLK);
        GPIODirModeSet(GPIO_PORTP_BASE, GPIO_PIN_3, GPIO_DIR_MODE_HW);
        GPIOPadConfigSet(GPIO_PORTP_BASE, GPIO_PIN_3, GPIO_STRENGTH_8MA, GPIO_PIN_TYPE_STD);
    
    	//
    	// Enable Hibernate Module Clock and wait for module to be ready
    	//
    	SysCtlPeripheralEnable(SYSCTL_PERIPH_HIBERNATE);
    	while(!(SysCtlPeripheralReady(SYSCTL_PERIPH_HIBERNATE)));
    
    	// Configure Hibernate module clock.
    	HibernateEnableExpClk(g_ui32SysClock);
    
    	// Enable RTC mode.
    	HibernateRTCEnable();
    
    	// Configure the hibernate module counter to 24-hour calendar mode.
    	HibernateCounterMode(HIBERNATE_COUNTER_24HR);
    
    
    	// Configure HIBCC for RTCOSC available
    	HWREG(HIB_CC) = HIB_CC_SYSCLKEN;
    
    	while(1);
    
    }
    

    Regards

    Amit