I have been able to use my Arduino as a ISP for my Attiny84 for a blinking LED sketch. However, I need Arduino to program my Attiny84 using software written for openenergymonitor. I have followed the steps on this page:http://wiki.openenergymonitor.org/index.php?title=Raspberry_Pi#.28Optional.29_Bootload_the_ATtiny84. The steps basically say to download a tiny folder and put it in the hardware folder to allow certain boards(attiny's) to appear when you select a board. As I stated earlier I have been successful in programming my tiny84 for programs that aren't of my interest. I even have been successful with uploading a bootloader with the errors:"avrdude: please define PAGEL and BS2 signals in the configuration file for part ATtiny84," which I have read are OK. But, when I try to upload or even compile this sketch I get an error that expands throughout all of the steps I am required to do. Error: c:/users/brand_000/desktop/arduino folder/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/lib/avr25/crttn84.o: In function __vector_default': (.vectors+0x2): relocation truncated to fit: R_AVR_13_PCREL against symbol
__vector_1' defined in .text.__vector_1 section in core.a(WInterrupts.c.o)
c:/users/brand_000/desktop/arduino folder/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/lib/avr25/crttn84.o: In function __vector_default': (.vectors+0x16): relocation truncated to fit: R_AVR_13_PCREL against symbol
__vector_11' defined in .text.__vector_11 section in core.a(wiring.c.o)
c:/users/brand_000/desktop/arduino folder/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/lib/avr25/crttn84.o:(.init9+0x0): relocation truncated to fit: R_AVR_13_PCREL against symbol main' defined in .text.main section in core.a(main.cpp.o) c:/users/brand_000/desktop/arduino folder/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/lib/avr25/crttn84.o:(.init9+0x2): relocation truncated to fit: R_AVR_13_PCREL against symbol
exit' defined in .fini9 section in c:/users/brand_000/desktop/arduino folder/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/avr25\libgcc.a(_exit.o)
SoftwareSerial\SoftwareSerial.cpp.o: In function SoftwareSerial::begin(long)': C:\Users\brand_000\Desktop\Arduino Folder\libraries\SoftwareSerial/SoftwareSerial.cpp:385: relocation truncated to fit: R_AVR_13_PCREL against symbol
__mulhi3' defined in .text.libgcc section in c:/users/brand_000/desktop/arduino folder/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/avr25\libgcc.a(_mulhi3.o)
C:\Users\brand_000\Desktop\Arduino Folder\libraries\SoftwareSerial/SoftwareSerial.cpp:388: relocation truncated to fit: R_AVR_13_PCREL against symbol __mulhi3' defined in .text.libgcc section in c:/users/brand_000/desktop/arduino folder/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/avr25\libgcc.a(_mulhi3.o) SoftwareSerial\SoftwareSerial.cpp.o: In function
SoftwareSerial::available()':
C:\Users\brand_000\Desktop\Arduino Folder\libraries\SoftwareSerial/SoftwareSerial.cpp:443: relocation truncated to fit: R_AVR_13_PCREL against symbol __divmodhi4' defined in .text.libgcc section in c:/users/brand_000/desktop/arduino folder/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/avr25\libgcc.a(_divmodhi4.o) Tim_RF12_Tiny_Demo_dB.cpp.o: In function
saveConfig':
C:\Users\brand_000\Desktop\Arduino Folder/Tim_RF12_Tiny_Demo_dB.ino:87: relocation truncated to fit: R_AVR_13_PCREL against symbol rf12_config(unsigned char)' defined in .text._Z11rf12_configh section in Jeelib\RF12.cpp.o C:\Users\brand_000\Desktop\Arduino Folder/Tim_RF12_Tiny_Demo_dB.ino:88: relocation truncated to fit: R_AVR_13_PCREL against symbol
Print::println(char const*)' defined in .text._ZN5Print7printlnEPKc section in core.a(Print.cpp.o)
Tim_RF12_Tiny_Demo_dB.cpp.o: In function showHelp': C:\Users\brand_000\Desktop\Arduino Folder/Tim_RF12_Tiny_Demo_dB.ino:144: relocation truncated to fit: R_AVR_13_PCREL against symbol
Print::print(char const*)' defined in .text._ZN5Print5printEPKc section in core.a(Print.cpp.o)
C:\Users\brand_000\Desktop\Arduino Folder/Tim_RF12_Tiny_Demo_dB.ino:145: additional relocation overflows omitted from the output
Now I done every single step probably 5-6 times at least and even used different versions of Arduino: 1.0.3, 1.0.5, 1.0.6. I have tried every single forum post and was curious if I am just missing something so obvious it's invisible?
Thanks for all help in advance.
Also here is the code:
#include <SoftwareSerial.h>
#define txPin 7 //PA3 AIO1 - > Connect to RX on USB BUB
#define rxPin 8 //PA2 3 //PA7 DIO1 - > Connect to TX on USB BUB
// 19k200
SoftwareSerial mySerial(rxPin, txPin);
/*
+-\/-+
VCC 1| |14 GND
(D0) PB0 2| |13 AREF (D10)
(D1) PB1 3| |12 PA1 (D9)
RESET 4| |11 PA2 (D8)
INT0 PWM (D2) PB2 5| |10 PA3 (D7)
PWM (D3) PA7 6| |9 PA4 (D6)
PWM (D4) PA6 7| |8 PA5 (D5) PWM
+----+
*/
#include <JeeLib.h>
#include <util/crc16.h>
#include <util/parity.h>
//#include <avr/pgmspace.h>
#include <avr/eeprom.h>
//#define LED_PIN 0 // activity LED, comment out to disable
#define COLLECT 0x20 // collect mode, i.e. pass incoming without sending acks
/*
static unsigned long now () {
// FIXME 49-day overflow
return millis() / 1000;
}
*/
/*static void activityLed (byte on) {
pinMode(LED_PIN, OUTPUT);
digitalWrite(LED_PIN, on);
}
*/
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// RF12 configuration setup code
typedef struct {
byte nodeId;
byte group;
// char msg[30-4];
word crc;
} RF12Config;
static RF12Config config;
static char cmd;
static byte value, stack[30], top, sendLen, dest ;
static byte testbuf[30], testCounter;
static void saveConfig () {
// save to EEPROM
eeprom_write_byte(RF12_EEPROM_ADDR ,config.nodeId);
eeprom_write_byte(RF12_EEPROM_ADDR +1 ,config.group);
config.crc = ~0;
config.crc = _crc16_update(config.crc, config.nodeId);
config.crc = _crc16_update(config.crc, config.group);
for (int i=2; i < RF12_EEPROM_SIZE-2; i++) {
eeprom_write_byte(RF12_EEPROM_ADDR + i, 0);
config.crc = _crc16_update(config.crc, 0);
}
eeprom_write_byte(RF12_EEPROM_ADDR + RF12_EEPROM_SIZE-2 ,config.crc);
eeprom_write_byte(RF12_EEPROM_ADDR + RF12_EEPROM_SIZE-1 ,config.crc>>8);
if (!rf12_config())
mySerial.println("failed");
}
/*
char helpText1[] PROGMEM =
"\n"
"Available commands:" "\n"
" <nn> i - set node ID (standard node ids are 1..26)" "\n"
" (or enter an uppercase 'A'..'Z' to set id)" "\n"
" <n> b - set MHz band (4 = 433, 8 = 868, 9 = 915)" "\n"
" <nnn> g - set network group (RFM12 only allows 212, 0 = any)" "\n"
" <n> c - set collect mode (advanced, normally 0)" "\n"
" t - broadcast max-size test packet, with ack" "\n"
" ...,<nn> a - send data packet to node <nn>, with ack" "\n"
" ...,<nn> s - send data packet to node <nn>, no ack" "\n"
" <n> l - turn activity LED on DIG8 on or off" "\n"
;
static void showString (PGM_P s) {
for (;;) {
char c = pgm_read_byte(s++);
if (c == 0)
break;
if (c == '\n')
mySerial.print('\r');
mySerial.print(c);
}
}
*/
int freeRam () {
extern int __heap_start, *__brkval;
int v;
return (int) &v - (__brkval == 0 ? (int) &__heap_start : (int) __brkval);
}
static void showHelp () {
// showString(helpText1);
// mySerial.println("Configuration:");
config.nodeId = eeprom_read_byte(RF12_EEPROM_ADDR);
config.group = eeprom_read_byte(RF12_EEPROM_ADDR + 1);
/*
mySerial.println("EEPROM config: ");
uint16_t crc = ~0;
for (uint8_t i = 0; i < RF12_EEPROM_SIZE; ++i){
crc = _crc16_update(crc, eeprom_read_byte(RF12_EEPROM_ADDR + i));
mySerial.print(eeprom_read_byte(RF12_EEPROM_ADDR + i),HEX);
}
mySerial.println("");
mySerial.print("crc:");
mySerial.print(crc);
mySerial.print(" ");
*/
byte id = config.nodeId & 0x1F;
// mySerial.print('@' + id,DEC);
mySerial.print("i");
mySerial.print( id,DEC);
if (config.nodeId & COLLECT)
mySerial.print('*');
mySerial.print(" g");
mySerial.print(config.group,DEC);
mySerial.print(" @ ");
static word bands[4] = { 315, 433, 868, 915 };
word band = config.nodeId >> 6;
mySerial.print(bands[band],DEC);
mySerial.print( "MHz RAM ");
mySerial.println(freeRam());
rf12_config();
}
static void handleInput (char c) {
if ('0' <= c && c <= '9')
value = 10 * value + c - '0';
else if (c == ',') {
if (top < sizeof stack)
stack[top++] = value;
value = 0;
} else if ('a' <= c && c <='z') {
mySerial.print("> ");
mySerial.print((int) value);
mySerial.println(c);
switch (c) {
default:
showHelp();
break;
case 'i': // set node id
config.nodeId = (config.nodeId & 0xE0) + (value & 0x1F);
saveConfig();
break;
case 'b': // set band: 4 = 433, 8 = 868, 9 = 915
value = value == 8 ? RF12_868MHZ :
value == 9 ? RF12_915MHZ : RF12_433MHZ;
config.nodeId = (value << 6) + (config.nodeId & 0x3F);
saveConfig();
break;
case 'g': // set network group
config.group = value;
saveConfig();
break;
case 'c': // set collect mode (off = 0, on = 1)
if (value)
config.nodeId |= COLLECT;
else
config.nodeId &= ~COLLECT;
saveConfig();
break;
case 't': // broadcast a maximum size test packet, request an ack
cmd = 'a';
sendLen = 30;
dest = value;
for (byte i = 0; i < 30; ++i)
testbuf[i] = i + testCounter;
mySerial.print("test ");
mySerial.println((int) testCounter); // first byte in test buffer
++testCounter;
break;
case 'a': // send packet to node ID N, request an ack
case 's': // send packet to node ID N, no ack
cmd = c;
sendLen = top;
dest = value;
memcpy(testbuf, stack, top);
break;
/* case 'l': // turn activity LED on or off
activityLed(value);
break;
case 'q': // turn quiet mode on or off (don't report bad packets)
quiet = value;
break;
*/
}
value = top = 0;
memset(stack, 0, sizeof stack);
} else if ('A' <= c && c <= 'Z') {
config.nodeId = (config.nodeId & 0xE0) + (c & 0x1F);
// saveConfig();
} else if (c > ' ')
showHelp();
}
void setup() {
// activityLed(1);
pinMode(rxPin, INPUT);
pinMode(txPin, OUTPUT);
// set the data rate for the NewSoftmymySerial port
mySerial.begin(19200);
mySerial.println("\n[Attiny84]");
// delay(2000);
if (rf12_config()) {
config.nodeId = eeprom_read_byte(RF12_EEPROM_ADDR);
config.group = eeprom_read_byte(RF12_EEPROM_ADDR + 1);
} else {
config.nodeId = 0x81; // node A1 @ 868 MHz
config.group = 0xD4; //212
rf12_initialize(config.nodeId&0x1F, config.nodeId >> 6 ,config.group);
saveConfig();
}
showHelp();
// activityLed(0);
}
void loop() {
if (mySerial.available())
handleInput(mySerial.read());
if (rf12_recvDone() & (rf12_crc == 0) ) {
mySerial.print("OK");
// activityLed(1);
byte n = rf12_len;
if (config.group == 0) {
mySerial.print("G ");
mySerial.print((int) rf12_grp);
}
mySerial.print(' ');
mySerial.print((int) rf12_hdr);
for (byte i = 0; i < n; ++i) {
mySerial.print(' ');
mySerial.print((int) rf12_data[i]);
}
mySerial.print(" (");
// mySerial.print(rf12_getRSSI(), DEC);
mySerial.println("dB)");
// activityLed(0);
if (rf12_crc == 0) {
// activityLed(1);
if (RF12_WANTS_ACK && (config.nodeId & COLLECT) == 0) {
mySerial.println(" -> ack");
rf12_sendStart(RF12_ACK_REPLY, 0, 0);
}
// activityLed(0);
}
}
if (cmd && rf12_canSend()) {
// activityLed(1);
mySerial.print(" -> ");
mySerial.print((int) sendLen);
mySerial.println(" b");
byte header = cmd == 'a' ? RF12_HDR_ACK : 0;
if (dest)
header |= RF12_HDR_DST | dest;
rf12_sendStart(header, testbuf, sendLen);
cmd = 0;
// activityLed(0);
}
}
https://code.google.com/p/arduino-tiny/issues/detail?id=58&can=1&q=R_AVR_13_PCREL
In case you want more details...
Thank you so much.
I found a reply you made: http://forum.arduino.cc/index.php/topic,60649.0.html.
The details of your reply helped me finally upload the file.
Thanks again.
Also I had to use this page: programming problems, could use help. - adafruit industries
to fix an error I received when my usb port messed up after doing all that work. This is just in case anyone has a similar issue.
You are welcome. Glad to know you have it working.
+1 for following instructions