How to use the latest arduino IDE for old and latest atmegas DIP 40. and make a clone of arduino board. This project is the upgrade of the arduino atmega644/1284 clone project.
Step 1: Intro
I have got some old atmegas but not obsolete yet and I used them with some software like CodeVision AVR.... and recently I found a way to use these microcontrollers under the latest Arduino IDE, more convinient (I think).
So this instructables will deal with : how to use Atmegas 8535/32/644p/1284p under Arduino 1.8.X using the Mightycore project ?
This project can be used for other IC too like:
ATmega644 (p or not)
ATmega1284 (p or not)
The differences about the datasheet beetween each of them explained on: https://github.com/MCUdude/MightyCore
The cheapest are the atmega 8535 / 32 /16.
Step 2: Schematic Before Burning the Bootload:
Here are the connections to be made beetween the host Arduino board and the target atmega8535/32/644p/1284p.
Don't forget: Quartz 16 mHz, capacitors 22 pF
If you use an atmega 8535 (L) or 32 (L) the oscillator must be 8mHz max.
The power on your circuit, lauch Arduino 1.8.x IDE and launch: example/Arduino ISP
Download it in arduino Genuino/uno target. The uno board is now ready to burn the bootloader but you need to install the Mightycore project.
Step 3: Installing the Mightycore Project Before Burning the Bootloader
You will find the project on: https://github.com/MCUdude/MightyCore
1- Launch arduino 1.8.x
2- Go to preferences
3- Insert the URL: https://mcudude.github.io/MightyCore/package_MCUdude_MightyCore_index.json
4- Go to Tools/boards/additional boards
5- Click on Mightycore by MCdude to install the project and that's it.
Step 4: Burn the Bootloader
It's easy: follow the method...
1- Select the good target micro to be burned. In this case, an atmega8535 in Tools->Board
2- BOD: 2.7V (max low level voltage)
3- Standard pinout for Mightycore
4- External oscillator 16mHz
5- Compiler LTO disabled
6- Arduino as ISP (Mightycore)
7- Burn yes you gonna burn (RATM)
After a while the console will (hopefully) display a "Done burning bootloader" message.
Step 5: Schematics: Atmegas Pin Map and the Clone Board (IC Host)
Here are the pin map of the arduino uno board and the atmega DIP 40 pin map which is the the same for atmega 8535/32/644p/1284p with some differences on some pins functions.
I give you the adresses of the pins of the clone I made (based on one of my projects: the Sanguino arduino clone). Here, the Mightycore gives a correction on the analog input pin map (a mess with sanguino).
Step 6: Use the Clone Board With the USBasp Converter (USB to SPI)
1- Select the USBasp Mightycore
2- Select the target: here the atmega 8535
3- Upload with the programer
And that's it.
An avrdude error on update is displayed but the program is uploaded. Don't care about it.
Step 7: Warning!!! Driver Error May Occur With USBasp/arduino 1.6.10 and Above
The message displayed:
"C:\Program Files (x86)\arduino-1.6.10\hardware\tools\avr/bin/avrdude -CC:\Program Files (x86)\arduino-1.6.10\hardware\tools\avr/etc/avrdude.conf -v -patmega328p -cusbasp -Pusb -e -Ulock:w:0x3F:m -Uefuse:w:0x05:m -Uhfuse:w:0xDE:m -Ulfuse:w:0xFF:m
avrdude: Version 6.3, compiled on Jun 22 2016 at 16:05:21
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch
System wide configuration file is "C:\Program Files (x86)\arduino-1.6.10\hardware\tools\avr/etc/avrdude.conf"
Using Port : usb
Using Programmer : usbasp
avrdude: Warning: cannot query manufacturer for device: No such file or directory
avrdude: Warning: cannot query product for device: No such file or directory
avrdude: error: could not find USB device with vid=0x16c0 pid=0x5dc vendor='www.fischl.de' product='USBasp'
avrdude done. Thank you.
Error while burning bootloader."
The probem can be solve owing to these links:
I was using libusb-win32 v126.96.36.199. Using libusb-win32 turns out to be the problem. Once I updated the driver to libusbK v188.8.131.52 the problem was solved, thanks DrAzzy! Here's how I did it:
1-Plug in USBasp
2-Download Zadig from http://zadig.akeo.ie
I give you the soft.
4-Options > List all devices
5-Select USBasp from the drop down menu
6-Select libusbK(v184.108.40.206) driver
Now the USBasp can be used under the latest IDE.
Step 8: New URL for Sanguino: Melzi for 644(p) and 1284(p)
This URL allow you to install the new Sanguino script which allows you to bootload and to program atmegas 644/644p/1284/1284p. These IC have more function and memories than atmega 8535/16/32/324 and are a little bit more expensive. With this script the messy pin map of the analog inputs is corrected.
You take this URL at:
1- the URL copy it in preferences:
2- Install Sanuino by Christian Sloth Lauszus
3- Select the board Sanguino
4- Select the good atmega IC
5- Select the good programer: USBasp
And it works. You either bootload with Melzi and use then Mightycore to program.
Step 9: Conclusions
You can use now Arduino to easily program a lot of atmega IC and use all the libraries developped for arduino board.
You need anyway to buy an arduino board (10 euros) to bootload and an USBasp converter (5 euros) to program.
Thanks to all the interrested website and forums all over the web.
Step 10: Supplemental: Ethernet Shield/ModbusTCP/AdvancedHMI/State Machine Library
I try to use the Ethernet Shield on the Mightycore clone with my favourite libraries (SMlib and Mudbus). All the DIP40 works without any modifications of some files like W5100.h as usual in my former clone. One circuit doesn't work: the atmega8535 because of his old age and his memory I think.
I give you fantastic pics of the HMI and the program. This is a bidirectional communication via ModbusTCP and:
-a pushbutton lights ON/OFF a led on the shield
-a digital panel displays the integer value "1500" send by the clone
-a digital panel displays the value of the analog input A0
-a pilot light lights ON/OFF when the digital input D14 is ON/OFF.