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.

RTOS/MSP432-RTOS: Setting up Real Time Clock information using RTOS and not Driver Library

Part Number: MSP432-RTOS
Other Parts Discussed in Thread: SYSBIOS

Tool/software: TI-RTOS

Hi Team,

I am trying to create real time clock information in my firmware to get the time when the file is written on SD card.

I am using RTOS and I am not able to find any sample code that shows real time clock application using RTOS.

I used the Seconds module but that is based on relative time and not real time because the date and time showed is depended on the Seconds_set(value) that I set.

Please provide some information.

Thank you in advance.

  • G'Day Vikram,

    To me, the Seconds module in SYSBIOS for MSP432, looks like a driver/wrapper for the MSP432 RTC peripheral.
    (See source code in [RTOS_INSTALL_DIR]/products/bios_6_46_00_23/packages/ti/sysbios/family/arm/msp432/Seconds.c)

    You can set the time using Seconds_set() where the parameter is the number of seconds since epoch (12:00am 1/1/1970) then using Seconds_get() will give you what the time is now, again in seconds since epoch.

    You can use the time.h standard c library to convert between time/date and seconds since epoch if you need to.

    It is useful to work in seconds since epoch because it allows you to do maths on the time. Doing maths on a time/date is much harder! However, be aware that the conversions to/from time/date to seconds-since-epoch will break in 2036. This is because seconds-since-epoch is stored as a uint32 and will overflow in 2036. NOTE: This is a problem with the CONVERSIONS only - the RTC peripheral itself stores time as a time/date, not seconds-since-epoch.

    If you are uncomfortable using the seconds module, there is nothing wrong with using MSPWare or direct register read/writes to the RTC module .

    Cheers
    Julian
  • Hi Julian,
    Thank you for the response. This makes it easy to understand.
    Just want to clarify one more thing when you said,
    "If you are uncomfortable using the seconds module, there is nothing wrong with using MSPWare or direct register read/writes to the RTC module ."
    do you mean to use the driver library and not the RTOS. Is that right?
    Vikram
  • G'Day Vikram,

    Sorry, yes, I mean the driver library.

    (The Peripheral Driver Library (DriverLib) is part of MSPWare so I tend to use the names interchangeably)

    Cheers

    Julian