I'm trying to call an interrupt routine (let's call it handler() ) every second on my arduino DUE. I thought the simplest way to do this was to use this library but it seems that i don't know how to use it...


my code

  • 1
    I guess you mean start(1000000). Commented Feb 19, 2019 at 11:26
  • yep............... this is embarassing ahahah Do you have a guess on why wasn't it working with start(1000) ? is Serial.print too long to execute ?
    – Julie96
    Commented Feb 19, 2019 at 13:31
  • 1
    Serial print in an ISR is not recommended. Set a flag in the ISR and poll in the loop() instead. Commented Feb 19, 2019 at 13:32

1 Answer 1


You are trying to print 6 characters ("test\r\n"), i.e. 60 bits including the start and stop bits, 1000 times per second. This requires a baud rate of at least 60 kbit/s, yet the serial port has been configured for only 9.6 kbit/s. Something has to give...

As Mikael Patel wrote in a comment, it is generally inadvisable to Serial.print() from within an ISR. It is supposed to work, though, as long as you don't fill the Serial output buffer. The problem is that your code does fill the buffer, as it is writing to it faster than the UART can empty it. Once the buffer is full, the program will malfunction.

  • thank you ! I will definitly use a flag now
    – Julie96
    Commented Feb 20, 2019 at 15:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.