Go Down

Topic: "Serial" errors while compiling sketch for Tiny84 (Read 2814 times) previous topic - next topic

Jasz

Hi,

Can anyone help, pls :)

I am trying to compile a sketch for the Tiny84 and receive "Serial" errors while doing so.

My set-up is:
  • Linux Mint 16 Laptop.
  • Arduino Uno R3 (as ISP)
  • Arduino IDE v1.6.4 - latest version.
  • Jeelib libraries - latest version.
  • OneWire libraries - latest version.
  • DallasTemperature - latest version.

Using the Arduino as ISP I have managed to figure out how to upload the Blinky sketch to the Tiny84. I know it works because when I power up the Tiny84 and place an LED between the Tiny pin and GND the LED blinks.

However when I try to compile the Tiny84 with the DS18B20 sketch shown here:
Nathan's "TinyTX_DS18B20.ino" sketch
.. I get the following Serial errors ..

Quote
Build options changed, rebuilding all
In file included from /arduino-1.6.4/libraries/jeelib/JeeLib.h:17:0,
                 from USBISP-tiny84_DS18B20.ino:16:
/arduino-1.6.4/libraries/jeelib/Ports.h:713:49: error: 'Serial' was not declared in this scope
     InputParser (byte size, Commands*, Stream& =Serial);
                                                                                                ^
/arduino-1.6.4/libraries/jeelib/Ports.h:714:60: error: 'Serial' was not declared in this scope
     InputParser (byte* buf, byte size, Commands*, Stream& =Serial);
                                                                                                                  ^
Error compiling.
The error seems to be something to do with Serial, which I don't think the Tiny84 has?
(Not sure what it's capability with serial is).

I have tried some changes to
  • OneWire.h
  • pins_arduino.h
  • Ports.h

as seen in some posts but I am now in a bit of a muddle.
Perhaps I did not understand the posts or the library /IDE software has changed making previous posted recommended changes - to get it working - redundant.

I don't really know C programming language.

Can anyone help pls with configuration changes to make and where? :) :) :)

DrAzzy

It's a problem with the jeelib library.

They clearly intended to support the Tiny84/85, as they have defines checking for them.... but then they do this:

Code: [Select]

    InputParser (byte size, Commands*, Stream& =Serial);
    InputParser (byte* buf, byte size, Commands*, Stream& =Serial);
ATtiny core for 841+1634+828 and x313/x4/x5/x61/x7/x8 series Board Manager:
http://drazzy.com/package_drazzy.com_index.json
ATtiny breakouts (some assembled), mosfets and awesome prototyping board in my store http://tindie.com/stores/DrAzzy

Jasz

Hi DrAzzy

Thank you for your reply. Thank you for the help, it is appreciated.

I have commented out the lines

Code: [Select]
InputParser (byte size, Commands*, Stream& =Serial);
InputParser (byte* buf, byte size, Commands*, Stream& =Serial);


form Ports.h in the Jeelib library.

This has reduced the compile error to

Quote
Build options changed, rebuilding all
/arduino-1.6.4/libraries/jeelib/RF12.cpp: In function 'void rf12_configDump()':
/arduino-1.6.4/libraries/jeelib/RF12.cpp:752:5: error: 'Serial' was not declared in this scope
     Serial.print(' ');
     ^
Error compiling
I then tried deleting the following section in RF12.cpp

Quote
/// @details
/// This replaces rf12_config(0), to be called after rf12_configSilent(). Can be
/// used to avoid pulling in the Serial port code in cases where it's not used.

void rf12_configDump () {
    uint8_t nodeId = eeprom_read_byte(RF12_EEPROM_ADDR);
    uint8_t flags = eeprom_read_byte(RF12_EEPROM_ADDR + 3);
    uint16_t freq = eeprom_read_word((uint16_t*) (RF12_EEPROM_ADDR + 4));

    // " A i1 g178 @ 868 MHz "
    Serial.print(' ');
    Serial.print((char) ('@' + (nodeId & RF12_HDR_MASK)));
    Serial.print(" i");
    Serial.print(nodeId & RF12_HDR_MASK);
    if (flags & 0x04)
        Serial.print('*');
    Serial.print(" g");
    Serial.print(eeprom_read_byte(RF12_EEPROM_ADDR + 1));
    Serial.print(" @ ");
    uint8_t band = nodeId >> 6;
    Serial.print(band == RF12_433MHZ ? 433 :
                 band == RF12_868MHZ ? 868 :
                 band == RF12_915MHZ ? 915 : 0);
    Serial.print(" MHz");
    if (flags & 0x04) {
        Serial.print(" c1");
    }
    if (freq != 1600) {
        Serial.print(" o");
        Serial.print(freq);
    }
    if (flags & 0x08) {
        Serial.print(" q1");
    }
    if (flags & 0x03) {
        Serial.print(" x");
        Serial.print(flags & 0x03);
    }
which only increased the number of errors.

I have also tried using "SoftwareSerial" in the sketch without success.

Thanks for all your help. It's appreciated.

:) :)

DrAzzy

IMO, you should talk to the jeelib people, because they CLEARLY INTENDED TO SUPPORT TINY84/85 - like there are #ifdefs elsewhere in the same files looking for 84 and 85...

Just commenting out the offending lines is not going to be successful, because those lines weren't just there for looks, they did something (I have no idea what, frankly - that library is complicated). The library authors are better placed to provide insight or solution here.
ATtiny core for 841+1634+828 and x313/x4/x5/x61/x7/x8 series Board Manager:
http://drazzy.com/package_drazzy.com_index.json
ATtiny breakouts (some assembled), mosfets and awesome prototyping board in my store http://tindie.com/stores/DrAzzy

Jasz

Thanks DrAzzy

I've asked the question on the jeelibs forum ... 
:)

.. and done some reading on the jeelabs.org web.
A search there on "tiny84" and nothing springs out.
I think they call their tiny84 "board+chip+RFM12B" the "Jeenode micro."

.. anyways ..

I've also downloaded and tried:
Arduino IDE 1.6.5 Hourly Build 2015/06/08 4:31.
There was some suggestion (while reading) on jeelabs.org that the latest Arduino IDE supplied better built in support for the tiny84. However I get exactly same errors as described above while using this.

Are there any other tiny forums out there?

:) :)


Jasz

Hi Coding Badly,

Thank you kindly for your help :)

I downloaded your tiny core, Coding Badly's Tiny Core.
Using this tiny core the "Serial" errors have gone away.

These have been replaced by new errors as follows:

Quote
In file included from /arduino-1.6.4/libraries/OneWire/OneWire.h:7:0,
                 from USBISP-tiny84_DS18B20.ino:14:
USBISP-tiny84_DS18B20.ino: In function 'long int readVcc()':
USBISP-tiny84_DS18B20:95: error: 'PRR' was not declared in this scope
/arduino-1.6.4/hardware/arduino/avr/cores/arduino/Arduino.h:105:32: note: in definition of macro 'bitClear'
 #define bitClear(value, bit) ((value) &= ~(1UL << (bit)))
                                ^
USBISP-tiny84_DS18B20.ino: In function 'void setup()':
USBISP-tiny84_DS18B20:121: error: 'PRR' was not declared in this scope
'PRR' was not declared in this scope
If I then comment out the 4 below lines, in Nathan's "TinyTX_DS18B20.ino" sketch, all errors go away, and it compiles! (The lines are shown in the order in which I removed them for successful compilation, top line first).
I doubt removing these lines is desirable.
It looks like the lines are to do with battery power saving(?), though I'm not sure how they connect with any other lines.

Code: [Select]
line 121:  PRR = bit(PRTIM1); // only keep timer 0 going
 
line 123:  ADCSRA &= ~ bit(ADEN); bitSet(PRR, PRADC); // Disable the ADC to save power

line 95: bitClear(PRR, PRADC); ADCSRA |= bit(ADEN); // Enable the ADC

line 109: ADCSRA &= ~ bit(ADEN); bitSet(PRR, PRADC); // Disable the ADC to save power


I tried this with both
  • Arduino IDE 1.6.4 and
  • Arduino IDE 1.6.5 Hourly Build 2015/06/08 4:31.

and I get exactly the same outcomes with both.

Any further ideas? :)

Coding Badly


I just downloaded the sketch and the three libraries then verified using ATtiny84 @ 8 MHz...

Quote
Sketch uses 7,082 bytes (86%) of program storage space. Maximum is 8,192 bytes.
Global variables use 173 bytes (33%) of dynamic memory, leaving 339 bytes for local variables. Maximum is 512 bytes.
I suspect you have something not installed correctly or introduced a problem in trying to get the sketch to compile.  The simplest solution is very likely to remove everything and start over.


Jasz

Hi Coding Badly,

Thank you for all your help :)

Here is what I did to get it going :

Refreshed the libraries as suggested using the following libraries:
I have been specific above because there are some versions of each library.

Firstly I used used this tiny core
https://arduino-tiny.googlecode.com/files/arduino-tiny-0150-0020.zip
and it compiles successfully, though I got the following errors

Quote
Done Compiling.
Third-party platform.txt does not define compiler.path. Please report this to the third-party hardware maintainer.
Build options changed, rebuilding all

Sketch uses 7,082 bytes (86%) of program storage space. Maximum is 8,192 bytes.
Global variables use 173 bytes (33%) of dynamic memory, leaving 339 bytes for local variables. Maximum is 512 bytes.
I do not know if the error "Third-party platform.txt does not define compiler.path" has any impact?

Secondly I used this tiny core
https://github.com/Coding-Badly/TinyCore1/archive/master.zip
and got no errors as shown below
Quote
Done Compiling.
Build options changed, rebuilding all

Sketch uses 7,082 bytes (86%) of program storage space. Maximum is 8,192 bytes.
Global variables use 173 bytes (33%) of dynamic memory, leaving 339 bytes for local variables. Maximum is 512 bytes.
It compiles successfully.

Thanks for the help and the tiny core :)

The tiny84 chip is now 'flashed' with Nathan's DS18B20 sketch.

Now to figure out how to use this Tiny84+RFM12B as TX, and the RFM12B+Rasp-Pi as RX.
After that the journey will move to RFM69CW, which has slightly higher power and encryption.

Now that the sketch compiles I will sit and have a think as to why getting this going was not easy. In hindsight it's always easy once you are there (what ever 'it' is). You (thats me in the third person) think : why was that so difficult. I think there are and were many variables, and as you suggest, a small (untoward) tweak had been introduced into the libraries, hence the need to have a refresh.

Thanks again :)

Go Up