WILDLY incorrect delays and times on custom ATmega32u4

Go To Last Post
3 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Folks,

 

This is hopefully the last of my questions as I try to debug some issues with a custom board, a partial schematic of which is provided below (no, I didn't design the thing).

 

I noticed while running blink code that the delays were approximately 10X longer than specified. To further diagnose the issue, I had it report over Serial the milliseconds since start (millis()).  I had included 100 ms on and 100 ms off in the code using delay(100). Thus, 15 on-off cycles should take 3,000 ms.   

 

Millis() reported a cumulative time of ~3,000 ms. The actual elapsed time was 24 seconds!  

 

Any thoughts on what could be so wildly wrong?  I need to do some timekeeping in this project. 

This topic has a solution.

<p>~ Athyrio</p>

Last Edited: Wed. Aug 15, 2018 - 07:13 PM
This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Bet your "10X" is really 8X and it's because of CKDIV8.
.
EDIT of course 24s / 3s is exactly 8 so there's really no question this is CKDIV8 (one of the default fuse settings)

Last Edited: Wed. Aug 15, 2018 - 07:08 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ahhhh!  Makes perfect sense. 

 

If only I could get avrdude running, I'd fix that!  Easy enough for the time being to handle in code. Thanks!

<p>~ Athyrio</p>