Adding support for ATmega32c1 (Verification Error)

Hi there,

I am currently trying to add support for the ATmega32c1 to the Arduino IDE, but I’ve stumbled upon an issue that I’m having trouble resolving. I keep getting a verification error when attempting to program.

avrdude: verification error, first mismatch at byte 0x0006
0x5b != 0x4d
avrdude: verification error; content mismatch

I know there are various post related to this error, but none that I have seen seem to be relevant to solving my issue. I am currently using a altered version of the optiboot code for my bootloader. As I far as I know it seems to be working for upon power up the bootloader indicating LED flashes. It also appears that serial communication is working for I have probed the tx/rx lines.

Some other info on my setup is its currently powered by a power supply. I have 100nF cap from the DTR signal from a usb to serial board to the reset of the 32c1. There is also a 10k pullup on that reset line. This portion seems to be working for when attempting to program I do still receive flashes from the bootloader LED, indicating a proper reset. I am also using an 16Mhz external resonator.

Does anyone have an idea on how to resolve this verification error that I keep repeatedly getting?? I’ve gone through various files, including my altered avrdude.conf, but with no success. Any help would be greatly appreciated! I can also provide more information if needed, thanks!

Which IDE version are you using?

What board.txt parameters are you using?

The ATmega32C1 and 64C1 are very interesting chips. They have a 10-bit DAC. I would be very interested in using this myself. In addition the 64C1 has 4K RAM which could be very useful for some applications.

I am currently using a altered version of the optiboot code for my bootloader.

Which version of optiboot, and altered how?
Note that the current optiboot "master" version on code.google.com theoretically supports ATmega32 without modifications (but you will have to build your own .hex file.)

Which IDE version are you using?

I am currently using 1.5.2. Do you suggest using a different version?

What board.txt parameters are you using?

Here are the parameters that I have added to board.txt:

das.name=Arduino DAS
das.upload.tool=avrdude
das.upload.protocol=arduino
das.upload.maximum_size=32256
das.upload.speed=57600

das.bootloader.tool=avrdude
das.bootloader.low_fuses=0xff
das.bootloader.high_fuses=0xdf
das.bootloader.extended_fuses=0xfd
das.bootloader.path=optiboot
das.bootloader.file=optiboot_atmega328.hex
das.bootloader.unlock_bits=0xFF
das.bootloader.lock_bits=0xFF

das.build.mcu=atmega32c1
das.build.f_cpu=16000000L
das.build.core=arduino
das.build.variant=standard
das.build.verbose=true

I also added the atmega32c1 to avrdude.conf, and can share that if wanted.

Which version of optiboot, and altered how?

Well I've been referencing a related project called Arduino Allegro (https://spaces.atmel.com/gf/project/arduinoallegro/) which provided some files on github (GitHub - codinghead/Arduino at allegro). Contained in those files was the altered optiboot with the added atmega32c1 optional define. I ended up downloading this and created a project in AtmelStudio and just made a few minor changes myself(setting F_CPU and baud rate) . To answer your question, though, the significant changes include just defining the atmega32c1's pins. Adding in the defines for the RAMSTART(0x100) and NRWWSTART(0x3800), which should probably be checked. UART register settings for the ATmega32c1 were also added, but I ended up just using the SOFTUART option. I haven't looked to much into for I haven't had much experience with writing bootloaders, but would be interested to hear on what your concerns could be?

Note that the current optiboot "master" version on code.google.com theoretically supports ATmega32 without modifications (but you will have to build your own .hex file.)

I'll take a look at it, but my concerns are that the ATmega32 and Atmega32c1 have some minor differences that will lead me back to where I am.

Thanks for the replys!