Go Down

Topic: Error when compiling LCD I2c with Due (Read 281 times) previous topic - next topic

Nic-lovin

Hi,

Does anybody succeeded compiling and using an LCD using I2c with the Due, Arduino 1.5.8?
I just can't make it work. I have tried a few libraries, but it just never compiles.

I could post the errors I get, but before, does anybody use a specific library?

Thanks in advance.

floresta

You need to correctly install the library in order for it to work.  --> http://arduino.cc/en/Guide/Libraries

If you are using the library written by 'fmalpartida' then you will also have to delete, move, or rename the library that comes with the IDE.

Don

Nic-lovin

Hi,

I know how to install a library, the point is just that they don't work.
I've tried the one by fmalpartida, but I get errors... So I wonder if anyone succeeded by using another one.

Thanks.

floresta

Quote
I know how to install a library, the point is just that they don't work.
Well lots of others seem to be able to get the fmalpartida library to work, and they usually prefer it to the alternatives.  

If you are sure that you are installing the library correctly then possibly there is some idiosyncrasy concerning the 'due'.

Don

Nic-lovin

#4
Feb 02, 2015, 08:45 pm Last Edit: Feb 02, 2015, 08:54 pm by Nic-lovin
This is what I think too, and this is why I ask what library is used by others...

Error got with fmalpartida' library:
Code: [Select]
Arduino: 1.5.8 (Linux), Board: "Arduino Due (Programming Port)"

In file included from /home/nic-lovin/Documents/Programmation/arduino/arduino-1.5.8/libraries/LiquidCrystal_I2C/LiquidCrystal_SR1W.cpp:35:0:
/home/nic-lovin/Documents/Programmation/arduino/arduino-1.5.8/libraries/LiquidCrystal_I2C/LiquidCrystal_SR1W.cpp: In member function 'uint8_t LiquidCrystal_SR1W::clearSR()':
/home/nic-lovin/Documents/Programmation/arduino/arduino-1.5.8/libraries/LiquidCrystal_I2C/LiquidCrystal_SR1W.cpp:77:24: error: invalid type argument of unary '*' (have 'fio_register {aka unsigned char}')
  SR1W_ATOMIC_WRITE_LOW(srRegister, srMask);
                        ^
/home/nic-lovin/Documents/Programmation/arduino/arduino-1.5.8/libraries/LiquidCrystal_I2C/LiquidCrystal_SR1W.h:293:79: note: in definition of macro 'SR1W_ATOMIC_WRITE_LOW'
 #define SR1W_ATOMIC_WRITE_LOW(reg, mask) ATOMIC_BLOCK(ATOMIC_RESTORESTATE) { *reg &= ~mask; }
                                                                               ^
/home/nic-lovin/Documents/Programmation/arduino/arduino-1.5.8/libraries/LiquidCrystal_I2C/LiquidCrystal_SR1W.cpp:86:22: error: invalid type argument of unary '*' (have 'fio_register {aka unsigned char}')
   fio_bit reg_val = *srRegister;
                      ^
/home/nic-lovin/Documents/Programmation/arduino/arduino-1.5.8/libraries/LiquidCrystal_I2C/LiquidCrystal_SR1W.cpp:95:5: error: invalid type argument of unary '*' (have 'fio_register {aka unsigned char}')
    *srRegister = bit_high;
     ^
/home/nic-lovin/Documents/Programmation/arduino/arduino-1.5.8/libraries/LiquidCrystal_I2C/LiquidCrystal_SR1W.cpp:96:5: error: invalid type argument of unary '*' (have 'fio_register {aka unsigned char}')
    *srRegister = bit_low;
     ^
/home/nic-lovin/Documents/Programmation/arduino/arduino-1.5.8/libraries/LiquidCrystal_I2C/LiquidCrystal_SR1W.cpp:101:4: error: invalid type argument of unary '*' (have 'fio_register {aka unsigned char}')
   *srRegister = bit_high;
    ^
/home/nic-lovin/Documents/Programmation/arduino/arduino-1.5.8/libraries/LiquidCrystal_I2C/LiquidCrystal_SR1W.cpp: In member function 'uint8_t LiquidCrystal_SR1W::loadSR(uint8_t)':
/home/nic-lovin/Documents/Programmation/arduino/arduino-1.5.8/libraries/LiquidCrystal_I2C/LiquidCrystal_SR1W.cpp:139:24: error: invalid type argument of unary '*' (have 'fio_register {aka unsigned char}')
     fio_bit reg_val = *srRegister;
                        ^
/home/nic-lovin/Documents/Programmation/arduino/arduino-1.5.8/libraries/LiquidCrystal_I2C/LiquidCrystal_SR1W.cpp:144:6: error: invalid type argument of unary '*' (have 'fio_register {aka unsigned char}')
     *srRegister = bit_low;
      ^
/home/nic-lovin/Documents/Programmation/arduino/arduino-1.5.8/libraries/LiquidCrystal_I2C/LiquidCrystal_SR1W.cpp:145:6: error: invalid type argument of unary '*' (have 'fio_register {aka unsigned char}')
     *srRegister = bit_high;
      ^
In file included from /home/nic-lovin/Documents/Programmation/arduino/arduino-1.5.8/libraries/LiquidCrystal_I2C/LiquidCrystal_SR1W.cpp:35:0:
/home/nic-lovin/Documents/Programmation/arduino/arduino-1.5.8/libraries/LiquidCrystal_I2C/LiquidCrystal_SR1W.cpp:151:26: error: invalid type argument of unary '*' (have 'fio_register {aka unsigned char}')
    SR1W_ATOMIC_WRITE_LOW(srRegister, srMask);
                          ^
/home/nic-lovin/Documents/Programmation/arduino/arduino-1.5.8/libraries/LiquidCrystal_I2C/LiquidCrystal_SR1W.h:293:79: note: in definition of macro 'SR1W_ATOMIC_WRITE_LOW'
 #define SR1W_ATOMIC_WRITE_LOW(reg, mask) ATOMIC_BLOCK(ATOMIC_RESTORESTATE) { *reg &= ~mask; }
                                                                               ^
/home/nic-lovin/Documents/Programmation/arduino/arduino-1.5.8/libraries/LiquidCrystal_I2C/LiquidCrystal_SR1W.cpp:158:27: error: invalid type argument of unary '*' (have 'fio_register {aka unsigned char}')
    SR1W_ATOMIC_WRITE_HIGH(srRegister, srMask);
                           ^
/home/nic-lovin/Documents/Programmation/arduino/arduino-1.5.8/libraries/LiquidCrystal_I2C/LiquidCrystal_SR1W.h:294:80: note: in definition of macro 'SR1W_ATOMIC_WRITE_HIGH'
 #define SR1W_ATOMIC_WRITE_HIGH(reg, mask) ATOMIC_BLOCK(ATOMIC_RESTORESTATE) { *reg |= mask; }
                                                                                ^
Error compiling.

  This report would have more information with
  "Show verbose output during compilation"
  enabled in File > Preferences.


My code:
Code: [Select]

#include <Wire.h>
#include <LiquidCrystal_I2C.h>


void setup()
{
 
}

void loop()
{
}

bperrybap

fm's library does not work with DUE.
It isn't related to the IDE version.
Some of the optimized code and declarations are not properly falling back to
the slower arduino i/o routines when being built for the DUE.
The fixes are pretty minor but "as is" it will not work with DUE.

--- bill

Nic-lovin

Is there any alternative that has been tested and working then?
I'm very new with Arduino and I don't think I am able to fix libraries now...

bperrybap

I don't see the SR1W code in the latest official bundled download.
It is in the tree but I don't see it in the v1.2.1 download image.
What version/branch of the library are you using and did you get from fm's bitbucket site?

Also just noticed that fm has done a few updates perhaps in preparation of 1.2.2 release.

If you are using the official v1.2.1 and are having issues, then I'd suggest that you enter
a bug report on fm's site to ensure that it gets fixed.

--- bill

Nic-lovin

You can follow the discussion here:
https://bitbucket.org/fmalpartida/new-liquidcrystal/commits/c0432608719bae3cdf60b0cb428181d3#comment-1597134

I use 1.2.2. I tried using 1.2.1, I got errors too.

I don't want to sound rude, and as I am not anglophone, it might sound worse, but I just asked if somebody has successfully compiled any library to use I2C with LCD, and not how to use a library, nor which library exists nor that DUE has specific architecture... If I want to use a specific library, I will either post a topic about that specific library or go on the library website...
So my question is quite simple: If you use I2C with LCD on a DUE, how do you do this?

bperrybap

#9
Feb 03, 2015, 01:30 am Last Edit: Feb 03, 2015, 01:31 am by bperrybap
So here are brief answers to your EXACT questions:
- Yes I am able to compile the code for DUE.
(Have no idea how well it works since I don't own a DUE)
- I did it by fixing the code.


Since I'm sure you really wanting more information then you are actually asking for,
even though you did kind of slam us for trying to help you by providing
additional information and asking some questions,
Here is some additional information that you didn't ask for......


Like I said before, v2.2.1 of fm's library doesn't work "as is" on DUE.
There are a few small issues that are easily fixed.
It is also looking like in v2.2.2 the BV define issue has been fixed but then
other portions of the library like the SR1W code will not compile because
other parts of the library still need a few small tweaks, again very easy to do.

In order to get fm's library to compile, you will have to go in and fix it.
It isn't rocket science and the fixes are quite minimal.

If you are looking for somebody to do the work for you then here goes:
Start with v2.2.1 since it doesn't include the SR1W code and make these changes:
Add this:
Code: [Select]
#ifndef __AVR__
#undef digitalPinToTimer
#define digitalPinToTimer(_p) NOT_ON_TIMER
#endif

to LiquidCrystal.cpp just after the #include statements

Then add this:
Code: [Select]
#ifndef _BV
#define _BV(bit) (1 << bit)
#endif


to FastIO.h
Just above the #include <pins_arduino.h>

That should get it compiling.
The hack above for digitalPinToTimer will get it working but dimming on the
4bit interface not work even when a backlight pin that supports PWM  is used.
There are more changes that have to made in order to get dimming and
the SR1W code working.


NOTE:
I have a hd44780 library package with interface sub libraries that will include i2c i/o expander support for
several interfaces including both pcf8574 and MCP23008 based boards.
It also includes, auto detection tools, diagnostics,
performance measuring tools, and examples for all the API functions.
However, unfortunately, at this point in time it isn't ready for release.

I worked with the Arduino team developers to help resolve some of these DUE vs non DUE
PWM issues like you see in fm's library and they made
some changes to the 1.5x code base that allows libraries to have a portable way to
detect PWM support.
The library code changes are minimal and allow the code to work on 1.x as well as 1.5x

--- bill

germancorrea

ok I was able to compile but If I am using SCL1 and SDA1 I added extern TwoWire Wire1 but now it doesn`t compile I get this error when I am using

lcd.init;
lcd.init;


C:\Program Files (x86)\Arduino\libraries\LiquidCrystal_I2C/LiquidCrystal_I2C.h:154:9: error: 'int LiquidCrystal_I2C::init()' is private

    int  init();

         ^

Any idea to solve that

bperrybap

ok I was able to compile but If I am using SCL1 and SDA1 I added extern TwoWire Wire1 but now it doesn`t compile I get this error when I am using

lcd.init;
lcd.init;


C:\Program Files (x86)\Arduino\libraries\LiquidCrystal_I2C/LiquidCrystal_I2C.h:154:9: error: 'int LiquidCrystal_I2C::init()' is private

    int  init();

         ^

Any idea to solve that

Code: [Select]
lcd.init;
has two issues.
- it is not valid C/C++ code.
- when using fm's library the sketch never calls init() as it is private internal library function.
User sketches call begin()

The fm's i2c lcd library code uses routines in I2CIO.cpp to do the i2c transmission.
The I2CIO code is hard coded to use the Wire object for all i2c communication.
Using something other that the default i2c interface will require modifying fm's library code in I2CIO.cpp
since there is no way to allow the sketch to indicate a preferred i2c object for transmission.

--- bill

Go Up