Go Down

Topic: Is the bootloader the same on 3.3v and 5v arduinos? (Read 529 times) previous topic - next topic

apretext

Erm, as above really.  I want to use a 3.3v Atmega 328P hardwired directly to a raspberry pi, so I want it to run at 3.3v to avoid having to use any logic level conversion. All the kits on ebay come with a 16mhz crystal, which isn't an issue, as I have some 8mhz ones, but are the pre loaded bootloaders on these chips compatible with running it at 3.3v/8mhz?

3Dgeo

How about using 3.3v Arduino pro micro? I have 3.3v Arduino pro micro that works at 16mHz - best of both worlds + USB port for uploading.

In 5V system logic HIGH is read if voltage goes above ~2.5V , so usually 3.3V logic works with 5V chips if 5V chip doesn't inject 5V to 3.3V system.

septillion

Nope, they need to take into account the 8Mhz of the crystal. Easiest way is to install MiniCore
Use fricking code tags!!!!
I want x => I would like x, I need help => I would like help, Need fast => Go and pay someone to do the job...

NEW Library to make fading leds a piece of cake
https://github.com/septillion-git/FadeLed

Wesstun

Technically an ATMega328 running at 16 Mhz and 3.3V is out-of-spec.  The datasheet has a graph of clock frequency vs. input voltage and at 3.3V the max recommended frequency is about 13 Mhz.   It's possible to run it at 16 Mhz but problems can creep in.  For this reason, usually boards that are designed to run at 3.3V also run at 8 Mhz, not 16, and the fuses (bootloader) is configured differently as a result.

septillion

at 3.3V the max recommended frequency is about 13 Mhz.
10.6Mhz ;)

But it seems like the OP wants to nicely change a ATmega/Arduino to an 8Mhz crystal and 8Mhz bootloader.
Use fricking code tags!!!!
I want x => I would like x, I need help => I would like help, Need fast => Go and pay someone to do the job...

NEW Library to make fading leds a piece of cake
https://github.com/septillion-git/FadeLed

Budvar10

#5
Oct 20, 2019, 06:41 pm Last Edit: Oct 20, 2019, 06:44 pm by Budvar10
@Wesstun: Good point.
I think, the only difference is in used clock frequency which is hard coded  and as any other program it should be compiled for correct speed, otherwise it will have impact to its functionality, e.g. if 8MHz clock is used with the bootloader compiled for 16MHz, the speed for uploading will be at half and if you can live with this...
Voltage has no impact.
Arduino clone with ATmega1284P   http://forum.arduino.cc/index.php?topic=277260.0

ShermanP

Yes, just to emphasize - it's the crystal/resonator frequency difference that requires a different bootloader, not the voltage difference per se.  So if you have the right bootloader for a 3.3V 8MHz Pro Mini, you can run it all day long at 5V with no problem.  However, running a 5V 16MHz Pro Mini at 3.3V does not work, but only because, as Wesstun says, the 328P won't run reliably at 16 MHz on a 3.3V supply.

There may be other things that have to be adjusted, but I think the main difference is that if the bootloader is doing UART transfers at, say, 9600 baud, you need a different prescaler value for an 8MHz crystal versus a 16 MHz crystal.

Wesstun

10.6Mhz ;)

But it seems like the OP wants to nicely change a ATmega/Arduino to an 8Mhz crystal and 8Mhz bootloader.
Hey now, I'm no Atmel hardware engineer or anything, but figure 28-1 from the datasheet says the safe operating frequency is linear between 2.7V @ 10Mhz and 4.5 V@ 20 Mhz.  If I fit those two points to a line and plug in 3.3V, I get 13.33 MHz.

https://learn.sparkfun.com/tutorials/using-the-arduino-pro-mini-33v/what-it-is-and-isnt

Where ya' getting your 10.6 Mhz value from if you don't mind me asking?

I agree with everything else everyone said, including what I said the first time. ;)

septillion

#8
Oct 21, 2019, 11:19 pm Last Edit: Oct 21, 2019, 11:19 pm by septillion
is linear between 2.7V @ 10Mhz and 4.5 V@ 20 Mhz.
16MHz...

At least if I use this datasheet.


But now I searched again I also found this one @ SparkFun (although in 26.3). So indeed confusing. :o And after more research I found on the Atmel website they links both this (the first 28.1) as well as this (29.1).

So WOW, confusing!
Use fricking code tags!!!!
I want x => I would like x, I need help => I would like help, Need fast => Go and pay someone to do the job...

NEW Library to make fading leds a piece of cake
https://github.com/septillion-git/FadeLed

apretext

10.6Mhz ;)

But it seems like the OP wants to nicely change a ATmega/Arduino to an 8Mhz crystal and 8Mhz bootloader.
Sort of, yes. I've got many arduino's (including a pro mini 3.3v, etc...) but I want to make a pi Hat, and to maximise space I was just going to use a 328P in a 28 pin PDIP (because I'm rubbish at soldering.....). Obviously, most of the ebay kits are aimed at those who want 5v arduino's, not 3.3v. But, as the task is pretty simple (I just need a real time microcontroller for stepper motors), 8Mhz shouldn't be an issue.

I also tried using a maple micro on a different board, but they are just not user friendly!

Thanks for the link, I'll try and burn a 3.3v bootloader on to one of my chips and see if it works.

Wesstun

#10
Oct 22, 2019, 12:07 am Last Edit: Oct 22, 2019, 12:09 am by Wesstun
16MHz...

At least if I use this datasheet.

Sure enough . . . it was 16 Mhz and recommended 10.6 Mhz @ 3.3V on that datasheet from 2015.  Thanks for the link.

The 2018 datasheet (29.1) does have the newer graph, and it DOES go up to 20 Mhz, not just 16.  It's figure 29-1 instead of 28-1 now.  I wonder when it changed.  I designed a board a couple years ago where I really had to figure this out in detail because my Vcc was variable (battery) and the graph was the same as the modern one at that time.  If anything I would have imagined it got a little worse when they pulled the full-swing feature on the modern chips, not gotten better.

septillion

Yeah, I seems to remember the graph from the 2018 datasheet as well from back when Atmel != Microchip. But I could not remember the numbers so that's why I just looked it up. And Google giving me the 2015 datasheet as a higher result. And I have to say, I think that once does look more modern ::)
Use fricking code tags!!!!
I want x => I would like x, I need help => I would like help, Need fast => Go and pay someone to do the job...

NEW Library to make fading leds a piece of cake
https://github.com/septillion-git/FadeLed

Wesstun

Thanks for the link, I'll try and burn a 3.3v bootloader on to one of my chips and see if it works.
Or, as ShermanP clarified - an 8 Mhz bootloader.

If you choose 8 Mhz you can run at 3.3V or 5V with no issue and the chip won't care at all.

If you choose 16 Mhz you need 5V unless you wanna take your chances with reliability.

You might also want to change the brown out detection setting if you do end up running at 3.3V.  The default BOD setting for UNO boards is 2.7V, which is a little close to the rail voltage if you end up at 3.3V.  You could have accidental resets if you have dips in your supply V.  Might consider BOD of 1.8V.

Go Up