Pages: [1] 2 3 ... 5   Go Down
Author Topic: Arduino translated to AVR?  (Read 12616 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Jr. Member
**
Karma: 0
Posts: 76
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello!  I have some arduino code that I have written, and I am curious how that could be translated to work with an 8-pin AVR IC, such as the attiny85v or something similar.  I am assuming I would be using AVRdude or some similar program.  I know that the 2 languages are similar, so I am wondering:

How would I know if my arduino program would be able to fit on an AVR IC? 
How could I check the size of the program in comparison to the limits of the AVR?

Is there a translator program, or a reference source that would specify the major differences between the two languages?
That I would understand what I needed to modify in order for it to work with AVRdude. 

Are there any potential disadvantages to look out for?

If I could translate the Arduino code to work with a smaller, more compact and cheaper IC, than it seems logical to pursue this route. 

I've searched around for ways to translate the code, but haven't been able to find an article that directly relates to these questions.

Thanks in advance for your advice.
Logged

Fort Lauderdale, FL
Offline Offline
Faraday Member
**
Karma: 71
Posts: 6144
Baldengineer
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

http://www.google.com/search?q=arduino+attiny85

You're probably interested in the very first link.  Tells how to adapt the IDE for the tiny and then how to program it using an existing Arduino.
Logged

Capacitor Expert By Day, Enginerd by night.  ||  Personal Blog: www.baldengineer.com  || Electronics Tutorials for Beginners:  www.addohms.c

Offline Offline
Jr. Member
**
Karma: 0
Posts: 76
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

That's it.  I kept searching for 'translate arduino to avr' and things similar to that, and had no luck.  I hadn't tried those specific search terms, but that's exactly what i'm looking for!  thank you!
Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 76
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I've followed the steps according to http://hlt.media.mit.edu/?p=1229 

I am using an Arduino UNO with the Arduino software version 0022, and the instructions state as follows:

-Download: attiny45_85.zip
-Locate your Arduino sketchbook folder (you can find its location in the preferences dialog in the Arduino software)
-Create a new sub-folder called “hardware” in the sketchbook folder.
-Copy the attiny45_85 folder from the attiny45_85.zip to the hardware folder.
-Restart the Arduino development environment.

Then the sketch should be uploaded via “ATtiny45 (w/ Arduino as ISP)” or “ATtiny85 (w/ Arduino as ISP)” from the Tools > Board menu.



The ATtiny 45/85v option is not available under the tools > board menu, and I doublechecked to make sure the hardware folder and its subcontents were placed correctly, and the program fully closed/restarted. 

Any ideas why this may be?
Logged

SE USA
Offline Offline
Faraday Member
**
Karma: 41
Posts: 3783
@ssh0le
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I always put things in the

blah/Arduino/Hardware/Arduino/

folders where arduino is installed (its old and I am stubborn)

there you will find things like boards.txt and a folder for cores (put the core files in its own folder under cores)

for me I have better luck training a drunken monkey to shoot a riffle than getting the includes to work outside of where every thing else is based from ... course I am special like that (and honestly believe trying to make things easier just makes things worse)
Logged


Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 212
Posts: 13085
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


You will have better luck with this core...
http://code.google.com/p/arduino-tiny/

The 45_85 core has a few bugs and is missing some features.

Assuming you are using Windows, after expanding either core, your directory structure should be similar this where your sketches are stored in C:\Projects\Arduino\Sketch\

Code:
C:\Projects\Arduino\Sketch\hardware\tiny\boards.txt
C:\Projects\Arduino\Sketch\hardware\tiny\cores
C:\Projects\Arduino\Sketch\hardware\tiny\cores\empty
C:\Projects\Arduino\Sketch\hardware\tiny\cores\tiny
C:\Projects\Arduino\Sketch\hardware\tiny\cores\empty\Arduino.h
C:\Projects\Arduino\Sketch\hardware\tiny\cores\empty\main.cpp
C:\Projects\Arduino\Sketch\hardware\tiny\cores\empty\WProgram.h
C:\Projects\Arduino\Sketch\hardware\tiny\cores\tiny\Arduino.h
C:\Projects\Arduino\Sketch\hardware\tiny\cores\tiny\binary.h
C:\Projects\Arduino\Sketch\hardware\tiny\cores\tiny\core_adc.h
C:\Projects\Arduino\Sketch\hardware\tiny\cores\tiny\core_build_options.h
C:\Projects\Arduino\Sketch\hardware\tiny\cores\tiny\core_macros.h
C:\Projects\Arduino\Sketch\hardware\tiny\cores\tiny\core_pins.h
C:\Projects\Arduino\Sketch\hardware\tiny\cores\tiny\core_timers.h
C:\Projects\Arduino\Sketch\hardware\tiny\cores\tiny\HardwareSerial.cpp
C:\Projects\Arduino\Sketch\hardware\tiny\cores\tiny\HardwareSerial.h
C:\Projects\Arduino\Sketch\hardware\tiny\cores\tiny\main.cpp
C:\Projects\Arduino\Sketch\hardware\tiny\cores\tiny\pins_arduino.c
C:\Projects\Arduino\Sketch\hardware\tiny\cores\tiny\pins_arduino.h
C:\Projects\Arduino\Sketch\hardware\tiny\cores\tiny\Print.cpp
C:\Projects\Arduino\Sketch\hardware\tiny\cores\tiny\Print.h
C:\Projects\Arduino\Sketch\hardware\tiny\cores\tiny\PwmTimer.h
C:\Projects\Arduino\Sketch\hardware\tiny\cores\tiny\Stream.h
C:\Projects\Arduino\Sketch\hardware\tiny\cores\tiny\TinyDebugSerial.cpp
C:\Projects\Arduino\Sketch\hardware\tiny\cores\tiny\TinyDebugSerial.h
C:\Projects\Arduino\Sketch\hardware\tiny\cores\tiny\TinyDebugSerial115200.cpp
C:\Projects\Arduino\Sketch\hardware\tiny\cores\tiny\TinyDebugSerial38400.cpp
C:\Projects\Arduino\Sketch\hardware\tiny\cores\tiny\TinyDebugSerial9600.cpp
C:\Projects\Arduino\Sketch\hardware\tiny\cores\tiny\TinyDebugSerialErrors.cpp
C:\Projects\Arduino\Sketch\hardware\tiny\cores\tiny\Tone.cpp
C:\Projects\Arduino\Sketch\hardware\tiny\cores\tiny\ToneTimer.h
C:\Projects\Arduino\Sketch\hardware\tiny\cores\tiny\UserTimer.h
C:\Projects\Arduino\Sketch\hardware\tiny\cores\tiny\WCharacter.h
C:\Projects\Arduino\Sketch\hardware\tiny\cores\tiny\WConstants.h
C:\Projects\Arduino\Sketch\hardware\tiny\cores\tiny\WInterrupts.c
C:\Projects\Arduino\Sketch\hardware\tiny\cores\tiny\wiring.c
C:\Projects\Arduino\Sketch\hardware\tiny\cores\tiny\wiring.h
C:\Projects\Arduino\Sketch\hardware\tiny\cores\tiny\wiring_analog.c
C:\Projects\Arduino\Sketch\hardware\tiny\cores\tiny\wiring_digital.c
C:\Projects\Arduino\Sketch\hardware\tiny\cores\tiny\wiring_private.h
C:\Projects\Arduino\Sketch\hardware\tiny\cores\tiny\wiring_pulse.c
C:\Projects\Arduino\Sketch\hardware\tiny\cores\tiny\wiring_shift.c
C:\Projects\Arduino\Sketch\hardware\tiny\cores\tiny\WMath.cpp
C:\Projects\Arduino\Sketch\hardware\tiny\cores\tiny\WProgram.h
C:\Projects\Arduino\Sketch\hardware\tiny\cores\tiny\WString.cpp
C:\Projects\Arduino\Sketch\hardware\tiny\cores\tiny\WString.h
Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 212
Posts: 13085
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


If you have the patience there is monstrous topic here about the Tiny Core and programming ATtiny processors the Arduino Way...
http://arduino.cc/forum/index.php/topic,51984.0.html
Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 76
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


You will have better luck with this core...
http://code.google.com/p/arduino-tiny/

The 45_85 core has a few bugs and is missing some features.


The download is for Arudino 1.0
I am using version 0022. 

I am on a Mac btw...should've mentioned that earlier
Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 76
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I went ahead and added the files I downloaded for the 1.0, and it worked!  The Attiny IC's are listed under the board options. 
I uploaded the sketch for using the Arduino as an ISP,
I then opened the Blink sketch and changed the pinout to pin 0 insead of pin 13,
inserted a capacitor between reset and GND, and tried to upload it with all of the attiny85v options available,
and none of them worked. 

they all stated:
avrdude: stk500_recv(): programmer is not responding

any ideas?
Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 212
Posts: 13085
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


What size capacitor?
Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 64
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


You will have better luck with this core...
http://code.google.com/p/arduino-tiny/

The 45_85 core has a few bugs and is missing some features.


The download is for Arudino 1.0
I am using version 0022. 

I am on a Mac btw...should've mentioned that earlier

+1 on http://code.google.com/p/arduino-tiny/

You will find better help and support for it.  Consider upgrading Arduino, 0022 is getting fairly dated.

Best Regards,
George 
Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 76
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I've been holding off, since I originally had issues with UNO and 1.0

Is there a clear solution for any issues that may arise with this upgrade and UNO?  If so, then i am more than happy to download it.  I just didn't want to spend a lot of time trying to solve any issues that may arise, as I ended up doing the first time I tried it.
Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 76
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


What size capacitor?

I was using a 47uF capacitor.  I know that it states 10, but I haven't had any issues with the capacitor size being too large.  I've successfully bootloaded/uploaded sketches to ATMEGA328 IC's.  Its just the new breed of attiny's that i'm having issues with.
Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 212
Posts: 13085
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Is there a clear solution for any issues that may arise with this upgrade and UNO?

I have both versions installed (0022 and 1.0.1).  I have only encountered one annoyance: Arduino 1.0x changes the filename extension when a sketch is saved.  That behaviour can be disabled under File / Preferences.

Serial changed considerably.  If you rely on Serial being "blocking" stick with 0022.
Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 212
Posts: 13085
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I was using a 47uF capacitor.  I know that it states 10, but I haven't had any issues with the capacitor size being too large.

Yeah that should be fine.  I use the same size.

Connect an LED + current limiting resistor to pin 9.  When uploading: at all times the LED on pin 9 should display a "heartbeat" and the LED on pin 13 should never light.  Is that what happens?

Please post the verbose output from an upload attempt.
Logged

Pages: [1] 2 3 ... 5   Go Up
Jump to: