SBC FS65 - Cannot use the LDT Timer twice in a row

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

SBC FS65 - Cannot use the LDT Timer twice in a row

1,123 Views
gabriel-fz
Contributor II

Hi,

 

I'm trying to use the LDT timer to make my system sleep for a specific amount of time.

The following function configures my LDT:

    // The counter must be disabled (~ENABLE) before reading its value and enabled again.
    bool const counter_should_be_running = false;
    status = FS65_LDT_RunCounter(counter_should_be_running);
    if (status != fs65StatusOk) return -1;

    // Long Duration Timer
    // The timer is configurable by the SPI and can operate in normal mode and low-power mode
    // The LDT as multiple functions
    // Function 4: In low-power mode, count until the counter reaches the wake-up value and wakes up.
    //
    // NXP FS6500, Product data sheet rev7.0, 12.8.3 Timer operation
    fs65_ldt_function_t const timer_is_our_alarm_clock = fs65LdtFunc4;
    status = FS65_LDT_SetTimerOperation(timer_is_our_alarm_clock);
    if (status != fs65StatusOk) return -1;

    // When function 4 is selected and the counter reaches the wake-up value (EOT), the device wakes up and the counter
    // is stopped.
    //
    // NXP FS6500, Product data sheet rev7.0, 12.8.3 Timer operation
    uint32_t const wakeup_value = sleep_time_sec; //< The timer is configured at 1 Hz
    status = FS65_LDT_SetWakeUpValue(wakeup_value);
    if (status != fs65StatusOk) return -2;

    bool const start_running = true;
    status = FS65_LDT_RunCounter(start_running);
    if (status != fs65StatusOk) return -3;

 

The first time I call this function it works great.
The problem occurs when I call this function a second time: the LDT timer refuses to be disabled.

More specifically, the FS65_LDT_RunCounter(false) function fails because LDT_ENABLE is still set to 1.

gabrielfz_1-1675883174202.png

The proof of the LDT_ENABLE is still set.

gabrielfz_0-1675883117078.png

What is the proper way to configure the timer so it can be used twice in a row?

Regards,
Gabriel

Tags (2)
0 Kudos
Reply
1 Reply

1,110 Views
guoweisun
NXP TechSupport
NXP TechSupport

what do you mean  twice in a row?

First time use the LDT wakeup SBC from LPOFF mode, now the SBC is waken up,what about the second time LDT?

0 Kudos
Reply