High Resolution Timer timer_enable() not working as expected

I have a project where I need to send an impulse to a relay. If the XBee module receives a valid command, a relay will be triggered for 125ms. For this purpose I wanted to use the High Resolution Timer (ONE_SHOT).

So I:

  1. Configured my timer accordingly:

timer_config(relayTimer, FALSE, ONE_SHOT, 125000);

(this call returned 0 to indicate success)

  1. I tried to enable the timer when needed:

timer_enable(relayTimer, TRUE);

But nothing happened!? Interestingly, the API for timer_enable doesn’t return anything so I can’t tell if the timer was enabled correctly.

If I configure the timer to start immediately, it works as expected. I also tried to start a periodic timer with individual calls:


timer_set_timeout(relayTimer, 125000);
timer_set_mode(relayTimer, PERIODIC);
timer_irq_enable(relayTimer, TRUE);
timer_enable(relayTimer, TRUE);

But this didn’t work either… So… should it work? False expectations? Something wrong on my end? I have no issues calling the timer_config() to start immediately but I keep wondering why can’t I start a configured timer that’s disabled?

API Reference: http://exsilium.github.io/xbee-sdk-doc/group__api__timer.html

Try looking over http://127.0.0.1:56775/help/topic/com.digi.xbee.api.doc/html/1.6.0/pg/pg_hr_timer.html?resultof="High"%20"high"%20"resolution"%20"resolut"%20"timer"%20"API"%20"api"%20

Based on the programming guide it should work as I expected but for some reason, it doesn’t. Or did you wan’t to highlight something specific?

http://xbee-sdk-doc.readthedocs.io/en/latest/api_doc/pg/#113-high-resolution-timer