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 Calendar Mode

Other Parts Discussed in Thread: TM4C123GH6PM


Hi all

I am trying to use RTC  using calendarmode in TM4C123gxl
it is showing error of #141 Too many argument in fucntion call  
i have read the thread related to RTC calendar but unable to figure out ?
need some inputs



#include <stdint.h>
#include <stdbool.h>
#include <string.h>
#include <time.h>
#include "inc/hw_memmap.h"
#include "inc/hw_types.h"
#include "driverlib/gpio.h"
#include "driverlib/sysctl.h"
#include <utils/ustdlib.c>
#include "driverlib/eeprom.h"
#include "driverlib/hibernate.h"
#include "driverlib/pin_map.h"




float fval;
int fint,ffloat,X2,esize,write=99,read,Sec=0,HR=0,SS=0;
char X1[10]={0},ESZE[5]={0},RD[10]={0};
struct tm time1;

/* FUNCTION PROTOTYPE USED IN PROGRAMME  */
void LcdInit();
void delay_ms();
void delay_us();
void displaystrn(volatile char row,volatile char column,char *string);
void displaychar(volatile char temp);
void lcdcursor(volatile char row,volatile char column);
void lcdwritecontrol(volatile unsigned char temp);
void lcdwritedata(volatile unsigned char temp);
void RTC_TimeDisplay(void);
void SetRTCTime(void);




 void RTC_TimeDisplay()
   {
      struct tm time2;

      SetRTCTime();            // To Take Updated time from User
      HibernateRTCGet(&time2);


      HR=time2.tm_sec;
      SS=time2.tm_min;
      GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_3|GPIO_PIN_2|GPIO_PIN_1,0x04);  // Blue LED On
   }
 void SetRTCTime()
   {
     // to be continue later
   }


void main(void)
{
       /* SYSTEM CLOCK SETTINGS */
    SysCtlClockSet(SYSCTL_SYSDIV_5|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|SYSCTL_OSC_MAIN);      // Setting the System Clock 40Mhz

    /* GPIO PORTB PORTF SETTINGS*/
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);    // Enable GPIO Port F
    SysCtlDelay(6);                                   // 450ns approx
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);    // Enable GPIO Port B For LCD Lines
    SysCtlDelay(6);                                   // 450ns approx

    // Check if the peripheral access is Enabled.
    while(!SysCtlPeripheralReady(SYSCTL_PERIPH_GPIOF))
    {
    }
    while(!SysCtlPeripheralReady(SYSCTL_PERIPH_GPIOB))
    {
    }

    /* EEPROM SETTINGS */
    SysCtlPeripheralEnable(SYSCTL_PERIPH_EEPROM0);  // EEPROM activate
    EEPROMInit();                                    // EEPROM start  This function \b must be called after SysCtlPeripheralEnable() and before
                                                    //! the EEPROM is accessed.  It is used to check for errors in the EEPROM state
                                                     //! such as from power failure during a previous write operation.  The function
                                                    //! detects these errors and performs as much recovery as possible.

    /*  Hibernate Module Settings */
    SysCtlPeripheralEnable(SYSCTL_PERIPH_HIBERNATE);
    HibernateEnableExpClk(SysCtlClockGet());
 //   HibernateRTCSet(0);       //Reset the RTC to 0
    HibernateRTCEnable();       // Turn the RTC on
    HibernateCounterMode(HIBERNATE_COUNTER_24HR);
    HibernateCalendarSet(&time1);

    time1.tm_year =105 ;   //100 + year; //sTime.tm_year is the time 1900 and current year.
    time1.tm_mon = 1 ;   //month;
    time1.tm_mday =2  ;  //dayOfMonth;
    time1.tm_wday =1  ; //dayOfWeek;
    time1.tm_hour = 1 ;  //hour;
    time1.tm_min =  1 ;  //minute;

    HibernateCalendarSet(&time1);
    //<-- the struct declared

    /* GPIO PIN DIRECTION  */
    GPIOPinTypeGPIOOutput(GPIO_PORTB_BASE,GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3| GPIO_PIN_4| GPIO_PIN_5| GPIO_PIN_6| GPIO_PIN_7);
    GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE,GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3);
    LcdInit();    // LCD Configuration



 
      EEPROMRead((uint32_t *)&read,0x0000,sizeof(read));             // EEPROM Reading
      delay_ms(10);



      // Loop forever.
      while(1)
       {
           RTC_TimeDisplay();      // Function Related to Run the Real time clock and Recalibrate the Timings

       
           displaystrn(1,1,"Time is:");
           usprintf(X1,"%d:%d",HR,SS);      // float to string converion
       displaystrn(1,9,X1);
       delay_ms(15);


       }    // End of Infinite Loop

}     // End of Main Function














  • Hello Gaurav,

    Can you please provide the compilation logs so that we can see which function is causing the issue?
  • HI Amit

    i think HibernateRTCGet(&time2); is having issues

    compilation log :

    *** Build of configuration Debug for project Try2 ****

    "C:\\TInew\\ccsv6\\utils\\bin\\gmake" -k all
    'Building file: ../Tiva_LCD.c'
    'Invoking: ARM Compiler'
    "C:/TInew/ccsv6/tools/compiler/ti-cgt-arm_5.2.5/bin/armcl" -mv7M4 --code_state=16 --float_support=FPv4SPD16 --abi=eabi -me -O2 --include_path="C:/TInew/ccsv6/tools/compiler/ti-cgt-arm_5.2.5/include" --include_path="C:/ti/TivaWare_C_Series-2.1.3.156" --advice:power=all -g --gcc --define=ccs="ccs" --define=PART_TM4C123GH6PM --define=TARGET_IS_TM4C123_RB1 --diag_wrap=off --diag_warning=225 --display_error_number --gen_func_subsections=on --ual --preproc_with_compile --preproc_dependency="Tiva_LCD.pp"  "../Tiva_LCD.c"
    "C:/ti/TivaWare_C_Series-2.1.3.156/utils/ustdlib.c", line 193: remark #1527-D: (ULP 2.1) Detected SW delay loop using empty loop. Recommend using a timer module instead
    "C:/ti/TivaWare_C_Series-2.1.3.156/utils/ustdlib.c", line 383: remark #1527-D: (ULP 2.1) Detected SW delay loop using empty loop. Recommend using a timer module instead
    "C:/ti/TivaWare_C_Series-2.1.3.156/utils/ustdlib.c", line 505: remark #1527-D: (ULP 2.1) Detected SW delay loop using empty loop. Recommend using a timer module instead
    "C:/ti/TivaWare_C_Series-2.1.3.156/utils/ustdlib.c", line 1625: remark #2623-D: (ULP 5.4) Detected an assignment to a type with size less than int. To avoid unnecessary sign extension, use int-sized types for local varaibles and convert to smaller types for static storage.
    "C:/ti/TivaWare_C_Series-2.1.3.156/utils/ustdlib.c", line 1626: remark #2623-D: (ULP 5.4) Detected an assignment to a type with size less than int. To avoid unnecessary sign extension, use int-sized types for local varaibles and convert to smaller types for static storage.
    "../Tiva_LCD.c", line 133: remark #2623-D: (ULP 5.4) Detected an assignment to a type with size less than int. To avoid unnecessary sign extension, use int-sized types for local varaibles and convert to smaller types for static storage.
    "../Tiva_LCD.c", line 143: remark #2623-D: (ULP 5.4) Detected an assignment to a type with size less than int. To avoid unnecessary sign extension, use int-sized types for local varaibles and convert to smaller types for static storage.
    "../Tiva_LCD.c", line 175: remark #2623-D: (ULP 5.4) Detected an assignment to a type with size less than int. To avoid unnecessary sign extension, use int-sized types for local varaibles and convert to smaller types for static storage.
    "../Tiva_LCD.c", line 186: remark #2623-D: (ULP 5.4) Detected an assignment to a type with size less than int. To avoid unnecessary sign extension, use int-sized types for local varaibles and convert to smaller types for static storage.
    "../Tiva_LCD.c", line 221: error #141: too many arguments in function call
    "../Tiva_LCD.c", line 245: remark #1527-D: (ULP 2.1) Detected SW delay loop using empty loop. Recommend using a timer module instead
    "../Tiva_LCD.c", line 248: remark #1527-D: (ULP 2.1) Detected SW delay loop using empty loop. Recommend using a timer module instead
    "C:/ti/TivaWare_C_Series-2.1.3.156/utils/ustdlib.c", line 42: remark #1534-D: (ULP 7.1) Detected use of global variable "g_pcHex" within one function "uvsnprintf". Recommend placing variable in the function locally
    1 error detected in the compilation of "../Tiva_LCD.c".

    >> Compilation failure
    gmake: *** [Tiva_LCD.obj] Error 1
    gmake: Target `all' not remade because of errors.

    **** Build Finished ****

    screen shot below

  • Hello Gaurav,

    Line 221 of the Tiva_LCD.c has a function call which does not have the correct argument. In the source please check which function is it.
  • Dear Amit
    As i mention earlier in Compilation log

    Line 221 of the Tiva_LCD.c is
    HibernateRTCGet(&time2); Function in the code
    as i have created local variable time2 to access the struct variable date and time
  • Hello Gaurav,

    HibernateRTCGet is prototype as

    uint32_t HibernateRTCGet(void)

    In other words it does not have an argument but passes back a 32-bit unsigned value of the RTCC register.