Arduino Forum

Using Arduino => Microcontrollers => Topic started by: Richie_asg1 on Jun 19, 2017, 05:05 pm

Title: Programming Attiny45 with Uno. Problems finding good information.
Post by: Richie_asg1 on Jun 19, 2017, 05:05 pm
Hello folks,
 Had real problems finding one simple method to program the Attiny with the Uno today.

From all the instructables and google searches they seemed to contain errors or direct to one upload site on github that didn't work for me.

I did get it to work but only after following a link here and one on sparkfun and combining the two.

The link here is https://create.arduino.cc/projecthub/arjun/programming-attiny85-with-arduino-uno-afb829
 but links to the github link "attiny by Davis A. Mellis" which didn't work for me, nor did another link on the same site, and there is a lot of talk about the links not working all over the place.

The Sparkfun tutorial here - https://learn.sparkfun.com/tutorials/tiny-avr-programmer-hookup-guide

is great to download the attiny software and put it in the right folder for access and helped me a lot, and in my opinion is much easier to understand, but then wants you to use their programmer at £22 a pop - and I knew my trusty Uno in front of me could handle it.

It was a learning experience for me as a novice, but I just could not find a complete answer to what I thought was a well trodden route, as most of the "easy" tutorials out there used the Mellis information.

I'm sure there is plenty of good information to make it easy for an 8yr old, but I couldn't find it. Maybe someone can post a link to the easy and complete method, like a sticky in this part of the forum.

Title: Re: Programming Attiny45 with Uno. Problems finding good information.
Post by: mixographer on Jun 19, 2017, 08:02 pm
I think this is a good place to start:

TinyCore (https://github.com/SpenceKonde/ATTinyCore)

It talks about using usbASP, USBtiny and ArduinoAsISP. There is lots of detailed info and the Author Dr. Azzy is active here on the boards. 

Jimmy
Title: Re: Programming Attiny45 with Uno. Problems finding good information.
Post by: pert on Jun 20, 2017, 02:27 am
I 100% agree with mixographer about using the excellent ATTinyCore. However, I am curious:
but links to the github link "attiny by Davis A. Mellis" which didn't work for me, nor did another link on the same site, and there is a lot of talk about the links not working all over the place.
Which link are you talking about. The only one on that page related to damellis/attiny is the Boards Manager URL, which works fine for me. The only other link on that page is the datasheet from Atmel. The only mention of the link not working in the comments is a problem with the period at the end of the sentence being included in the URL, which was fixed 2 years ago. If you can identify an issue with damellis/attiny I will try to get it fixed. Even though there is a better alternative now, damellis/attiny has been around for a long time and a lot of people still use it, probably because they are reading outdated tutorials that don't mention ATTinyCore.
Title: Re: Programming Attiny45 with Uno. Problems finding good information.
Post by: Richie_asg1 on Jun 20, 2017, 12:59 pm
I think that could be the problem because I came in through the wrong door so to speak. I started by finding the chip then looking for methods to program it, rather than starting in Arduino and looking for suitable processors. It's the first I've seen mention of ATTinyCore from this direction.

Next step to cobble a shield together to make programming them a bit easier.
Title: Re: Programming Attiny45 with Uno. Problems finding good information.
Post by: 3Dtj on Feb 09, 2018, 07:12 pm
Question on compiling errors from an Uno to ATtiny45.  I've successfully compiled the blink sketch to the ATtiny45 but when I try the same process for a sketch involving a LoRa protocol I get a compiling error.  The LoRa sketch is not big thus confused on why I get a compiling error.  Are there certain operations (ie LoRa) that wouldn't be possible with the ATtiny45?

Appreciate any thoughts.
3Dtj
Title: Re: Programming Attiny45 with Uno. Problems finding good information.
Post by: DrAzzy on Feb 09, 2018, 07:17 pm
Question on compiling errors from an Uno to ATtiny45.  I've successfully compiled the blink sketch to the ATtiny45 but when I try the same process for a sketch involving a LoRa protocol I get a compiling error.  The LoRa sketch is not big thus confused on why I get a compiling error.  Are there certain operations (ie LoRa) that wouldn't be possible with the ATtiny45?

Appreciate any thoughts.
3Dtj
Yes, absolutely - depends on how it interfaces with the LoRa radio. Post the error message for help interpreting it.

Particularly with David's core, you'll have issues converting a lot of sketches because of the lack of serial, I2C, and SPI hardware on the attiny's. With my core, I2C and SPI are done transparently using special versions of Wire and SPI library included with the core, so code should just work. There's also a "Serial" - but it's still software serial, not hardware serial, so it's subject to all the limitations of software serial (except that it uses the aco interrupt instead of a pcint, so it won't interfere with as much as softwareserial library)
Title: Re: Programming Attiny45 with Uno. Problems finding good information.
Post by: 3Dtj on Feb 09, 2018, 10:20 pm
Thank you for responding.  I'm new to all this thus but I was shocked when I got the compiling error for such a small sketch (only 50 lines of code).  I'll post the sketch and the error later this evening. 

Thank you and appreciate any insight.

3Dtj
Title: Re: Programming Attiny45 with Uno. Problems finding good information.
Post by: 3Dtj on Feb 11, 2018, 05:01 am
The error message I get is that can not compilte to the ATtiny25/45/85.

Using two separate LoRa transreceivers, the program is intended to blink a LED upon receiving a message from the second LoRa transreceiver that broadcasts the correct syncword.  I was able to get the below code (modified to remove the serial print messages) using two Adriuno UNOs and two separate LoRa tranreceivers.


Currently I have the ATtiny45 wired with the LED going to ATtiny45 PB3, the IRQ to PB4, SCK to PB2, MISO to PB1, and CS PB0.  I was able to test the wiring and ATtiny45 using the basic blink program as described in the YouTube video to shrink your Adruino project.
 

/*
  LoRa Duplex communication

  Sends a message every half second, and polls continually
  for new incoming messages. Implements a one-byte addressing scheme,
  with 0xFF as the broadcast address.

  Uses readString() from Stream class to read payload. The Stream class'
  timeout may affect other functuons, like the radio's callback. For an

  created 28 April 2017
  by Tom Igoe
*/
#include <SPI.h>              // include libraries
#include <LoRa.h>

 
const int receiveLED = 3;
const int csPin = 0;          // LoRa radio chip select
const int resetPin = 5;       // LoRa radio reset
const int irqPin = 4;         // change for your board; must be a hardware interrupt pin

byte localAddress = 0xFF;     // address of this device
byte destination = 0xBB;      // destination to send to
byte syncWord = 0xB4;        // sync word (network ID)
byte spreadingFactor = 8;    // spreading factor (6-12)


void setup() {
  LoRa.setPins(csPin, resetPin, irqPin);  //set CS, reset, IRQ pin
  LoRa.begin(900E6);              // initialize ratio at 900 MHz

  LoRa.setSyncWord(syncWord);
  LoRa.setTimeout(10); 
  LoRa.setSpreadingFactor(spreadingFactor);
  // set the I/O pin modes;
  pinMode(receiveLED, OUTPUT);
  }
 
void sendMessage(String outgoing) {
  LoRa.beginPacket();                   // start packet
  LoRa.write(destination);              // add destination address
  LoRa.write(localAddress);             // add sender address
  LoRa.write(outgoing.length());        // add payload length
  LoRa.print(outgoing);                 // add payload
  LoRa.endPacket();                     // finish packet and send it
}


void onReceive(int packetSize) {
  if (packetSize == 0) return;          // if there's no packet, return

  digitalWrite(receiveLED, HIGH);       // turn on the receive LED

  // read packet header bytes:
  int recipient = LoRa.read();          // recipient address
  byte sender = LoRa.read();            // sender address
  byte incomingMsgId = LoRa.read();     // incoming msg ID
  byte msgLength = LoRa.read();    // incoming msg length
  String incoming = LoRa.readString();  //payload of packet


  // if the recipient isn't this device or broadcast,
  if (recipient != localAddress && recipient != 0xFF) {
    return;                             // skip rest of function
  digitalWrite(receiveLED, LOW);      // turn off receive LED
}
}
Title: Re: Programming Attiny45 with Uno. Problems finding good information.
Post by: pert on Feb 11, 2018, 05:27 am
Please use code tags (</> button on the toolbar) when you post code or warning/error messages. The reason is that the forum software can interpret parts of your code as markup, leading to confusion, wasted time, and a reduced chance for you to get help with your problem. This will also make it easier to read your code and to copy it to the IDE or editor. If your browser doesn't show the posting toolbar then you can just manually add the code tags:
[code]// your code is here[/code]
Using code tags and other important information is explained in the How to use this forum post (http://forum.arduino.cc/index.php/topic,148850.0.html). Please read it.

Please always do a Tools > Auto Format on your code before posting it. This will make it easier for you to spot bugs and make it easier for us to read. If you're using the Arduino Web Editor you will not have access to this useful tool but it's still unacceptable to post poorly formatted code. I recommend you to use the standard IDE (http://www.arduino.cc/en/Main/Software) instead.

The error message I get is that can not compilte to the ATtiny25/45/85.
I'm sure there is much more than that to the error. Being so vague will only make it less likely for you to get a solution. Do you see that black window at the bottom of the Arduino IDE window? It's called the console. When you have a compile error you need to scroll that window all the way to the top(helps to resize it larger) and start reading it from the top. You will find the compiler provides you specific information about the problem.

When you encounter an error you'll see a button on the right side of the orange bar "Copy error messages". Click that button. Paste the error in a message here USING CODE TAGS (</> button on the toolbar).
Title: Re: Programming Attiny45 with Uno. Problems finding good information.
Post by: 3Dtj on Feb 12, 2018, 09:35 pm
Sorry about the mix-up on the code.  I'll resend using the proper </> and give the exact message later this evening. 

Thank you,
3Dtj
Title: Re: Programming Attiny45 with Uno. Problems finding good information.
Post by: 3Dtj on Feb 13, 2018, 03:39 am
First here is the original code that I was using to compile to the ATtiny45.

Code: [Select]


/*
  LoRa Duplex communication

  Sends a message every half second, and polls continually
  for new incoming messages. Implements a one-byte addressing scheme,
  with 0xFF as the broadcast address.

  Uses readString() from Stream class to read payload. The Stream class'
  timeout may affect other functuons, like the radio's callback. For an

  created 28 April 2017
  by Tom Igoe
*/
#include <SPI.h>              // include libraries
#include <LoRa.h>


const int receiveLED = 3;
const int csPin = 0;          // LoRa radio chip select
const int resetPin = 5;       // LoRa radio reset
const int irqPin = 4;         // change for your board; must be a hardware interrupt pin

byte localAddress = 0xFF;     // address of this device
byte destination = 0xBB;      // destination to send to
byte syncWord = 0xB4;        // sync word (network ID)
byte spreadingFactor = 8;    // spreading factor (6-12)


void setup() {
  LoRa.setPins(csPin, resetPin, irqPin);  //set CS, reset, IRQ pin
  LoRa.begin(900E6);              // initialize ratio at 900 MHz

  LoRa.setSyncWord(syncWord);
  LoRa.setSpreadingFactor(spreadingFactor);
  LoRa.setTimeout(10);
  pinMode(receiveLED, OUTPUT); // set the I/O pin modes
}

void onReceive(int packetSize) {
  if (packetSize == 0) return;          // if there's no packet, return
  digitalWrite(receiveLED, HIGH);       // turn on the receive LED

  // read packet header bytes
  int recipient = LoRa.read();          // recipient address
  byte msgLength = LoRa.read();    // incoming msg length
  String incoming = LoRa.readString();  //payload of packet


  // if the recipient isn't this device or broadcast,
  if (recipient != localAddress && recipient != 0xFF) {
    return;                             // skip rest of function
    digitalWrite(receiveLED, LOW);      // turn off receive LED
  }
}





Below is part of the error message.  Unfortunately the rest exceeds the 9000 character limit so I just pasted a portion of it to give you an idea.



Code: [Select]


In file included from c:\program files (x86)\arduino\hardware\tools\avr\avr\include\avr\io.h:99:0,

                 from c:\program files (x86)\arduino\hardware\tools\avr\avr\include\avr\pgmspace.h:90,

                 from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:28,

                 from sketch\LoRaDuplex_ATtiny45.ino.cpp:1:

C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI\src/SPI.h: In member function 'void SPISettings::init_AlwaysInline(uint32_t, uint8_t, uint8_t)':

C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI\src/SPI.h:146:16: error: 'SPE' was not declared in this scope

     spcr = _BV(SPE) | _BV(MSTR) | ((bitOrder == LSBFIRST) ? _BV(DORD) : 0) |

                ^

C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI\src/SPI.h:146:27: error: 'MSTR' was not declared in this scope

     spcr = _BV(SPE) | _BV(MSTR) | ((bitOrder == LSBFIRST) ? _BV(DORD) : 0) |

                           ^

C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI\src/SPI.h:146:65: error: 'DORD' was not declared in this scope

     spcr = _BV(SPE) | _BV(MSTR) | ((bitOrder == LSBFIRST) ? _BV(DORD) : 0) |

                                                                 ^

In file included from C:\Users\TBK\Documents\Arduino\LoRaDuplex_ATtiny45\LoRaDuplex_ATtiny45.ino:14:0:

C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI\src/SPI.h: In static member function 'static void SPIClass::beginTransaction(SPISettings)':

C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI\src/SPI.h:203:5: error: 'SPCR' was not declared in this scope

     SPCR = settings.spcr;

     ^

C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI\src/SPI.h:204:5: error: 'SPSR' was not declared in this scope

     SPSR = settings.spsr;

     ^

C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI\src/SPI.h: In static member function 'static uint8_t SPIClass::transfer(uint8_t)':

C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI\src/SPI.h:209:5: error: 'SPDR' was not declared in this scope

     SPDR = data;

     ^
Title: Re: Programming Attiny45 with Uno. Problems finding good information.
Post by: pert on Feb 13, 2018, 04:22 am
Do this:

If you still get errors then post them.
Title: Re: Programming Attiny45 with Uno. Problems finding good information.
Post by: 3Dtj on Feb 15, 2018, 07:49 pm
Ok I'll try this tonight and see what happens.
Title: Re: Programming Attiny45 with Uno. Problems finding good information.
Post by: 3Dtj on Feb 16, 2018, 03:15 am
Ok this is what I got this time after installing the new core.

Code: [Select]


Build options changed, rebuilding all
C:\Users\TBK\Documents\Arduino\libraries\arduino-LoRa-master\src\LoRa.cpp: In member function 'int LoRaClass::endPacket()':

C:\Users\TBK\Documents\Arduino\libraries\arduino-LoRa-master\src\LoRa.cpp:150:11: error: 'yield' was not declared in this scope

     yield();

           ^

exit status 1
Error compiling for board ATtiny25/45/85.
Title: Re: Programming Attiny45 with Uno. Problems finding good information.
Post by: wilykat on Feb 16, 2018, 03:20 am
Code: [Select]
'yield' was not declared in this scope

Looks like your code has a bug. A missing line or a typo somewhere.
Title: Re: Programming Attiny45 with Uno. Problems finding good information.
Post by: pert on Feb 16, 2018, 04:16 am
Actually that is caused by a bug in ATTinyCore:
https://github.com/SpenceKonde/ATTinyCore/issues/187 (https://github.com/SpenceKonde/ATTinyCore/issues/187)
The bug has been fixed but there wasn't a release since that time. yield() is not commonly used so most people are able to use the latest release without any problems but 3Dtj was unlucky to use a library that does use yield(). So the version with the fix is not available for installation via Boards Manager but you can easily do a manual installation of the version of ATTinyCore with the fix like this:
Title: Re: Programming Attiny45 with Uno. Problems finding good information.
Post by: DrAzzy on Feb 16, 2018, 04:53 pm
Thanks for doing my tech support for me, Pert!

My hope is that I'll be able to do a release this weekend - it's been a while.
Title: Re: Programming Attiny45 with Uno. Problems finding good information.
Post by: 3Dtj on Feb 16, 2018, 08:38 pm
I'll check the code again.   Based upon the sketch, would you agree the ATtiny45 should be able to handle it?  Is it possible that I'm declaring a pin on the ATtiny45 that is unable to support a LoRa function?
Title: Re: Programming Attiny45 with Uno. Problems finding good information.
Post by: 3Dtj on Feb 16, 2018, 08:52 pm
Code: [Select]

/*
  LoRa Duplex communication

  Sends a message every half second, and polls continually
  for new incoming messages. Implements a one-byte addressing scheme,
  with 0xFF as the broadcast address.

  Uses readString() from Stream class to read payload. The Stream class'
  timeout may affect other functuons, like the radio's callback.

  created 28 April 2017
  by Tom Igoe
*/
#include <SPI.h>              // include libraries
#include <LoRa.h>


const int receiveLED = 3;
const int csPin = 0;          // LoRa radio chip select
const int resetPin = 5;       // LoRa radio reset
const int irqPin = 4;         // change for your board; must be a hardware interrupt pin

byte localAddress = 0xFF;     // address of this device
byte destination = 0xBB;      // destination to send to
byte syncWord = 0xB4;        // sync word (network ID)
byte spreadingFactor = 8;    // spreading factor (6-12)


void setup() {
  LoRa.setPins(csPin, resetPin, irqPin);  //set CS, reset, IRQ pin
  LoRa.begin(900E6);              // initialize ratio at 900 MHz

  LoRa.setSyncWord(syncWord);
  LoRa.setSpreadingFactor(spreadingFactor);
  LoRa.setTimeout(10);
  pinMode(receiveLED, OUTPUT); // set the I/O pin modes
}

void onReceive(int packetSize) {
  if (packetSize == 0) return;          // if there's no packet, return
  digitalWrite(receiveLED, HIGH);       // turn on the receive LED

  // read packet header bytes
  int recipient = LoRa.read();          // recipient address
  byte msgLength = LoRa.read();    // incoming msg length
  String incoming = LoRa.readString();  //payload of packet


  // if the recipient isn't this device or broadcast,
  if (recipient != localAddress && recipient != 0xFF) {
    return;                             // skip rest of function
    digitalWrite(receiveLED, LOW);      // turn off receive LED
  }
}

Title: Re: Programming Attiny45 with Uno. Problems finding good information.
Post by: 3Dtj on Feb 16, 2018, 09:21 pm
Sorry.  Didn't see pert's response after posting the above.  I will try the updated library tonight.

3Dtj
Title: Re: Programming Attiny45 with Uno. Problems finding good information.
Post by: 3Dtj on Feb 17, 2018, 07:06 pm
Hmm.   I removed the Spence core and downloaded the AATinyCore-master.zip using the above link.  Do I need to install the Spence file from the board manger again?  I don't see options to select the ATTiny boards when I go into the board menu of the IDE and I'm not able to open the avrdude.conf file from the master.zip
Title: Re: Programming Attiny45 with Uno. Problems finding good information.
Post by: pert on Feb 18, 2018, 12:19 am
Do I need to install the Spence file from the board manger again?
No, don't do that. The .zip file contains the same core but with all the latest development work in it, rather than the release version you get from Boards Manager, which is missing those changes.

I don't see options to select the ATTiny boards when I go into the board menu of the IDE and I'm not able to open the avrdude.conf file from the master.zip
That means you didn't do the installation correctly.

I'm not able to open the avrdude.conf file from the master.zip
You weren't supposed to leave the folder in the .zip file. I said "Copy the folder ATTinyCore-master from the downloaded file" because, at least on Windows, you can treat .zip files as folders and copy their contents out of them without actually going through an unzip stage. If you put the .zip file in the hardware folder then you need to unzip it. The folder structure should look like this:

{sketchbook folder}
|_hardware
   |_ATTinyCore-master
      |_avr

Make sure to not create an extra folder level between the hardware folder and the avr folder.
Title: Re: Programming Attiny45 with Uno. Problems finding good information.
Post by: 3Dtj on Feb 18, 2018, 05:03 pm
We are making progress.   I did have an extra subfolder inserted thus removed that and was able to see ATTiny45 as a board selection.  Upon compiling, I received a new error message:

Code: [Select]

Archiving built core (caching) in: C:\Users\TBK\AppData\Local\Temp\arduino_cache_732459\core\core_ATTinyCore-master_avr_attinyx5_LTO_disable,TimerClockSource_default,chip_45,clock_8internal,bod_disable_3652342df78470b424b7590a57f0d9c7.a
C:\Users\TBK\AppData\Local\Temp\arduino_build_648684/core\core.a(main.cpp.o): In function `main':

C:\Users\TBK\Documents\Arduino\hardware\ATTinyCore-master\avr\cores\tiny/main.cpp:13: undefined reference to `loop'

collect2.exe: error: ld returned 1 exit status

exit status 1
Error compiling for board ATtiny25/45/85.



So close to getting this to work.  What recommendation do you have?   Really appreciate the help pert.
Title: Re: Programming Attiny45 with Uno. Problems finding good information.
Post by: pert on Feb 18, 2018, 11:39 pm
Typically this error means that the sketch you're compiling doesn't contain a loop function. Every sketch must have a setup and a loop function, even if they are left empty.

Try this:

Does the error still occur?
Title: Re: Programming Attiny45 with Uno. Problems finding good information.
Post by: 3Dtj on Feb 19, 2018, 06:42 pm
No error occurred when I created a new sketch and compiled as you recommended.   I did find where I had removed the previous void loop (because there was no code).  I re-entered the void loop command to address that issue.  I attempted to compile the updated code an received the following error:


Code: [Select]

Build options changed, rebuilding all
Archiving built core (caching) in: C:\Users\TBK\AppData\Local\Temp\arduino_cache_458644\core\core_ATTinyCore-master_avr_attinyx5_LTO_disable,TimerClockSource_default,chip_45,clock_8internal,bod_disable_3652342df78470b424b7590a57f0d9c7.a
Sketch uses 2790 bytes (68%) of program storage space. Maximum is 4096 bytes.
Global variables use 70 bytes (27%) of dynamic memory, leaving 186 bytes for local variables. Maximum is 256 bytes.
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0xae
avrdude: stk500_recv(): programmer is not responding
Problem uploading to board.  See http://www.arduino.cc/en/Guide/Troubleshooting#upload for suggestions.
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0xae
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0xae
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0xae
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0xae
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0xae
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0xae
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0xae
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0xae
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0xae



Is 0xae referring to the local or destination that I used for the LoRa addresses in my sketch?
Title: Re: Programming Attiny45 with Uno. Problems finding good information.
Post by: wilykat on Feb 20, 2018, 07:24 am
Not responding usually indicates something's not getting through. Are the wiring correct? If you used Arduino as ISP, did you upload ArduinoISP sketch first? Set the programmer correctly in the menu? (ArduinoISP and Arduino as ISP aren't the same!)  Maybe a pullup resistor from ATTiny's reset pin to 5v?
Title: Re: Programming Attiny45 with Uno. Problems finding good information.
Post by: 3Dtj on Feb 21, 2018, 03:41 am
I made a slight change to the code and seems to be compiling but now it says sketch is too big (exceeds by 122%) but I only added a few lines of code.  Should just a few lines of code really exceed the storage of the ATtiny45??  Would an ATTiny85 solve the issue if it really is a matter or storage?

 
Title: Re: Programming Attiny45 with Uno. Problems finding good information.
Post by: CrossRoads on Feb 21, 2018, 04:01 am
Compare the #s.
Attiny 25/45/85:
2/4/8K Bytes of In-System Programmable Program Memory Flash
128/256/512 Bytes Internal SRAM
128/256/512 Bytes In-System Programmable EEPROM


Double the memory from 45 to 85.

Title: Re: Programming Attiny45 with Uno. Problems finding good information.
Post by: pert on Feb 21, 2018, 04:41 am
Should just a few lines of code really exceed the storage of the ATtiny45?
That absolutely depends on the lines of code. A single line could do that or not increase the program size at all.

Would an ATTiny85 solve the issue if it really is a matter or storage?
Yes. If you're currently at 5 kB and an ATTiny85 is 8 kB then it gives you some breathing room but you can fill up an ATtiny85 pretty fast also. It's fun to see how much you can do with very limited resources but you can't just expect to be able to keep adding features to your program indefinitely, especially if you're not willing to do a lot of work to optimize your code down as small as possible.
Title: Re: Programming Attiny45 with Uno. Problems finding good information.
Post by: 3Dtj on Feb 21, 2018, 06:13 pm
Fascinating that what in my mind is hardly any code at all is causing the limitation issue.

Code: [Select]


Sketch uses 5006 bytes (122%) of program storage space. Maximum is 4096 bytes.

Global variables use 84 bytes (32%) of dynamic memory, leaving 172 bytes for local variables. Maximum is 256 bytes.
Sketch too big; see http://www.arduino.cc/en/Guide/Troubleshooting#size for tips on reducing it.
Error compiling for board ATtiny25/45/85.


Guess I'm express ordering from Adafruit for ATtiny85 chips.  Will get the chips this weekend and give you an update.  Again I appreciate your assistance in this effort.

3Dtj
Title: Re: Programming Attiny45 with Uno. Problems finding good information.
Post by: 3Dtj on Feb 24, 2018, 05:27 pm
Received the ATtiny85 chips and no longer getting the error regarding capacity but I'm back to the earlier message stating the programmer is not responding.

Code: [Select]

Sketch uses 5000 bytes (61%) of program storage space. Maximum is 8192 bytes.
Global variables use 84 bytes (16%) of dynamic memory, leaving 428 bytes for local variables. Maximum is 512 bytes.
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x03
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x03
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x03
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x03
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x03
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x03
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x03
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x03
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x03
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x03
Problem uploading to board.  See http://www.arduino.cc/en/Guide/Troubleshooting#upload for suggestions.


I did upload the sketch to the UNO before using the Ardurino as ISP to the ATtiny85.  I'll check connections some more but unclear the issue.
Title: Re: Programming Attiny45 with Uno. Problems finding good information.
Post by: 3Dtj on Feb 25, 2018, 03:44 pm
For some reason now I'm unable to upload the simple Blink sketch to the ATtiny45 even though it was working last week.  I did update the Arduino IDE to 1.8.5 thus unclear if that impacted the ability to use the previous core to send code to ATtiny45.  Any suggestions?  I'm going back and removing/reinstalling the cores for the ATtiny45 again.
Title: Re: Programming Attiny45 with Uno. Problems finding good information.
Post by: pert on Feb 25, 2018, 03:46 pm
Please do this:
Title: Re: Programming Attiny45 with Uno. Problems finding good information.
Post by: 3Dtj on Feb 25, 2018, 08:19 pm
I corrected the one minor oversight and was able to upload Blink sketch to the ATtiny85 and confirmed the LED blinks using only the ATtiny85.  When I attempt to upload the LoRa sketch, I receive the following error:

Code: [Select]


C:\Users\TBK\Documents\Arduino\LoRaDuplex_Reciever_mini\LoRaDuplex_Reciever_mini.ino:9:18: fatal error: LoRa.h: No such file or directory

 #include <LoRa.h>

                  ^

compilation terminated.

exit status 1
Error compiling for board ATtiny25/45/85.
Title: Re: Programming Attiny45 with Uno. Problems finding good information.
Post by: 3Dtj on Feb 25, 2018, 08:27 pm
My bad.  Had accidentally moved library folder. 

File compiled to ATtiny85!!!   Now checking to see if it actually works with the LoRa chip.