0

In simple terms: I am trying to setup a timer/counter clocked by an external source. The device is SAMR30-Xplained Pro and RIOT is the OS.

In a bit more detail: I am trying to get a gclk generator (e.g 6) to connect to a timer/counter (e.g TC4), and hooking up the generator to a GCLK_IO (PA22) as clock source. Only the generator 0 is active and makes the timers count, but other generators aren't even starting, even though I try to enable them. Here is my code.

Would anyone know what is going on here? Is RIOT disabling them somehow?

Citrullin
  • 2,269
  • 14
  • 29
  • Hi Naveed, it would be great if you could embed main parts of code to your question. It will increase your chance of getting good answers. https://stackoverflow.com/help/how-to-ask But could you check something in lines 38 and 42 of your external_event_counter.c? Shouldn't those busy waits be "while (GCLK->STATUS.reg & GCLK_STATUS_SYNCBUSY);" ? – Bruno Pessanha Jan 23 '20 at 14:52

1 Answers1

0

You shouldn't have to configure the GCLKs manually.

Setting .gclk_src in the timer_config struct in periph_conf.h should be enough. The GCLK is then enabled automatically by RIOT when you configure the timer.

user1273684
  • 1,559
  • 15
  • 24