Hi, I am trying to basically get Arduino working with an atmega16 micro (as shown here: Welcome! | Ralph Kistler). I am fine with uploading the code with an ISP, as apposed to serial, but I want to be able to write, compile and link the code code (create a hex file basically) in the Arduino IDE.
I found this Ok, on to Atmega32 - Development - Arduino Forum forum relating to the issue, but I haven't been able to make it work. It's also a very old forum now. It looked like a few people had it tested and (sort of) working. I want to find out where the latest version is and how to make it work with (ideally) the latest version of the IDE.
Then add these files to mighty-1284p folders.
\hardware\mighty-1284p\variants\Mega16\pins_arduino.h (see attach below)
\hardware\mighty-1284p\bootloaders\optiboot\optiboot_atmega16.hex (see attach below)
Append these entries to \hardware\mighty-1284p\boards.txt
(or if you will not be using the other entries, you can remove them from this file)
Then do I just have to go tools->boards->Mighty ATMega16 (16 MHz) and upload the boot loader, or how does it work?
This is kind of an aside, but to program it with an ISP do I need the external crystal oscillator? I would ideally like to run it off the internal oscillator which has a max clock of 8 MHz I think.
Then select from tools->boards->Mighty ATmega16 (8MHz, Internal)
Then burnbootloader to set the fuse bits correctly.(Even though you will not be using the bootloader to upload, you need to set the fuses using this step.)
Then you should be able to upload your sketch with File->Upload using programmer.
Thanks! That seems to have done the trick. How did calculate the high and low fuses with the internal RC oscillator though? I can't see how you set the values for the clock speed and source from the tables on pages 260 and 29 of the data sheet.
yes, but when I put the hex values into fuse calculator it shows a 2 MHz clock, that's what I'm confused about. It would have to be 0xE4 for the low fuse, right? (i.e. to get the bit values 0b0100 into the lower part of clock register, which the data sheet shows as the 8 MHz setting)
TopDog101:
Hi, I am trying to basically get Arduino working with an atmega16 micro (as shown here: http://www.subtours.com/ralph/theory/atmega16witharduino.html). I am fine with uploading the code with an ISP, as apposed to serial, but I want to be able to write, compile and link the code code (create a hex file basically) in the Arduino IDE.
If you edit your "boards.txt" file you can make the IDE upload via a programmer instead of serial.
Look at the entry for ATiny85 (or whatever) for an example of a chip with no serial port/bootloader and copy it then change the chip type, clock frequency, etc.
Or just hold down the shift key when you upload, it uses the ISP programmer for upload.
I've been going through the changes needed to make the atmega16 work with Arduino, but I don't understand all of it. Could you elaborate on how you created the pins_arduino.h file and the modifications needed with boards.txt? Where there any changes made to the opiboot bootloader?
An ATmega32U2 is very different than the ATmega16. I would recommend looking at Leonardo designs for examples. The Leonardo uses an ATmega32U4 which has a little more features than the 32U2.
rc3105:
would you happen to know what it take for some truly ancient at90s2313 and/or at90s4414 ?
Well, the AT90S2313 has been replaced by the ATtiny2313, so it might be able to use some core code from the tiny2313. You might have to modify the core code to support the AT90S2313. The main difference would be some lack of timer features that the tiny2313 has. The AVR tool chain and avrdude does appear to have support for the AT90S2313, so you would be good there.
For the AT90S4414 seems to be replaced with the ATmega8515. Can't find any documentation about the differences. The AT90S4414 is not similar to anything else, but there is support for it in the AVR tool chain and avrdude. So you may be able to get it working with the same core for the mega16. Just know that it does not have any ADC and limited timer support. Lookup the ATmega8515 for feature support.
Hi. I just uploaded the bootloader to the ATMega16 and I successfully uploaded the blink sketch using an FTDI adapter. But when I wanted to upload a new sketch it did not upload. So i reburned the bootloader and I again was successful in uploading the sketch. But again I could not upload another sketch. Why is it that only one time upload is possible?
The reset circuit is working properly as I see the LED blinks for a small time so I don;t think it is the reset circuit.
The fuse bits are 0xFF for the LOW and 0xD9 for the HIGH
Should I change the Lockbits? According to the post in the beginning the Lock Bit is 0x0F but mine is 0xFF. But I am afraid of changing it because I can make the chip Read only.
0x0F is partially unlocked. 0xFF is fully unlocked - there are 2 extra non-existing lock bits will read back as 1's.
7 - not used
6 - not used
5 - BLB12
4 - BLB11
3 - BLB02
2 - BLB01
1 - LB2
0 - LB1
BLB12, BLB11 = 11 = No restrictions for SPM or LPM accessing the Boot Loader
section.
BLB02, BLB01 = 11 = No restrictions for SPM or LPM accessing the Application
section.
LB2, LB1 = 11 = No memory lock features enabled.