How to bootload/program an atmega328p at 1.8v

I've designed a circuit around the atmega328p and a number of 1.8v devices. They are only tolerant of 2v max on the supply. When in operation it will use a single AA/AAA and boost converter to provide a constant 1.8v.

My question is - how do I bootload/program the atmega328p? All my previous circuits were 5v tolerant, so I could simply use an arduino to load the bootloader and then use a FTDI clone (both at 5v).

I don't want to add line level conversion to the circuit if I can help it! Is there an alternative/standard/simple way to bootload/program?

If your processor is socketed you can pull it from your circuit, plug it into an Arduino and program it there.

Alas it's a size sensitive design, so based on the TQFP-32.

I can't imagine I am the first to encounter this, yet I can't seem to find a solution out there...

philipm:
Alas it's a size sensitive design, so based on the TQFP-32.

I can't imagine I am the first to encounter this, yet I can't seem to find a solution out there...

And your not likely going to find one in my opinion. You have to deal with the electrical logic voltage level difference between whatever USB serial convert device (or cable) you are using and the 1.8vdc logic your chip is using. The 0/5vdc output from the converter to your boards rec pin is pretty simple, just use a 2 resistor voltage divider to cut the voltage down to 1.8vdc. However amplifying your 1.8 Tx signal to the serial converters 5volt logic rec pin is not as simple, you required a voltage increase with no logic inversion to meet the requirement.

Lefty

Could you not build level shifter board and use ISP?

I think you need a level translator chip between your programmer and the ICSP pins of your board - Reset, MISO, MOSI, SCK.
I'd use a TXB0104, with 5V on the B side and 1.8V on the A side, and a 1.8V regulator.

txb0104.pdf (1.15 MB)

Sounds like I might need to design my own programming board. =)

I think I need something along the lines of:

  • an FTDI chip which allows logic level translation between 5V USB and 1.8V (e.g. FT230X)
  • an 1.8V regulator and atmega328p

I believe this covers my two needs:
(1) to bootload - the FTDI talks via UART to the onboard 1.8V atmega328p which performs ICSP bootloading of the external microcontroller
(2) to load a sketch - the FTDI talks via 1.8v UART to the external microcontroller (the onboard atmega328p is not used)

Does that sound about right/anything I have missed?

FTDI doesn't do bootloading, only serial download.

You need TXB0104 between your board's ICSP and a programmer, such as Atmel AVR ISP MKii, download sketch directly into the board, via SPI+Reset pins.

If you want to use serial interface, then TXB0102 for Rx/Tx lines could be used.

The TXB chips look nice, but they're overkill for programmer or serial port, since those functions don't need the signal lines to be "bi-directional."

But you will need some kind of level translation. As you note, the FT230x is capable of running the IO side at 1.8V levels. Perhaps it's "big brother" (FT231x) would be usable as both serial interface AND for programming in "FTDI bit banged" mode?

No, don't need bidirectional lines, but do need data to go both directions.
So make a board with 3 connectors:

AVR Programmer:
Reset
+5
Gnd
SCK
MOSI
MISO
1.8V Board:
1.8V
GND
1.8V Reset
1.8V SCK
1.8V MISO
1.8V MOSI
1.8V Tx
1.8V Rx
FTDI Basic:
Tx
Rx
DTR
Gnd

Adafruit's USBtinyISP programmer has a jumper to supply 5V to the target or not. When the jumper is not in place, no power is supplied, and the logic levels are shifted to match the target's supply. I've used one to program target boards operating at 3V and 3.3V, but not 1.8V, so I'm not 100% sure that it will work. I do think I'd stick to ICSP programming and forget the bootloader.

http://www.ladyada.net/make/usbtinyisp/use.html

Jumper JP3 (USB power to target)

There's a jumper sticking out near the cables, JP3. When the jumper is in place (connecting the two wires) then that means that the USBtinyISP is providing 5V power to the device being programmed. If you don't want to power the device then just take the jumper out or make sure its only on one of the wires.

The USBtinyISP can only provide 5V, up to about 100mA to the device. If you need more power then you should remove the jumper and power the device seperately. (Alternately, if you're feeling adventurous you can reprogram the USBtinyISP to requires 500mA from the USB port instead of 100mA but if you dont know how to do this I'd suggest not)

Version 1.0 of USBtinyISP sends data to the device at 5V level no matter whether its powering the device or not so make sure its 5V compliant! (Note that there are 2 1.5K resistors in series with the data lines for protection)

Version 2.0 which is almost certainly what you've got, uses a level shifter so that if the jumper is not in place, it will use whatever the target voltage is, a lot better for your low-voltage devices!

So, if you have a device that needs to run at 3.3V or so, don't have the jumper in place!

I actually hadn't realised that ICSP programming (without a bootloader) would be so simple. I think I'll just get a AVRISP mkII. =)

Out of curiosity, if I stick to using the Arduino IDE, I'm assuming that the fuses are only set by the IDE when burning a bootloader. Is that right? (I.e. fuses are not set when using a programmer to load a sketch.)

"using the Arduino IDE, I'm assuming that the fuses are only set by the IDE when burning a bootloader" Correct. I have several boards with no FTDI header, only ICSP. I burn a bootloader first to set the fuses for normal 16 MHz operation, and then use File: Upload Using Programmer to put a sketch on with no bootloader. Biggest problem: forgetting the bootoader first and then getting reduced speed operation (1 MHz default).

MKii does not provide power, it senses the supply pin (6) and adjusts levels accordingly. Should work with 1.8V:

"•Programs both flash and EEPROM
•Supports fuses and lock bit programming
•Upgradeable for future device support
•Supports target voltages from 1.8V to 5.5V
•Adjustable ISP programming speed (50Hz to 8MHz SCK frequency)
•USB 2.0 compliant (full speed, 12Mbps)
•Powered from USB, does not require external power supply
•Target interface protection
•Short-circuit protection"

Perfect. I'm sure I'll forget the bootloader (or AVRStudio) to burn the fuses and end up scratching my head too. :wink:

Thanks for all the replies.

It usually happens to me to when I have not programmed in a while- then I waste a couple hours looking things over and writing simpler test code until I finally realize it is running too slow, and slowly dawns on me that fuses are not burned. Usually late at night since I do most of my stuff then.

[quote author=Jack Christensen link=topic=136070.msg1025716#msg1025716 date=1355014727]
Adafruit's USBtinyISP programmer has a jumper to supply 5V to the target or not. When the jumper is not in place, no power is supplied, and the logic levels are shifted to match the target's supply. I've used one to program target boards operating at 3V and 3.3V, but not 1.8V, so I'm not 100% sure that it will work. I do think I'd stick to ICSP programming and forget the bootloader.[/quote]

They do this by running the 74HC125N buffer off the target board's voltage. The 74C125N is spec'd to run down to 2V, so probably won't function well at 1.8V. Even if it could, the ATtiny2313 would not recognize such low signals coming back on the MISO line. I think 3.3V or thereabouts is the lower limit for reliable operation of the Ladyada USBTinyISP.

The TXB010x parts will go down low enough:
1.2 V to 3.6 V on A Port and 1.65 V to 5.5 V on B Port (VCCA ? VCCB)

So will the Atmel AVR ISP MKii:

"•Programs both flash and EEPROM
•Supports fuses and lock bit programming
•Upgradeable for future device support
•Supports target voltages from 1.8V to 5.5V
•Adjustable ISP programming speed (50Hz to 8MHz SCK frequency)
•USB 2.0 compliant (full speed, 12Mbps)
•Powered from USB, does not require external power supply
•Target interface protection
•Short-circuit protection"

txb0104.pdf (1.15 MB)

philipm:
I don't want to add line level conversion to the circuit if I can help it! Is there an alternative/standard/simple way to bootload/program?

generally nothing more than an inline resistor is needed to program a 1.8v avr. this is true of $3 usbasp when installing a bootloader and $2 ebay usb/serial dongles to transfer sketches. in fact the simple resistor solution is working perfectly at much lower voltage with my avr tiny chips powered from single cell.