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.

RTC on Crypto Connected Launchpad (EK-TM4C129EXL)

I'm trying to use the internal RTC of TM4C128E with TI-RTOS http example

I found some information on  Page 289 of the TivaWare-C Documantation (spmu298a.pdf).

I added the header to my sourcefile

/* XDCtools Header files */
#include <xdc/std.h>
#include <xdc/cfg/global.h>
#include <xdc/runtime/System.h>

/* BIOS Header files */
#include <ti/sysbios/BIOS.h>

/* TI-RTOS Header files */
#include <ti/drivers/GPIO.h>
#include <ti/drivers/UART.h>

/* Example/Board Header files */
#include "Board.h"

#include <stdint.h>

//#include "inc/hw_hibernate.h"
#include <driverlib/hibernate.h>

Void techoFxn(UArg arg0, UArg arg1)
{
    char input;
    UART_Handle uart;
    UART_Params uartParams;
    const char echoPrompt[] = "\fEchoing X characters:\r\n";


    ui32Status = HibernateIntStatus(0);
    	HibernateIntClear(ui32Status);
    	HibernateCalendarGet(&temptime);
    	temptime.tm_sec = 0xFF;
    	HibernateCalendarMatchSet(0,&temptime);
    	HibernateIntEnable(HIBERNATE_INT_RTC_MATCH_0);
    	while (!(HibernateIntStatus(0)));  // waits for any interrupt (there is only one type enabled)
        TimerEnable(TIMER7_BASE, TIMER_A);
    	ui32Status = HibernateIntStatus(0);
    	HibernateIntClear(ui32Status);
    	HibernateIntDisable(HIBERNATE_INT_RTC_MATCH_0);


    /* Create a UART with data processing off. */
    UART_Params_init(&uartParams);
    uartParams.writeDataMode = UART_DATA_BINARY;
    uartParams.readDataMode = UART_DATA_BINARY;
    uartParams.readReturnMode = UART_RETURN_FULL;
    uartParams.readEcho = UART_ECHO_OFF;
    uartParams.baudRate = 115200;
    uart = UART_open(Board_UART0, &uartParams);

    if (uart == NULL) {
        System_abort("Error opening the UART");
    }

	  UART_write(uart, echoPrompt, sizeof(echoPrompt));

	    /* Loop forever echoing */
	    while (1) {
	        UART_read(uart, &input, 1);
	        UART_write(uart, &input, 1);
	    }


}

My Question is:

What is the difference between inc/hw_hibernate.h and driverlib/hibernate.h ?

Why do i get this Errors: bool is undefined?

"/home/tuxx/ti/tirtos_tivac_2_14_00_10/products/TivaWare_C_Series-2.1.1.71b/driverlib/hibernate.h", line 246: error #20: identifier "bool" is undefined
"../techo.c", line 36: error #20: identifier "ui32Status" is undefined
"../techo.c", line 38: error #20: identifier "temptime" is undefined
"../techo.c", line 43: warning #225-D: function "TimerEnable" declared implicitly
"../techo.c", line 43: error #20: identifier "TIMER7_BASE" is undefined
"../techo.c", line 43: error #20: identifier "TIMER_A" is undefined
8 errors detected in the compilation of "../techo.c".

  • Hello Simon

    The file inc/hw_hibernate.h contains the register macro definition while the file driverlib/hibernate.h contain the API that can be called by the application to configure and setup the hibernate module. The file hibernate.c calls the macro's from inc/hw_hibernate.h.

    For resolving the errors, you need to include stdbool.h

    Regards
    Amit
  • Thank you for your fast Answer.

    I still get some errors after declaring the variables.

    struct tm temptime;

    "../techo.c", line 37: error #71: incomplete type is not allowed

    "../techo.c", line 46: warning #225-D: function "TimerEnable" declared implicitly <- from where do i get this functions?
    "../techo.c", line 46: error #20: identifier "TIMER7_BASE" is undefined
    "../techo.c", line 46: error #20: identifier "TIMER_A" is undefined

    Actually i don't even know if this code is correct to simply set and get the RTC Time and Date.


    Thank you

  • Hello Simon,

    You have not included the files inc/hw_memmap.h and driverlib/timer.h as well. Whenever you see errors like implicit defintion or undefined identified it would be good to search in the inc and driverlib directories of TivaWare.

    I am not sure what is on line 37, but possibly what is not correct is

    const char echoPrompt[] initialization.

    Regards
    Amit
  • I'm completely new to MCUs from TI, do you have any ideas where to find an example that shows how to set and get the Time and Date?

    I still have this Error:
    struct tm temptime; <- "../techo.c", line 39: error #71: incomplete type is not allowed

    Thank you very much!
  • Hello Simon,

    You may want to check the hibernate example in TivaWare first.

    Regards
    Amit
  • Hello Amit,

    This example is exactly what i searched for.

    On my Launchpad i've got a 32kHz external quartz, how do i configure the hibernation module to use this one?

    It seems like this example is clocked from the main oscillator.

    ui32SysClock = MAP_SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ |
    SYSCTL_OSC_MAIN |
    SYSCTL_USE_PLL |
    SYSCTL_CFG_VCO_480), 120000000);

    // Configure Hibernate module clock.
    HibernateEnableExpClk(ui32SysClock);
  • Hello Simon,

    No. The 32K is the only clock source for Hibernate Module. The System Clock parameter is a place holder parameter.

    Regards
    Amit