Programming Atmega32a using GitHub jeelabs library

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

Hello there,

I'm facing a problem when trying to program an Atmega32A with a simple example from jeelib library (test1)

 

 

https://github.com/jeelabs/jeelib

 

The following error message appears when trying to compile:

"{...} *error: 'WDP3' was not declared in this scope"

Soo... Does anybody know what the equivalent of WDP3 is in ATmega32A?

Thank you in advance.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Welcome to AVRFreaks.

 

I do not have a direct answer to your question, but could the answer lay in this quote from the Github page?

 

" JeeLib is an Arduino IDE library "

Ross McKenzie, Melbourne Australia

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes, I'm using Arduino's IDE. 

 

Also, I installed a board manager library to compile my code to Atmega32

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

chisp88 wrote:
I'm facing a problem when trying to program an Atmega32A with a simple example from jeelib library (test1)

Had a quick browse of that Github project and cannot find ANY documentation as to which processors are supported. I must therefore conclude that this library is suitable ONLY for official Arduino boards.

 

 

Read the ATmega328P datasheet (I.e. Pertaining to an Arduino UNO)

 

11.9.2 WDTCSR – Watchdog Timer Control Register

...

Bit 5, 2:0 - WDP[3:0]: Watchdog Timer Prescaler 3, 2, 1 and 0
The WDP[3:0] bits determine the Watchdog Timer prescaling when the Watchdog Timer is running. The
different prescaling values and their corresponding time-out periods are shown in Table 11-2 on page 64.

 

Last Edited: Thu. Aug 4, 2022 - 08:44 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

 

WDP3 is only used here:

 

 

Just read the function name. That is talking about using a watchdog interrupt. Here's the thing: mega328p (CPU in Arduino) can do both WDT resets and WDT interrupts. mega32 can ONLY do WDT resets. So if this code is absolutely reliant on WDT interrupts I'm afraid it won't work on mega32. 

 

HOWEVER the usual use of WDT interrupt is simply because you are looking for a "long timer" so you can SLEEP the CPU then wake up a long time later. You might be able to create something similar just using a "normal" timer but if the period is shorter you might have to wake up several times just to increment a counter before you do the actual work on the Nth wake up. This would require some re-engineering of the lib code to make it "mega32 friendly" though

 

Last Edited: Thu. Aug 4, 2022 - 10:35 AM