Default F_CPU for "ATmega4809 Xplained Pro"?

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

If this is just a matter of RTFM, then I apologize for not having read every word of the manual, because I have not. But, seems to me that this warrants at least some word in the Xplained Pro manual. I read it very carefully and searched for both "F_CPU" and "MHz", turning up no hits. 

 

So, can some kind soul enlighten me about F_CPU? AFAIK, I have not touched any fuses and have never invoked START onto this board. 

 

Really, all I want to do is test some TWI code, but you have to set the bit rate to do that!

 

Thanks

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

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

megaAVR 0-series have two CPU frequencies due to the wide VDD range (Safe Operating Area or SOA)

Getting started ATtiny 1 & 0 series / Application Notes | AVR Freaks

TWI attachment, file I2C.h, line 57 has 20MHz

 


ATmega4809 Xplained Pro

 

"Dare to be naïve." - Buckminster Fuller

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

Guess that I'll just have to "hack it". Or RTFM.

 

Thanks

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

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

Disclaimer:  I've not worked with the O-series yet.

 

I think the default is the internal 20 MHz Osc with the Div by 6 fuse enabled, for a startup of 3.333 MHz.

(Yes, that is /6, not /8)

 

I'd run your blink the LED at 1 Hz test assuming the above and see if it works.

 

JC

 

Edit: Typo

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

Thanks JC.

 

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

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

If it helps, my 4809 Curiosity Nano (see recent post) runs at 20MHz.

#1 Hardware Problem? https://www.avrfreaks.net/forum/...

#2 Hardware Problem? Read AVR042.

#3 All grounds are not created equal

#4 Have you proved your chip is running at xxMHz?

#5 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand."

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

But as JC says they power on with a default /6 so usually the first thing you have to do in code is a CCP protected write to clear the /6 if you really want 20MHz rather than 3.3333MHz.

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

OK, so I need to look at actual fuse values.

 

Thanks

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

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

this link has some info about that protected write

 

https://www.avrfreaks.net/forum/tutsoft-avr-01-series-setting-tca0-split-mode-pwm

 

_PROTECTED_WRITE(CLKCTRL.MCLKCTRLB, CLKCTRL_PDIV_1X_gc | CLKCTRL_PEN_bm);

 

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

Correction, I guess... (improper terminology) in case someone stumbles on this:

 

1. The clock prescale value is not a fuse setting, unlike M328, but is in CLKCTRL.MCLKCTRLB

 

2. The initial choice of 16MHz or 20MHz IS a fuse setting OSCCFG fuse

 

3. As implied in Ron's msg #9, CLKCTRL.MCLKCTRLB has write protection.

 

Jim

 

 

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

Last Edited: Fri. Feb 14, 2020 - 08:11 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You have only 2 possible speeds out of reset - 3.33MHz/2.66MHz, depending on what OSCCFG.FREQSEL fuse it set to, which has already been said (9.3.3 Main Clock After Reset). You cannot muck up the clock system, and it appears the only time you have the potential for problems is if you successfully switched to an ext clock (as main clock) and then lose the ext clock, which then requires a reset (wdt).

 

One thing to watch out for- Vdd vs freq (info is in another datasheet for the mega4809). For example, if you want to run at 3.3v, then your max becomes 10MHz. Its probably an easy thing to overlook and probably a hard thing to figure out when it causes problems.