Today we have been using Arduino IDE on ATmega1284. It is not difficult to get it running but is a little tricky if you don’t know what you are exactly doing. In this post I will show you how to get it working from scratch, using always open hardware & software. This post is written in catalan. Sorry! You can always use google translator 😉
1 – Instalar el plug-in per treballar amb aquest micro en Arduino.
En aquest link hi ha tots els arxius necessaris per l’entorn Arduino:
https://github.com/JChristensen/mighty-1284p/tree/v1.6.3
Com instalar aquests arxius:
- Go to https://github.com/JChristensen/mighty-1284p/tree/v1.6.3, click the Download ZIP button and save the ZIP file to a convenient location on your computer.
- Ensure that the Arduino IDE is not running.
- Go to your Arduino hardware folder.
- Unzip the downloaded file into the hardware folder.
- The download from GitHub will have a dash and branch name appended, so the folder will be named, e.g. mighty-1284p-v1.6.3. Rename the folder to just mighty-1284p.
- The following folders and files should now exist:
- hardware\mighty-1284p\avr\bootloaders
- hardware\mighty-1284p\avr\libraries
- hardware\mighty-1284p\avr\patched-3rd-party-libs
- hardware\mighty-1284p\avr\variants
- hardware\mighty-1284p\avr\boards.txt
- hardware\mighty-1284p\avr\boards.txt.alt
- hardware\mighty-1284p.gitignore
- hardware\mighty-1284p\README.md
- Move any mighty-1284p compatible 3rd party patched libs under [sketchfolder]\libraries as required. (Note: the mighty-1284p compatible “official” patched libs are already set-up to be used as default when using mighty-1284p by being in avr\libraries. If the wrong libs are being used, check to see that there aren’t old versions of the patched libs still under [sketchfolder]\libraries, as those would take precedence.)
- Restart the Arduino IDE.
- Select the desired board from the Tools > Board menu and enjoy those extra pins and all that extra memory!
Note: There is an alternative version of the boards.txt file supplied named boards.txt.alt. It provides more combinations of boards and clock speeds than the standard boards.txt selection menu. It uses a two-step selection of board type and then clock-speed via a submenu. As this differs from the standard boards.txt format, it is provided as an option for those users with more specialized needs, while the default boards.txt retains the more familiar style of interface, to minimise any potential for confusion.
To enable the alternate version, rename boards.txt to boards.txt.org, and then rename boards.txt.alt to boards.txt. Restart IDE, and the new selection options will appear.
2 – Carregar el bootloader al ATmega1284:
Ens hem fet un programador amb un Arduino MEGA 2560. El firmware del programador esta al mateix entorn del Arduino, a Exemples > ArduinoISP. Hem grabat el firmware al programador i OK. Ara tenim la placa d’arduino que ens fa de programador.
Hem connectat les potes del arduino mega al micro 1284 de la següent manera:
El connector on hi posa arduino esta pensat per conectar-ho a un arduino UNO. Com que nosaltres ho hem fet amb un Mega, els pins canvien per aquests:
ATmega1284 |
Arduino mega 2560 |
RESET, pin 9 |
53 |
MOSI, pin 6 |
51 |
MISO, pin 7 |
50 |
SCK, pin 8 |
52 |
|
|
Per carregar el bootloader hem de seleccionar la placa que volguem de les disponibles. Nosaltres hem fet servir la “maniacbug” perquè té un pinout més intuitiu.
Un cop seleccionada la placa cal seleccionar el programador que volem a Tools > Programmer. En aquest cas li hem dit Arduino as ISP.
Ara ja podem baixar el bootloader fent: Burn Bootloader al menú Tools.
Nota: Ens hem trobat amb el problema que l’identificador del micro no era l’esperat. La placa esperava aquest:
0x1e 0x97 0x05
I s’ha trobat amb aquest:
0x1e 0x97 0x06
Això és perquè els micros 1284 i 1284P tenen el mateix nucli però canvia el consum d’energia i el identificador. Aquí ho explica bé:
https://sepzed.wordpress.com/2014/03/15/arduino-on-1284p-and-1284-non-p-version/
Per un moment enganyarem al entorn dient que el nostre micro té el identificador 0x1e 0x97 0x06. Això es configura a aquest arxiu:
C:\Program Files (x86)\Arduino\hardware\tools\avr\etc\avrdude.conf
En: # ATmega1284P, signature = 0x1e 0x97 0x05; (canviar per 0x1e 0x97 0x06).
Un cop haguem modificat aquest arxiu ja ens deixa programar el bootloader. Per poder tornar a baixar sketchs al micro haurem de deixar l’arxiu avrdude.conf tal i com estava
3 – Carregar el programa al micro ATmega1284:
Es fa de la mateixa manera que es fa amb qualsevol placa d’arduino. Seleccionar la placa dins de Tools > Board.
Mes informació sobre el tema:
https://maniacbug.wordpress.com/2011/11/27/arduino-on-atmega1284p-4/
http://www.gammon.com.au/forum/?id=11635
https://github.com/JChristensen/mighty-1284p/tree/v1.6.3