Project

General

Profile

Compiling Jeelib for Attiny84 with 16Mhz external clock

Added by aw2xcd over 4 years ago

Hi

When trying to compile for a clock higher than 10Mhz, the lines below from RFM12.cpp is causing “error: ‘SPCR’ was not declared in this scope”.
AFAIK the Tiny84 doesn’t have SPI and the code below is for Arduino etc.
So is it okay to comment it out or do I need to find and include #defind for tiny from somewhere?

// slow down to under 2.5 MHz
#if F_CPU > 10000000
    bitSet(SPCR, SPR0);
#endif

Replies (7)

RE: Compiling Jeelib for Attiny84 with 16Mhz external clock - Added by SabineT almost 3 years ago

I have the same error message:

/Users/bine/src/Arduino/libraries/jeelib/RF12.cpp: In function 'uint16_t rf12_xferSlow(uint16_t)':
/Users/bine/src/Arduino/libraries/jeelib/RF12.cpp:247:12: error: 'SPCR' was not declared in this scope
     bitSet(SPCR, SPR0);
            ^
/Users/bine/src/Arduino/hardware/tiny/avr/cores/tiny/wiring.h:152:30: note: in definition of macro 'bitSet'
 #define bitSet(value, bit) ((value) |= (1UL << (bit)))

                              ^~~~~
/Users/bine/src/Arduino/libraries/jeelib/RF12.cpp:247:18: error: 'SPR0' was not declared in this scope
     bitSet(SPCR, SPR0);
                  ^
/Users/bine/src/Arduino/hardware/tiny/avr/cores/tiny/wiring.h:152:49: note: in definition of macro 'bitSet'
 #define bitSet(value, bit) ((value) |= (1UL << (bit)))

                                                 ^~~

Is there a solution available?

Regards, Sabine

RE: Compiling Jeelib for Attiny84 with 16Mhz external clock - Added by SabineT almost 3 years ago

Thank you! With this tree I can compile the sketch!

Regards, Sabine

RE: Compiling Jeelib for Attiny84 with 16Mhz external clock - Added by JohnO almost 3 years ago

Great, I haven't tested with ATMega328, if you have time to do this I would welcome your result.

I will ask that this be integrated into the master branch if it works for the 328.

RE: Compiling Jeelib for Attiny84 with 16Mhz external clock - Added by SabineT almost 3 years ago

I have no ATMega328 at the moment, therefor I can not test it. Maybe someone else could do this.

BTW I found this https://github.com/SpenceKonde/ATTinyCore useful as Board definitions for the ATTiny's.

RE: Compiling Jeelib for Attiny84 with 16Mhz external clock - Added by JohnO almost 3 years ago

I also use the core you found when I do any T84 stuff. I usually use the 328 unit because of the bigger memories. What is your project, are you using Jeelabs hardware or
homebrew kit?

RE: Compiling Jeelib for Attiny84 with 16Mhz external clock - Added by SabineT almost 3 years ago

I will build some Temperature sensors from this site: https://nathan.chantrell.net/tinytx-wireless-sensor/
For this the T84 has enough memory. I ordered yesterday the T84 and the boards, at the moment I can only compile the sketch but not upload it ;-)

    (1-7/7)