Pages: [1] 2   Go Down
Author Topic: How to bootload/program an atmega328p at 1.8v  (Read 2383 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 10
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 201
Posts: 8662
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Offline Offline
Newbie
*
Karma: 0
Posts: 10
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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...
Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17259
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Windy City
Offline Offline
Jr. Member
**
Karma: 0
Posts: 90
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Could you not build  level shifter board and use ISP?
Logged

Dirt Biker

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 517
Posts: 26307
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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 (1181.38 KB - downloaded 17 times.)
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Offline Offline
Newbie
*
Karma: 0
Posts: 10
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 517
Posts: 26307
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

SF Bay Area (USA)
Offline Offline
Tesla Member
***
Karma: 124
Posts: 6636
Strongly opinionated, but not official!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 517
Posts: 26307
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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


Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Grand Blanc, MI, USA
Offline Offline
Faraday Member
**
Karma: 92
Posts: 3941
CODE is a mass noun and should not be used in the plural or with an indefinite article.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

https://www.adafruit.com/products/46
http://www.ladyada.net/make/usbtinyisp/use.html

Quote
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!
Logged

MCP79411/12 RTC ... "One Million Ohms" ATtiny kit ... available at http://www.tindie.com/stores/JChristensen/

Offline Offline
Newbie
*
Karma: 0
Posts: 10
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


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.)
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 517
Posts: 26307
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

"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"
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Offline Offline
Newbie
*
Karma: 0
Posts: 10
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Thanks for all the replies.
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 517
Posts: 26307
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Pages: [1] 2   Go Up
Jump to: