I have an USBASP programmer and a couple of ATmega32A(unfortunately this is the most sold controller at my place) lying around. I wish to know if i can burn an Arduino Bootloader onto it to take advantage of using Arduino framework for writing my applications. Because more than AVR, Arduino suits me better for the greater society, ease in learning curve on the programming front (sorry i find Arduino a bit easier than AVR). Also I found a site where they have given the pin mapping of the ATMega32 www.retrointerfacing.com.
Can someone help me through this? I do not mind burning my application hex files manually or to discard the Arduino IDE. All i need is a way to figure out running my Arduino framework based programs on my ATmega32 for which I believe the Arduino bootloader has to be burned into before.
Go to www.avr-developers.com and download the files for ATMega32.
May need to create a new board type in boards.txt and make an entry in avrdude.conf after that.
IDE 1.0.1 has an updated structure that supports "variants" of microcontrollers. I'm not knowledgeable enough really descibe it better for you.
CrossRoads:
Go to www.avr-developers.com and download the files for ATMega32.
May need to create a new board type in boards.txt and make an entry in avrdude.conf after that.
IDE 1.0.1 has an updated structure that supports "variants" of microcontrollers. I'm not knowledgeable enough really descibe it better for you.
Firstly, thanks for your time and reply. Got it boss. One more thing to boot up the process, will this version work under 1.0.1 or do I have to use any specific version(ex., in the site you have mentioned 0.20)
Thanks for the link. But the website seems to be old enough. Cant find the proper files. The described link is also dead. Any help on that, please? http://www.avr-developers.com/bootloaderdocs/index.html http://www.icy.com.au/
Cant find ATmega32A core files in Arduino-extras.zip file.
Any solutions?
Thanks.
Found another page with ATmega32 configuration files. www.retrointerfacing.com
Downloaded the .zip files.
In the boards.txt file included in the zip, it shows the configuration for mega32 chip. But the 32 & 32A are different chips. I used that page to find out the fusebit config. http://www.engbedded.com/fusecalc
Well, they have also listed 2 different pages for 2 different chips.
I tried to upload the ATmega32 bootloader on my ATmega32A chip using arduino & usbasp programmer.
The error I'm getting is
"efuse" memory type not defined for part "ATMEGA32"
Procedure followed:
Downloaded the attached zip file. (included in the post)
copied the ATmegaBOOT_32.hex & .c file to "C:\Users\Roy\Desktop\arduino-1.0.5\hardware\arduino\bootloaders\atmega32"
Added the modified code to boards.txt
Opened arduino 1.0.5
Tools> Boards> ATmega32board
Tools> Programmer> USBasp
The modified & added part of boards.txt
##############################################################
atmega32.name=ATmega32board
atmega32.upload.protocol=arduino // Changed it from "STK500" to "arduino"
atmega32.upload.maximum_size=28336
atmega32.upload.speed=115200 // changed it from "19200" to "115200"
atmega32.bootloader.low_fuses=0xff
atmega32.bootloader.high_fuses=0xdd
atmega32.bootloader.extended_fuses=0x00
atmega32.bootloader.path=atmega32 // default was "atmega8", I created an atmega32 folder under the
atmega32.bootloader.file=ATmegaBOOT.hex //bootloader folder & changed the path.
atmega32.bootloader.unlock_bits=0x3F
atmega32.bootloader.lock_bits=0x0F
atmega32.build.mcu=atmega32
atmega32.build.f_cpu=16000000L
atmega32.build.core=arduino
uno328.build.variant=standard
##############################################################
Deleted the efuse configuration & the bootloader successfully uploaded to ATmega32A.
Having issue with uploading the blink sketch into that chip. The error report says...
In file included from Blink.ino:10:
C:\Users\Roy\Desktop\arduino-1.0.5\hardware\arduino\cores\arduino/Arduino.h:213:26: error: pins_arduino.h: No such file or directory
I put the arduino-mega32-mod.zip file (included in the post) contents to the arduino core directory "C:\Users\Roy\Desktop\arduino-1.0.5\hardware\arduino\cores\arduino". The zip has the "pins_arduino.h" file that was to be there in the "core" folder. I overlooked the step then finally fixed it. now the issue lies on an other point.
I am trying to upload the blink sketch & now the error shown is...
In file included from C:\Users\Roy\Desktop\arduino-1.0.5\hardware\arduino\cores\arduino/Arduino.h:213,
from Blink.ino:10:
C:\Users\Roy\Desktop\arduino-1.0.5\hardware\arduino\cores\arduino/pins_arduino.h:45: error: conflicting declaration 'const uint8_t port_to_mode_PGM []'
C:\Users\Roy\Desktop\arduino-1.0.5\hardware\arduino\cores\arduino/Arduino.h:127: error: 'port_to_mode_PGM' has a previous declaration as 'const uint16_t port_to_mode_PGM []'
C:\Users\Roy\Desktop\arduino-1.0.5\hardware\arduino\cores\arduino/pins_arduino.h:46: error: conflicting declaration 'const uint8_t port_to_input_PGM []'
C:\Users\Roy\Desktop\arduino-1.0.5\hardware\arduino\cores\arduino/Arduino.h:128: error: 'port_to_input_PGM' has a previous declaration as 'const uint16_t port_to_input_PGM []'
C:\Users\Roy\Desktop\arduino-1.0.5\hardware\arduino\cores\arduino/pins_arduino.h:47: error: conflicting declaration 'const uint8_t port_to_output_PGM []'
C:\Users\Roy\Desktop\arduino-1.0.5\hardware\arduino\cores\arduino/Arduino.h:129: error: 'port_to_output_PGM' has a previous declaration as 'const uint16_t port_to_output_PGM []'
Thanks for your reply CrossRoads. Well, I think that there is somekind of conflict in between Arduino.h & pins_Arduino.h file. I opened the pins_Arduino.h file in notepad++ tried to find out whats wrong but the contents are like huge mountains of puzzles. Still searching for the right direction.
Should I try with the 0020 version? Need to find it over internet. Official download page (http://arduino.cc/en/Main/Software) does not have the older versions before 1.0.
CrossRoads:
Give it a try with 1.0.1, can always go back to -0020 if it doesn't work.
avrdude.conf already has the info for atmega32.
You'll have to make a new boards.txt entry for the device.
After a long search finally get the mod file from 4shared. arduino-mega32-644 - Download - 4shared - chantichai namthongdee
put the content in the arduino core folder & overwrote the existing files. Then tried the described step of relacing the #if defined(__ATmega8__) in all .c files. Unfortunately the ctrl+F cant find anything as such. & finally the arduino IDE is showing the same error report while I'm trying to upload any sketch to ATmega328p chips with either the default settings "ARVISP mkII" or "USBasp".
I also tried that page USBASP ICSP Programmer Quickstart Guide | Freetronics for Zadig solution. No way out.
At this point I'm really perplexed. Please help.
Should I try modifying the preference.txt? I'm using Arduino IDE 1.0.5
In file included from C:\Users\Roy\Desktop\arduino-1.0.5\hardware\arduino\cores\arduino\/Arduino.h:220,
from C:\Users\Roy\Desktop\arduino-1.0.5\hardware\arduino\cores\arduino\/wiring_private.h:33,
from C:\Users\Roy\Desktop\arduino-1.0.5\hardware\arduino\cores\arduino\wiring_digital.c:28:
C:\Users\Roy\Desktop\arduino-1.0.5\hardware\arduino\cores\arduino\/pins_arduino.h:103: error: 'DDRA' undeclared here (not in a function)
C:\Users\Roy\Desktop\arduino-1.0.5\hardware\arduino\cores\arduino\/pins_arduino.h:111: error: 'PORTA' undeclared here (not in a function)
C:\Users\Roy\Desktop\arduino-1.0.5\hardware\arduino\cores\arduino\/pins_arduino.h:111: error: initializer element is not constant
C:\Users\Roy\Desktop\arduino-1.0.5\hardware\arduino\cores\arduino\/pins_arduino.h:111: error: (near initialization for 'port_to_output_PGM[1]')
C:\Users\Roy\Desktop\arduino-1.0.5\hardware\arduino\cores\arduino\/pins_arduino.h:119: error: 'PINA' undeclared here (not in a function)
C:\Users\Roy\Desktop\arduino-1.0.5\hardware\arduino\cores\arduino\/pins_arduino.h:119: error: initializer element is not constant
C:\Users\Roy\Desktop\arduino-1.0.5\hardware\arduino\cores\arduino\/pins_arduino.h:119: error: (near initialization for 'port_to_input_PGM[1]')
I've read your post in this thread Programming ATmega32 using Arduino - Microcontrollers - Arduino Forum (3rd from bottom). I made those changes but due to that pin mapping file, the blink sketch wont even compile. Any updated repository of those configuration files? Any clue or any hints please?
Woke up & get started again to get things fixed. Found a number of threads on this topic.
Found temporary solution. https://github.com/eaconner/ATmega32-Arduino
Now my 32A is accepting the blink sketch. It is working BUT the pinmapping is...
Can't get the bobuino pin_arduino.h work with my mega32A.
Procedure Followed for mega32 pin_arduino.h:
Put the pins_arduino.h file from the downloaded directory to arduino "core" folder.
Select board > ATmega32
Programmer > USBasp
File > Upload using programmer
Yes, It works Without needing any additional core files. BUT to make life easier I found the bobuino pin mapping is the best way to use a 40 pin AVR because it already optimised the port pin numbering to a standard uno interface, like the spi, serial ports, ADC ports etc.
I am unable to port the pin configuration in pins_arduino.h, from mega32 to bobuino pin mapping. May I get any help at that stage. The mega32 & bobuino pin mapping .h files are included here.
Your guidance is highly anticipated.
Have you put the pins_arduino.h in the right place?
You see how both the /arduino and /mighty1284 have a bootloaders.txt, and each has a /variants and a /bootloader folder? In each /variants folder there is a board type folder with a name that matches a name from a boards.txt section, and the /bootloader folder has a folder for each board type as well with the bootloader for that card.
Set yours up the same way, under the arduino path if that is what you are using, or under the mighty1284 path.
Thanks CrossRoads, I did mistake & put the "variant" folder contents into the "core" folder. I'm going to delete the existing extracted 1.0.5 IDE & unzip it again & start from the beginning.
Yes, can be a little tricky. I had it worked out under -0023, maniacbug got it worked out for IDE 1.0 & later.
This is what I have for Bobuino now, fixes PCINT mapping, might need similar for Atmega32 if PCINT & Analog are same pins as 1284.
These other 2 made changes to fix INPUT_PULLUP, definition was missing.
If you are Arduino/core, check them.
If you are in mighty1284 core, replace them.
First Method
I have put the mighty folder under "C:\Users\Roy\Desktop\arduino-1.0.5\hardware\mighty-1284p" location.
Added 2 entries to boards.txt ( to the boards.txt preloaded with arduino, I did nothing with the mighty's board.txt) [ ATMEGA32A-PU in place of ATMEGA328 - Microcontrollers - Arduino Forum (First post) ]
copied the mentioned optiboot .HEX files to C:\Users\Roy\Desktop\arduino-1.0.5\hardware\arduino\bootloaders\optiboot
selected the "ATmega32/32A (16MHz, external)" board option & burnt the bootloader. It was successful.
Tools> boards> ATmega32/32A (16MHz, external)
Tools> programmers> USBasp
Tools> Burn Bootloader
Then tried to upload the blink sketch
Tools> boards> ATmega32/32A (16MHz, external)
Tools> programmers> USBasp
File> Upload Using Programmer
The error shows
In file included from C:\Users\Roy\Desktop\arduino-1.0.5\hardware\mighty-1284p\cores\standard\/Arduino.h:213,
from C:\Users\Roy\Desktop\arduino-1.0.5\hardware\mighty-1284p\cores\standard\/wiring_private.h:33,
from C:\Users\Roy\Desktop\arduino-1.0.5\hardware\mighty-1284p\cores\standard\wiring_digital.c:28:
C:\Users\Roy\Desktop\arduino-1.0.5\hardware\mighty-1284p\cores\standard\/pins_arduino.h:128: error: 'PCMSK0' undeclared here (not in a function)
C:\Users\Roy\Desktop\arduino-1.0.5\hardware\mighty-1284p\cores\standard\/pins_arduino.h:129: error: 'PCMSK1' undeclared here (not in a function)
C:\Users\Roy\Desktop\arduino-1.0.5\hardware\mighty-1284p\cores\standard\/pins_arduino.h:130: error: 'PCMSK2' undeclared here (not in a function)
C:\Users\Roy\Desktop\arduino-1.0.5\hardware\mighty-1284p\cores\standard\/pins_arduino.h:131: error: 'PCMSK3' undeclared here (not in a function)
All the errors are regarding "PCMSK" & after googling a bit I find it out to be something related to the pinchange interrupt. Then opened the pins_arduino.h file & get this
Second Method
Leaving all the changes done in the first attempt untouched except restoring the Bobuino folder to "C:\Users\Roy\Desktop\arduino-1.0.5\hardware\mighty-1284p\variants". I put & overwrite the attached files (arduino.h, wiring_digital.c & pins_arduino.h) to the following folder "C:\Users\Roy\Desktop\arduino-1.0.5\hardware\mighty-1284p\cores\standard"
then selected
Then tried to upload the blink sketch
Tools> boards> Bobuino
Tools> programmers> USBasp
File> Upload Using Programmer
As I am using the wrong chip (Mega32A), IDE shows error stating "Wrong microcontroller found"
Binary sketch size: 1,246 bytes (of a 130,048 byte maximum)
avrdude: Expected signature for ATMEGA1284P is 1E 97 05
Double check chip, or use -F to override this check.
I stopped here.
I suppose I am doing something wrong with the "PCMSK" while using the bobuino pins_arduino.h with Mega32A.
Should I delete the "PCMSK" part from the bobuino pinmapping .h file?
Ummm.?
"mighty" folder location
Board selected in the first attempt
Board selected in the second attempt.
I can successfully upload sketches to Mega32A using the mega32 core files but I have to compromise with the pinmappings, I guess in that case I have to alter all the pin configurations for every arduino library. On the other hand bobuino features all the pin numbers including the spi, i2c, uart, adc etc. in a standard manner that will make the use of arduino libraries less complicated. That's why I want to alter the pin mappings in my mega32A.