login

Author Topic: atmega128 customization for 3.3v operation.  (Read 2974 times)

0 Members and 1 Guest are viewing this topic.

pratikshinde

atmega128 customization for 3.3v operation.
« on: March 15, 2013, 03:28:02 AM »
Hello,

I have a ATMega128A board ( details http://www.nex-robotics.com/products/microcontroller-developement-boards/avr-development-boards/atmega128-development-board-mini.html ),

I have burned bootloader on it, and successfully used for my projects, now I want to use a 3.7v li-ion battery to run this board, I have tested that also my board works fine on battery too, However in datasheet and some online sources I read that running 16MHz @ 3.3v is beyond specification and can produce undesired results.

So I found that I have to compile wiring bootloader for 8MHz, I read from few posts and which files should be modified and compiled again,
I have read in this post http://forum.wiring.co/index.php/topic,63.msg241.html#msg241

But I do not know how to compile the boot loader  :(
Please give me some suggestions, or any forum post from which I can follow steps.

Do I need to change fuses on ATMega128?
Do I need to do any changes in my sketches ?

Any help in this regard is highly appreciated.
Thanks

bhagman

Re: atmega128 customization for 3.3v operation.
« Reply #1 on: March 19, 2013, 08:55:24 AM »
This will require some effort.  If possible, you should contact the company that made the board to help you with building the new bootloader to work with the Wiring Framework.

To reprogram that board, you'll need to use the internal RC oscillator (running @ 8MHz) as I think that it has a 14.7456MHz external crystal.

Here are the makefile settings for the .mk file in the booladers/build folder for Wiring.  E.g. ATMega128A.mk

Code: [Select]
## ATmega128A-8MHz
atmel-128a-8MHz: HARDWARE = ATmega128A_8MHz
atmel-128a-8MHz: MCU = atmega128a
atmel-128a-8MHz: BOOTLOADER_ADDRESS = 1F800
atmel-128a-8MHz: F_CPU = 8000000
atmel-128a-8MHz: HW_DEFS_H = defs-wiring-v1-mega.h
atmel-128a-8MHz: EXTRACFLAGS = -DBOOT_USART=0 -DBOOT_BAUD_RATE=-57600
atmel-128a-8MHz: all
   mv $(PROJECT).hex $(PROJECT)_$(HARDWARE).hex

Here are the fuses you will need to program onto the ATmega128A:

Code: [Select]
Low: 0xA4
High: 0xD4
Extended: 0xFF


The fuses will set the '128 to use the internal RC oscillator @ 8MHz.


If you create the ATmega128A.mk file with the above information, and put it into the Wiring bootloaders/build folder, you can run make atmel-128a-8MHz in that folder to create the new bootloader.

You will have to have a version of avr-gcc installed somewhere (I think the board that made the company walked you through how to do that).


Let us know how it goes!

pratikshinde

Re: atmega128 customization for 3.3v operation.
« Reply #2 on: March 19, 2013, 02:48:28 PM »
Hello bhagman,

Quote
To reprogram that board, you'll need to use the internal RC oscillator (running @ 8MHz) as I think that it has a 14.7456MHz external crystal.

I have replaced that 14.74 MHz crystal with 16MHz, and burned Wiring bootloader from Wiring IDE using Arduino Uno with WiringISP sketch.  :)

Quote
The fuses will set the '128 to use the internal RC oscillator @ 8MHz.

I am going to use external 8MHz crystal. so I think fuses will remain same(as Wiring v1).

Quote
If you create the ATmega128A.mk file with the above information, and put it into the Wiring bootloaders/build folder, you can run make atmel-128a-8MHz in that folder to create the new bootloader.
You will have to have a version of avr-gcc installed somewhere

I will try this and let you know  :)


thanks

pratikshinde

Re: atmega128 customization for 3.3v operation.
« Reply #3 on: March 28, 2013, 06:12:21 AM »
Hello,

I have compiled the bootloader  :), (replaced existing 16MHz crystal by 8MHz) and burned it on my board using Arduino Uno by using Wiring as ISP sketch,
I have tested Blink sketch, it is working fine, however if I try to upload any other sketch, I am getting either timeout error or
Code: [Select]
avrdude: verification error, first mismatch at byte 0x0002
         0xb4 != 0x04
avrdude: verification error; content mismatch

please let me know what am I missing?
In this post you have mentioned http://forum.wiring.co/index.php/topic,63.msg241.html#msg241
that to modify defs-wiring-v1-mega.h, could you please elaborate?

Thanks.