Quick solution for use some ATmega microcontrollers in newer Arduino IDE ver. 1.6.4

As we know, recent changes in the Arduino world have boosted development of Arduino IDE, now reached version 1.6.4.

I do not want to talk at all of the war Arduino LLC vs Arduino SRL (not now, not here). In fact I think my opinion on this topic is not important.

So, I downloaded and try versions 1.6.2/1.6.4 from Arduino.cc and 1.7.2 from Arduino.org (1.7.3 not tested yet).

And I decided to go ahead with 1.6.4 from Arduino.cc / Arduino LLC http://www.arduino.cc/en/Main/Software.

I took the opportunity and did some cleaning in the files pins_arduino.h for ATmega1284, ATmega32 and ATmega16. I remove defines for A0-A7. We can access all 32 digital pins with digitalRead(0 ... 31) / digitalWrite (0 ... 31,[...]) and ADC pins with analogRead(0..7).

Let's start!

Step 1: Select Preferences

Select Preferences from File menu.

<p>I am receiving an error, &quot; avrdude: error: could not find USB device with vid=0x16c0 pid=0x5dc vendor='www.fischl.de' product='USBasp' &quot;. I am using ATMEGA32... I use the same USBasp to write hex files created by Atmel studio (using Extreme AVR burner)... in this case its not working... please help.</p>
<p>It seems that avrdude not &quot;see&quot; USBasp device. Maybe was &quot;locked&quot; by &quot;Extreme AVR burner&quot; program (You have not closed the program?)... or USBasp device have a different vid/pid form what avrdude is configured? I notice that device is working device... but message is from avrdude included in Arduino IDE... I sugest to try a separate version of avrdude... to see if working...</p><p>...or restart, plug USBasp in another USB socket an try first with Arduino IDE...</p><p>...look after usb devices in your operating system configuration to see how this device is used... what are vid/pid... and other info... </p><p>Some USBasp clones (I use them too) do not have the &quot;official&quot; version of firmware... mine worked also in linux and windows... but maybe an updated firmware will solve this problem... you can try to update usbasp with another usbasp... and a known working program like Extreme burner&quot;</p>
this &quot; error&quot; I talked earlier was in Arduino IDE 1.6... (I did not use avrdude)
<p>I know that error was in Arduino IDE... more precisely in avrdude that is bundled with Arduino IDE 1.6.xx... You can search in Arduino IDE installation folders and you will see... somewhere in <strong>.../arduino-1.6.x/hardware/tools/avr/bin... </strong>there are avrdude files...<strong><br></strong></p><p>after the latest additions(of informations) you've made I only see that Arduino IDE not installed properly ... or has altered thereafter... I don't think that has to do with definitions for DIP Atmega 40, because these definitions use tools and config files that are already there... </p><p>Right now I use 1.6.7 under Linux Ubuntu... and method/files from this instructable... </p>
a strange thing happened... I (just out of curiosity) used an older version of Arduino IDE 1.5.2 and this same USBasp device worked perfectly...<br>
hi. i want to monitor values on IDE serial monitor but it not working. would you help me please.
<p>hello i m trying to check the special peripheral of atmega 1284, but i am not able to fetch datda like usart, adc. kindly share the data if available</p>
<p>Ok. This is my setup:</p><p>1) <a href="http://openhardware.ro/atmega-40-pin-minimal-board/" rel="nofollow">Small dev. board</a> for Atmega DIP40 (my design);</p><p>2) <a href="http://openhardware.ro/rs232ttl-board/" rel="nofollow">RS232 to TTL</a> module (my design also)</p><p>3) USB to RS232 adapter (or a serial cable if your computer has serial port)</p><p>4) cheap 5KOhm potentiometer. Middle pin is wired to PA0 (pin40). Other two pins to VDD and GND.</p><p>Ande here is the code (as simple as possible):</p><blockquote>int firstSensor = 0; <br><br>void setup() { <br> Serial.begin(9600);<br>}<br><br>void loop() {<br> firstSensor=analogRead(0);<br> Serial.println(firstSensor);<br> delay(1000);<br>}<br></blockquote><p>I guarantee you it works...</p>
<p>Right now I do some tests for you... I'll come back with some feedback within hours. I do not have an I2C lcd, so I will try Serial with ADC and eventually with a ordinary 16x2 lcd...</p>
<p>I want to help you in one way or another, but I do not understand what the problem is ... I use this setup to make to do all kinds of projects... including usart and adc with atmega 32 16 and 1284</p>
<p>i am using these for adc and usart in one of my project but neither is working i am using proteus to test my code, those code when used in uno using uno board work fine but when using these board i dump in atmega1284p in proteus it dont work plz help me out</p>
<p>THIS IS MY CODE</p><p>/*-----( Import needed libraries )-----*/</p><p>#include &lt;Wire.h&gt; // Comes with Arduino IDE</p><p>#include &lt;LiquidCrystal_I2C.h&gt;</p><p>/*-----( Declare Constants )-----*/</p><p>/*-----( Declare objects )-----*/</p><p>// set the LCD address to 0x27 for a 20 chars 4 line display</p><p>// Set the pins on the I2C chip used for LCD connections:</p><p>// addr, en,rw,rs,d4,d5,d6,d7,bl,blpol</p><p>LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); // Set the LCD I2C address</p><p>int sensorPin = A0; // select the input pin for the potentiometer</p><p>float vtg;</p><p>int sensorValue = 0; </p><p>/*-----( Declare Variables )-----*/</p><p>//NONE</p><p>void setup() /*----( SETUP: RUNS ONCE )----*/</p><p>{</p><p> Serial.begin(9600); // Used to type in characters</p><p> //pinMode(sensorPin, INPUT);</p><p> lcd.begin(20,4); // initialize the lcd for 20 chars 4 lines, turn on backlight</p><p>// ------- Quick 3 blinks of backlight -------------</p><p> for(int i = 0; i&lt; 3; i++)</p><p> {</p><p> lcd.backlight();</p><p> delay(50);</p><p> lcd.noBacklight();</p><p> delay(50);</p><p> }</p><p> lcd.backlight(); // finish with backlight on </p><p>//-------- Write characters on the display ------------------</p><p>// NOTE: Cursor Position: (CHAR, LINE) start at 0 </p><p>// </p><p>// delay(1000);</p><p>// lcd.setCursor(0,3);</p><p>// lcd.print(&quot;4th Line of Text&quot;);</p><p>// delay(8000); </p><p>// Wait and then tell user they can start the Serial Monitor and type in characters to</p><p>// Display. (Set Serial Monitor option to &quot;No Line Ending&quot;)</p><p>/* lcd.clear();</p><p> lcd.setCursor(0,0); //Start at character 0 on line 0</p><p> lcd.print(&quot;Use Serial Mon&quot;);</p><p> lcd.setCursor(0,1);</p><p> lcd.print(&quot;Type to display&quot;); */</p><p>}/*--(end setup )---*/</p><p>void loop() /*----( LOOP: RUNS CONSTANTLY )----*/</p><p>{</p><p> sensorValue = analogRead(sensorPin);</p><p> lcd.setCursor(0,0); //Start at character 4 on line 0</p><p> lcd.print(&quot;adc:&quot;);</p><p> lcd.print(sensorValue);</p><p> delay(500);</p><p> lcd.setCursor(0,1);</p><p> lcd.print(&quot;vtg:&quot;); // Print text on 2nd Line</p><p> vtg=((5.0/1023)*sensorValue);</p><p> lcd.print(vtg);</p><p>// delay(1000);</p><p>// lcd.setCursor(0,2);</p><p>// lcd.print(&quot;0123456789ABCDEFGHIJ&quot;); //Print 20 characters on 3rd line</p><p>}/* --(end main loop )-- */</p><p>/* ( THE END ) */</p>
<p>if you have code of simple adc and uart please if you can share it, it would help me alot for 1284p</p>
<p>Hi Guys,<br><br>I developed a scketch to work on Arduino Mega and I need to compile in an AtMega1284p-pu<br>- Can I compile the same scketch in Atmega1284p-pu? <br>- Is it necessary to change anything on the scketh? pins for example?<br>- The AtMega1284p-pu is still a &quot;virgin&quot;, which Arduino's bootloader is better to burn in?<br><br>Thanks <br></p><p>Angelo Ventura</p>
<p>I tried to answer your question here:</p><p><a href="http://openhardware.ro/using-atmega32-arduino-ide/#comment-156" rel="nofollow">http://openhardware.ro/using-atmega32-arduino-ide/...</a></p>
<p>Thank you very much for this instructable! I recently asked the groups a question on how to use a AtMega 32. Then I saw your instructable how to make a DIP 40 mini board, and this instructable. I hope I can finally get those ATMegas running! Just 1 question: I would use FTDI chips to connect the board to the PC, would that work?</p>
Hm... Some notifications from Instructable reach spam folder at my Yahoo mail... not all .. just some... <br><br>I think you already find the solution...
<p>same problem as TIMLM.. can you help me please to modify the fuse ? when i put (1000) delay i have to wait 17 seconds.... 16Mhz. thanks</p>
<p>What kind of ATmega (16,32 or 1284)?</p><p>for ATmega16 and 32 you can use <strong>High Fuse 0xD9</strong>, and <strong>Low Fuse 0xFF</strong> </p><p>External Crystal upto 16MHz, JTAG disabled. Rest of the options : Default.</p><p>Avrdude arguments: <strong>-U lfuse:w:0xff:m -U hfuse:w:0xd9:m</strong></p>
<p>atmega32, but where can i change the fuse ? i don't fund the installed boards because they are not in the board.txt...</p>
<p>Here is a tutorial about fuse bits: <a href="https://embedderslife.wordpress.com/2012/08/20/fuse-bits-arent-that-scary/" rel="nofollow">https://embedderslife.wordpress.com/2012/08/20/fus... </a> and another: <a href="http://www.ladyada.net/learn/avr/fuses.html" rel="nofollow">http://www.ladyada.net/learn/avr/fuses.html</a></p><p>You can change fusebits with avrdude: </p><blockquote><strong>avrdude </strong><strong>[..........] -U lfuse:w:0xff:m -U hfuse:w:0xd9:m<br></strong></blockquote><p>or with eXtreme Burner: <a href="http://extremeelectronics.co.in/avr-tutorials/gui-software-for-usbasp-based-usb-avr-programmers/" rel="nofollow">http://extremeelectronics.co.in/avr-tutorials/gui-...</a></p><p></p>
<p>Error while burning bootloader: missing 'bootloader.tool' configuration parameter</p>
<p>Entire solution was designed to be used without bootloader ... but with USBASP or other programmer recognized by Arduino IDE. I always work this way... using bootloader seems to me an unnecessary complication (when I working with standalone microcontroller)...</p>
<p>@Silvius. Thanks for the sharing this. I'm using the ATmega16 and it works great except for a timing issue. When I write delay(1000), the actual delay ends up being about 8 seconds. Just thought that I'd let you know. Thanks again.</p>
<p>Thanks for feedback! It looks like you are selected board &quot;ATmega16-8Mhz&quot; but fusebits are left with default values 1MHz. You must change fusebits according with your usage.</p><p>Look here <a href="http://www.ladyada.net/learn/avr/fuses.html" rel="nofollow">http://www.ladyada.net/learn/avr/fuses.html</a></p>
<p>Oh right should have thought of that. I used the link to get the correct fuse bits and used atmel studio and the avrisp mkII to change them. Now the timing is as it should be. Any advice as to how someone might change the bits using only an Arduino? I'm guessing I could do it w/ avrdude, but the device signature I was getting was that of the ATmega328p on the Arduino. </p>
<p>I think that Arduino IDE can burn fusebits only with bootloader. I not tested it because I never use bootloader with my custom &ldquo;boards&rdquo;, so microcontrollers must be set up before being used (It is one time procedure anyway). This is the limit of my solution. As you can see it is easy to overcome.</p><p><br>I'm not enemy of bootloaders, but these require some specific hardware, and I would not know in advance what kind of board will be used...</p><p><br>So to prevent some errors/issues which could lead to &ldquo;brick&rdquo; some MCUs, I decided to leave this operation to be made explicit, and the user to know (or learn) what he does. <br>Best regards!</p>
<p>thsi will actually never work on arduini IDE 1.6.4</p><p>you have mised the main changes in boards file... also clock and cpu have been split in 2 different segments.. you are aware of that... so therefore boards file has to re-written properly to form what's necessary in order to get it working properly...</p>
<p>Hm... Curious ... I actually work with this these files and Arduino 1.6.4... and I tested installation (I delete, uninstall an reinstall for many times), at first on local server and second from link given in instructable...</p><p>And after I compiled and run some tests for every MCU in the list... and everything working fine...</p><p>I'll check anyway...</p>

About This Instructable




More by Silvius:Reading 15 Rotary Encoders with Arduino and ATmega1284 Open Source TV Box - GeekBox AVR Transistor Tester 
Add instructable to: