Go Down

Topic: Not able to initiate timer interrupt for Arduino UNO wifi rev2 (Read 378 times) previous topic - next topic



I am trying to set up a timer interrupt to run a certain function with a repetitive time intervall. I have read through the datasheet in order to set up a timer interrupt. But I am not able to make it work.http://ww1.microchip.com/downloads/en/DeviceDoc/40002016A.pdf

- Can somebody help me out?
- I am also not sure what name the interrupt vector must have in order to be run when the timer interrupt is active?

The code i have written so faar:

ISR(RTC_CNT_vect) {

void setup() {
  // put your setup code here, to run once:
  FUSE.OSCCFG = (FUSE.OSCCFG & 0b11111100) | 0b1;               //16 MHz cpu frequency selected.
  CLKCTRL.MCLKCTRLA = (CLKCTRL.MCLKCTRLA & 0b11111100) | 0b1;   //32,768 kHz internal oscillator selected (OSCULP32K).
  if(RTC.STATUS = RTC.STATUS & 0b1 == 0) {                      //check that the CTRLABUSY flag in RTC.STATUS is cleared before writing to this register.
    RTC.CTRLA  = (RTC.CTRLA & 0b10000110) | 0b1111101;          //32768 as prescaler (0b11110000), corr enabled (0b100) and rtc enabled (0b1).

void loop() {
  // put your main code here, to run repeatedly:



This is an old post but I can offer a couple suggestions.
First, it is not good practice to put a print statement inside an ISR. A better option is to set a flag and then initiate the print in the loop if the flag is set.

Another suggestion is to check the following post to see if your Rev2 is assembled wrong.

Lastly, my board had the manufacturing defect described above. I returned it and am waiting for the replacement to arrive. I should get it in a few days and will let you know if your code works on that board.


Unfortunately the new Rev2 arrived with the same problem so I can't try to duplicate this issue.

Go Up