Please help. 3.3V usage.

Hi all,

I know this subject's been done to death but I'm having a hard time finding everything I need to know. I have a project for which I want to use a 28pin Atmega328P through hole type controller (the type on Unos). So I bought some, they come pre burned with the Uno bootloader on them.

I am using 2 I²C devices and a SPI display, all of which are 3.3V logic and power. It seems more logical to run the controller at 3.3V as well to avoid having to use level shifters/resisters as keeping the component count as low as possible would be helpful. From the information I've managed to gather so far it is wise to disable the "Brown Out" by setting fuses (I believe it is e-fuse to 0xFF) and to use a 8MHz external oscillator. I did toy with the notion of using the internal one, but didn't like the idea of having to tune it. To burn a new bootloader I understand I can use an AVR programmer, but if the chip already has a 16MHz bootloader on it, would I need to set the fuses with the chip powered up at 5v and a 16MHz oscillator on? How would running at 8MHz effect things like serial speeds, I²C and SPI? Some places say I just have to select the correct board in the IDE, other places say I have to edit the boards text file and yet others say I have to move header files around and replace them. Also, how would this effect serial programming? Would a regular USB serial to TTL work (one used for normal 5V @ 16MHz) or would I have to buy a special 3.3V version?

I've watched videos on YouTube and read a lot of posts but I'm getting conflicting information so I'm a bit confused and frustrated. I'd appreciate it if an expert could clear up the areas I'm usure about.

Cheers,
Vesty

I hope to answer a few of the questions.

You bought ATmega chips with bootloader ? I would recommend to write the bootloader yourself, since you don't know if the pre-burned bootloader is any good.

The bootloader set the baudrate for the serial communication, so it needs to know what speed the chip is running. You can make your own bootloader for a chip for a certain speed with OptiBoot. Or choose a compatible Arduino board.

When you want to run the ATmega chip without crystal, using it's internal oscillator, you will run into trouble. That oscillator is less accurate, so you can not use a high frequency for the serial communication (either for the bootloader or in the sketch).

Many 3.3V I2C modules with run fine with a 5V Arduino. As long as you use pullup resistors to 3.3V.

Running an Arduino at 8MHz is no problem. As far as I know, every default library can handle it. The serial baudrate will be less accurate, but the baudrate of 38400 is the best choice.

Did you consider an 3.3V Arduino Nano ? It is small, and it is an official Arduino board.

Thanks Peter.

I won't be using the supplied bootloader, i'll be burning a new one as I said. I'm also not using the internal oscillator but an external 8MHz one as I mentioned. The main worry I have is the serial programming, I'm not using an Arduino, just a micro controller but I am using the Arduino IDE and libraries to program it.

I simply can't understand most of the things I find. I can program and use an Arduino fine, it all makes sense. Write a sketch, plug it in, press the arrow, all done. Using a bare controller is just as simple IF you use it at 5V and 16MHz, but anything else? Nightmare. Fuses, bootloaders, avr programmers, serial not working @ 3.3V. etc.. I just wish there was a FAQ or walkthrough somewhere for what all that needs to be done for a particular configuration.

I understand the concept of the bootloader, it's there to allow serial programming. It runs before the sketch to see if there's any serial data coming through to be programmed into the memory. The fuses kind of make sense, they set certain behaviors of the chip. But nowhere can I find information on how to program a chip running at 3.3V using a bootloader over serial. There was something on one site that sold these chips and they stated they had a special modified version of the boot loader that allowed serial programming at 3.3V/8MHz, but no further info on it was given.

Switching to PICs might be easier, there's a lot more info on them around, easier to find and understand.

I think you are looking in the wrong places :roll_eyes:

An ATmega328P is supported by the default Arduino.
When you have a programmer, you can write the bootloader from within the Arduino IDE (it's in the menu). Writing the bootloader automatically writes all the fuses and so.
You have to find an Arduino board with the ATmega328P running at 8MHz. Either 3.3V or 5V, that's all the same to the Arduino IDE.
Perhaps your standalone is just like the LilyPad-Atmega328 or Fio or the Pro or Pro Mini. Those are the official boards running at 8MHz.

You can write the bootloader and upload sketches with 5V or 3.3V. And run it at 5V or 3.3V. It's all the same at 8MHz.

Do you have a programmer ? Or do you use an Arduino board as ISP ?
Do you have a usb-to-ttl-serial adapter ? To upload a sketch.

AvidVestRepair:
Switching to PICs might be easier, there's a lot more info on them around, easier to find and understand.

I don't think so! Everything that causes you difficulty with Arduino will cause at least as much trouble with a PIC. 5V, 3V, baudrates, crystals.

OK, let's get it straight.

USB is by definition, 5V, so there are no Arduinos with built-in USB that operate at 3.3V. UNO, Nano, Micro. Simple as that. OK? The UNO has a 3.3V sub-regulator which can be used to power modest 3.3V peripherals, and you can use level-converter boards to interface to 3.3V peripherals.

Boards which do not have built-in USB - the "Pro Mini" - can be made (or made by yourself) in versions that run at 3.3V, though they cannot be relied on to run at 16 MHz and 8 MHz is more practical. Since the configuration of the particular bootloader determines the division ratio to implement the baudrate, the bootloader must be selected to match the crystal in use.

The USB to TTL interface chips used either on the Arduino boards, or on a module in order to program and communicate with a Pro Mini, generally provide a 3.3V regulated output (from the 5V USB supply) which probably should not be used to power a MCU as such but can be selected to be their interface reference so that they specifically generate 3.3V levels. In general, 3.3V levels can be used to communicate with a 5V MCU since the CMOS does a quite good job of providing "rail to rail" output levels and in the other direction, uses a switching threshold at 5V, of 2.5V or less.

I hope this summarises it adequately.

Thanks for the replies.

So basically, if I want to burn a 8MHz boot loader onto the chip. I should select
"Arduino Pro or Pro Mini (3.3V 8Mhz) w/ ATmega 328"
In Tools > Board.
Then use "Burn Bootloader" and the correct version of the bootloader and the correct fuses will be set by the IDE? I will indeed be using an Arduino as ISP, I trust that is adequate for the task?

Another thing I'd like to clarify is: Should the chip I'm burning to be connected up in the way it is currently fused to operate. In my case, the chips are supplied already burned to operate in an Arduino UNO at 5V with a 16MHz oscillator. Does this mean that to burn the bootloader and fuses I have to hook the chip up with a 5V supply and a 16MHz crystal to begin with?

With the serial programming, a regular USB Serial TTL interface would probably work, but there are specific ones (like for a 3.3V Pro Mini) available?
http://www.ebay.co.uk/itm/FT232RL-FTDI-3-3V-5-5V-USB-to-TTL-Serial-Adapter-Module-for-Arduino-Mini-Port-/201125911131
This has a jumper to set 5v or 3.3V
Using the USB chip on an arduino (like a UNO with the chip taken of for example) is possible If i set the chip to use the 3.3V reference as its logic levels, how is this done?

Paul I appreciate the help but please, ending sentences in "OK?", bolding the word "Don't" and italising "Everything" was really not necessary. I can read a word fine without it being emphasized, and the point of a sentance I am able to grasp without it being questionized at the end with "OK?". In most cultures that would be considered incredibly rude. If a waitress asks me if I need anything and I reply "No I don't need anything thank you." That is polite, if I said "No I don't need anything, OK?" that is rude.

EDIT: Selecting the board in the IDE seems to make no difference at all. Whatever board is set it always does the same thing. Burns the same bootloader and fuses for the UNO/Atmega328P. I replaced avrdude with a small command like utility that records the command line, it's always exactly the same no matter what board is selected.

EDIT2: Something was wrong with my IDE installation. I removed and re-installed it and now it seems to be sending the correct boot loader and fuses for the board I select.

It was getting kind of annoying having to edit avrdude.conf all the time because I have atmega328pu chips. Have to keep changing the signature from 0x1e 0x95 0x0F to 0x1e 0x95 0x14 and back. So I made a new boards.txt file and added something to avrdude.conf so I don't have to keep editing the files all the time. Now I have a PU version of any board that uses a 328p

puboards.rar (21.2 KB)

AvidVestRepair:
So basically, if I want to burn a 8MHz boot loader onto the chip. I should select
"Arduino Pro or Pro Mini (3.3V 8Mhz) w/ ATmega 328"
In Tools > Board.
Then use "Burn Bootloader" and the correct version of the bootloader and the correct fuses will be set by the IDE? I will indeed be using an Arduino as ISP, I trust that is adequate for the task?

Should be adequate, and I gather that you have in fact, made it work.

AvidVestRepair:
Another thing I'd like to clarify is: Should the chip I'm burning to be connected up in the way it is currently fused to operate. In my case, the chips are supplied already burned to operate in an Arduino UNO at 5V with a 16MHz oscillator. Does this mean that to burn the bootloader and fuses I have to hook the chip up with a 5V supply and a 16MHz crystal to begin with?

As I understand it, you only have the fuses set so that some oscillator will work on the next occasion. If the chips come set for a crystal, then you need a crystal and pad capacitors though as per Nick Gammon's tutorial, an external clock will suffice.

AvidVestRepair:
With the serial programming, a regular USB Serial TTL interface would probably work, but there are specific ones (like for a 3.3V Pro Mini) available?
This has a jumper to set 5v or 3.3V

Indeed there are, especially those in the format of a cable with the chip concealed in the USB plug. But that one with the link is obviously very convenient, though you pay at least three times as much for getting the same shipped quickly from within the UK (and it is of course, still made in China :D).

AvidVestRepair:
Using the USB chip on an Arduino (like a UNO with the chip taken of for example) is possible If I set the chip to use the 3.3V reference as its logic levels, how is this done?

As I explained, the UNO and other boards containing a USB interface are designed to operate at 5V (no apologies for the italics, I am just pointing out how serious this fact is).

If you want to go (literally) hacking boards, start with the circuit diagram and trace it out. Lotsa luck.

Your humour impairment is duly noted. XD

@ Paul... +1

Doc

AvidVestRepair:
I won't be using the supplied bootloader, i'll be burning a new one as I said. I'm also not using the internal oscillator but an external 8MHz one as I mentioned. The main worry I have is the serial programming

If you can burn a bootloader then you don't need serial programming, just program the chip directly.

Option b) is to use a 3.3V Pro Mini and an FTDI adapter with 3.3V selector.

Peter_n:
Many 3.3V I2C modules with run fine with a 5V Arduino. As long as you use pullup resistors to 3.3V.

So long as the Arduino doesn't put out any 5V signals...

...which the supplied "wire" library does.

AvidVestRepair:
But nowhere can I find information on how to program a chip running at 3.3V using a bootloader over serial. There was something on one site that sold these chips and they stated they had a special modified version of the boot loader that allowed serial programming at 3.3V/8MHz, but no further info on it was given.

Switching to PICs might be easier, there's a lot more info on them around, easier to find and understand.

Nope.

The reason you can't find any information is because there's nothing to find. There's nothing special about 3.3V/8MHz. The only reason you might want to modify a bootloader is to fix the serial baud rate (which would be half speed with 8MHz clock). Another workaround would be to tell the IDE to use a different baud rate when uploading.

There are some 3.3V/8MHz Mega328 Arduinos officially supported in the IDE, eg. Lilypad, Pro Minis. Selecting one of those might work (depending on what bootloader came preloaded on the chip). If they don't, edit your boards.txt file and make a new entry so you can mess around with baud rates. OTOH, using internal clock isn't serial port friendly.

Your best bet is to abandon the idea of serial programming. It's not worth it. The IDE is perfectly capable of doing ISP programming instead. If you configure it right you won't be able to tell the difference..

Serial programming is a must. The end-user has to be able to update the firmware without having to mess around too much. It's not just the creator of a project that ends up using it.

Yes Paul, I have Aspergers and do not recognise humour too well I must admit you disguised the humour very well. I showed the post to a couple of friends and their opinion was:
"Helpful guy, but a bit of a knob".
So again thanks for the help, and I hope with all my prayers that you keep such attitudes confined to the internet, I'd hate to think what would happen if you spoke to people like that face to face. It's just not worth it.

Docedison, I think you've got something on your nose there.

Fungus, thanks for the help. It's appreciated.

I noticed you wrote about ATmega328pu. Please don't use it like that, use a dash.
It is an ATmega328 or an Atmega328P.
The 'P' option is for "PicoPower".
The '-PU' are extra options for DIP or TQFP package and is not the "PicoPower" option.

The ATmega328 is often a ATmega328-PU (not a 'p' version)
The ATmega328p can be a ATmega328P-AU or ATmega328P-20PU (the Arduino compatible 'p' option).

Other chips have more versions. The old ATmega8 has been updated a few times and has version like: ATmega8, ATmega8A, ATmega8V, ATmega88, ATmega88PA, and so on. Sometimes another version has the same signature, and sometimes it has a new signature.

AvidVestRepair:
Serial programming is a must. The end-user has to be able to update the firmware without having to mess around too much. It's not just the creator of a project that ends up using it.

Oh, there's an end user? That changes the question.

In that case you have no choice but to use an external 8MHz crystal. It's the only way to make the serial port work.

Set your chip up like something similar which is in the standard Arduino installation. eg. "Arduino Pro or Pro Mini (3.3V, 8 MHz) w/ ATmega328". Burn the right bootloader onto it then tell people to select that.

PS: How will they program it? Do they have to buy an FTDI adapter?

AvidVestRepair:
It was getting kind of annoying having to edit avrdude.conf all the time because I have atmega328pu chips. Have to keep changing the signature from 0x1e 0x95 0x0F to 0x1e 0x95 0x14 and back. So I made a new boards.txt file and added something to avrdude.conf so I don't have to keep editing the files all the time. Now I have a PU version of any board that uses a 328p

You do know that "PU" is just a case denominator? The 328PU, MU, AU share the same internal piece of silicon.

The difference is when it's an 328xx or a 328Pxx.

// Per.