System Controller Firmware 101 - Timer service

Showing results for 
Search instead for 
Did you mean: 

System Controller Firmware 101 - Timer service

No ratings

System Controller Firmware 101 - Timer service

The system controller timer service is responsible for:

  • Watchdog - The watchdog resource is managed by the SCU. The SCFW exposes a "virtual" watchdog to all CPUs. This virtual watchdog is managed by software and it is based on a low power timer, the SCU also features a physical watchdog timer that is used to ensure the correct operation of the device.

Some of the features implemented by this watchdog service are:

- Update of the watchdog timeout

- Start/stop of the watchdog

- Refresh of the watchdog

- Return of the watchdog status such as maximum watchdog timeout that can be set, watchdog timeout interval, and watchdog timeout interval remaining.

Since this is usually handled by the OS itself no examples are provided in this guide.

  • Real Time Clock (RTC) - The SCFW is responsible for providing access to the RTC. The features supported by the API are:

- Set/get time

- Setting alarms

Only the partition that owns the SC_R_SYSTEM resource is allowed to set the time, alarms and calibration values for the RTC. All other partitions are able to read the RTC time. 

Here is an example on setting the RTC from the M4 side:

struct time_date{
     uint16_t year;
     uint8_t month;
     uint8_t day;
     uint8_t hour;
     uint8_t min;
     uint8_t sec;
} rtc_time;
sc_err_t sc_status;
sc_ipc_t ipc;

/* Open IPC channel */
sc_status = sc_ipc_open(&ipc, SC_IPC_AP_CH0);
if(sc_status != SC_ERR_NONE)
    printf("Error opening Inter Processor Channel\n");

/* Initialize RTC */
/* Hard code RTC time to January 5th 2018 at 12:00 hours */
sc_status = sc_timer_set_rtc_time(ipcHandle, 2018, 1, 5, 12, 0, 0);
if(sc_status != SC_ERR_NONE)
    printf("Error initializing RTC. \r\n");

/* Return time */
sc_status = sc_timer_get_rtc_time(ipcHandle, &(rtc_time.year), &(rtc_time.month), &(, &(rtc_time.hour), &(rtc_time.min), &(rtc_time.sec));
printf("Year: %d, Month: %d, Day: %d, Hour: %d, Minutes: %d, Seconds: %d. \r\n", rtc_time.year, rtc_time.month,, rtc_time.hour, rtc_time.min, rtc_time.sec);‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍ 

Tags (3)
Version history
Revision #:
2 of 2
Last update:
‎09-10-2020 03:37 AM
Updated by: