Do anybody has any experience in using I2C LCD with Nano Every, either 16x2 or 20x4? I have tried every library available, i.e. LiquidCrystal_I2C from DfRobot, bitbucket.org/fmalpartida/new-liquidcrystal and library hd44780. All failed! No character printed. My I2C LCDs are based on HD44780 and PCA8574 I/O expander for I2C and I tried all the addresses from 0x20 to 0x27. I tried to find the address by using SoftI2CMaster and also failed. The serial monitor did not print anything. Both LCDs work with UNO by using LiquidCrystal_I2C from DfRobot
Please help. Tqvm
Post the text output from I2CexpDiag (as text not a graphic image) and a photo of what the LCD is showing.
For completeness and for the others, post links to the Arduino board and LCD modules you are using.
--- bill
Did you modify I2CexpDiag to get it to compile?
I just installed the Nano Every board package and tried to build I2CexpDiag and it fails to build due to an issue locating libraries.
There seems to be a Anrduino IDE issue and/or megaAVR board package.
For some reason the define INPUT_PULLUP is not being defined during IDE library searching but is defined during actual sketch compilation.
The IDE library searching is failing because this core does not define INPUT_PULLUP.
megaAVR core uses a pinMode enum for the pinMode modes
INPUT, OUTPUT, INPUT_PULLUP, INPUT_PULLDOWN
While an enum is actually better than simple defines, it breaks the I2CExpDiag code which expects a define.
I haven't figured out how the compile works, as it should be failing as well as INPUT_PULLUP should still be undefined unless somewhere it is defined like this:
#define INPUT_PULLUP INPUT_PULLUP
--- bill
ok, so INPUT_PULLUP is never defined by the megaAVR core.
The compile for I2CexpDiag works because of the enum INPUT_PULLUP.
I may put in a work around hd44780, but I'll post a bug/issue to the megaAVR core to create defines for the old symbols as it really needs to be fixed there.
This will map the standard pinMode defines to their new enums so that everything "just works", old and new code.
--- bill
So it looks like there are quite a few compatibility issues in the megaAVR core and some of these go back nearly a year:
I don't think the type checking change that was added was that beneficial and it broke lots of code.
Although I think it is funny, since I have been slammed for years on this forum when pointing out poor code that assumed that functions like digitalWrite() could take a value of 0/1 or a boolean instead of properly using HIGH and LOW.
Some changes are just now being made to try to address these.
So far I'm not impressed with Nano Every h/w or s/w - there seems to be quite a few issues in both.
--- bill
Below are the outputs from I2CexpDiag
- I2CLCD 16x2 with Every
Serial Initialized
I2CexpDiag - i2c LCD i/o expander backpack diagnostic tool
hd44780 lib version: 1.1.1
Reported Arduino Revision: 1.8.12
CPU ARCH: AVR - F_CPU: 16000000
SDA digital pin: 22
SCL digital pin: 23
Checking for required external I2C pull-up on SDA - YES
Checking for required external I2C pull-up on SCL - YES
Checking for I2C pins shorted together - Not Shorted
Scanning i2c bus for devices..
- I2CLCD 20X4 with Every
Serial Initialized
I2CexpDiag - i2c LCD i/o expander backpack diagnostic tool
hd44780 lib version: 1.1.1
Reported Arduino Revision: 1.8.12
CPU ARCH: AVR - F_CPU: 16000000
SDA digital pin: 22
SCL digital pin: 23
Checking for required external I2C pull-up on SDA - YES
Checking for required external I2C pull-up on SCL - YES
Checking for I2C pins shorted together - Not Shorted
Scanning i2c bus for devices..
i2c device found at address 0x20
Total I2C devices found: 1
Scanning i2c bus for all lcd displays
- I2CLCD 16x2 with UNO
Serial Initialized
I2CexpDiag - i2c LCD i/o expander backpack diagnostic tool
hd44780 lib version: 1.1.1
Reported Arduino Revision: 1.8.12
CPU ARCH: AVR - F_CPU: 16000000
SDA digital pin: 18 A4
SCL digital pin: 19 A5
Checking for required external I2C pull-up on SDA - YES
Checking for required external I2C pull-up on SCL - YES
Checking for I2C pins shorted together - Not Shorted
Scanning i2c bus for devices..
i2c device found at address 0x20
Total I2C devices found: 1
Scanning i2c bus for all lcd displays
LCD at address: 0x20 | config: P01245673L | R/W control: Yes
Total LCD devices found: 1
LCD Display Memory Test
Display: 0
Walking 1s data test: PASSED
Address line test: PASSED
Each working display should have its backlight on
and be displaying its #, address, and config information
If all pixels are on, or no pixels are showing, but backlight is on, try adjusting contrast pot
If backlight is off, wait for next test
Blinking backlight test: to verify BL level autodetection
If backlight is mostly off but
you briefly see "BL Off" on display with backlight on,
then the library autodetected incorrect BL level
and the library cannot autoconfigure the device
Displaying 'uptime' on all displays
- I2CLCD 20x4 with UNO
Serial Initialized
I2CexpDiag - i2c LCD i/o expander backpack diagnostic tool
hd44780 lib version: 1.1.1
Reported Arduino Revision: 1.8.12
CPU ARCH: AVR - F_CPU: 16000000
SDA digital pin: 18 A4
SCL digital pin: 19 A5
Checking for required external I2C pull-up on SDA - YES
Checking for required external I2C pull-up on SCL - YES
Checking for I2C pins shorted together - Not Shorted
Scanning i2c bus for devices..
i2c device found at address 0x20
Total I2C devices found: 1
Scanning i2c bus for all lcd displays
LCD at address: 0x20 | config: P01245673L | R/W control: Yes
Total LCD devices found: 1
LCD Display Memory Test
Display: 0
Walking 1s data test: PASSED
Address line test: PASSED
Each working display should have its backlight on
and be displaying its #, address, and config information
If all pixels are on, or no pixels are showing, but backlight is on, try adjusting contrast pot
If backlight is off, wait for next test
Blinking backlight test: to verify BL level autodetection
If backlight is mostly off but
you briefly see "BL Off" on display with backlight on,
then the library autodetected incorrect BL level
and the library cannot autoconfigure the device
Displaying 'uptime' on all displays
Sorry I do not know how to paste picture of the above LCD. It works both with UNO with with words "LCD:0 BL Off
0x20, P01245673L"
I'll ask again:
Did you modify I2CexpDiag to get it to compile?
because, I was unable to get get I2CexpDiag to build without making modifications.
But to fix it, you will have to modify a file in the megaAVR core, not I2CexpDiag.
From the diagnostic output, it appears to be working on the UNO, but the i2c scan is failing/locking up on the Every board.
On the UNO the LCD will be displaying a lot more than:
t works both with UNO with with words "LCD:0 BL Off
0x20, P01245673L"
--- bill
For Nano Every, I have to comment the line 171 to 173, i.e
//#ifndef INPUT_PULLUP
//#error Sketch requires INPUT_PULLUP which is not supported by this IDE/core version
//#endif
but for UNO
mohdrais:
For Nano Every, I have to comment the line 171 to 173, i.e//#ifndef INPUT_PULLUP
//#error Sketch requires INPUT_PULLUP which is not supported by this IDE/core version
//#endif
but for UNO
That won't work with the current I2CexpDiag code.
You have to edit a megaAVR core file to put the defines back in.
Did you read the github issue I linked to?
You must modify the Common.h header file down in the megaCore as I noted in the issue.
--- bill
The I2CexpDiag code has been updated such that it should build on the megaAVR core even when the megaAVR core does not have the INPUT_PULLUP define.
It is available in the 1.2.0 hd44780 library release.
--- bill
Has this issue been resolved?
It is still not resolved. I have tested it on UNO and Nano Every for I2C LCD 2x16 and I2C LCD 4X20. Below are the images obtained from I2CexpDiag. For UNO, it gave the same results for 2X16 and 4X20 but not for Nano Every. For 2X16, it gave results up to "Scanning i2c bus for devices...". I waited for several minutes for it to finish scanning i2c bus but nothing happened whereas for 4X20, it only gave reults up to "Scanning i2c bus for all lcd displays (4 max)" only.
Please copy-paste from your Serial Terminal.
No one wants to download PNG images that you can't read in a text editor.
Photos are useful to show physical wiring. Unwise for text output.
16x2 and 20x4 seem to work fine on my Nano-Every.
So it would be very helpful to paste the I2CexpDiag output.
Please quote the MEGAAVR core version that you are using.
My MEGAAVR Wire.h library is stored here:
C:\Users\David Prentice\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.6\libraries\Wire
Your MEGAAVR should be in a similar place on your PC.
If you enable "verbose compilation" from File->Preferences you will see library locations, core versions, ...
There is a lot of unwanted dross in a "verbose compile" but you can easily copy-paste the "libraries used" and "memory used" lines to your message.
David.
David, I think in this case the images instead of pasting in the I2CexpDiag text is not really an issue.
For this particular case, either is ok with me.
From the diag output it looks like for the Uno board the pin mapping was properly detected.
Is the backlight working properly? It looks like it might be backwards
i.e. the backlight control was detected as low but from looking at the schematic it looks like it should be high.
For the Every, there seems to be some Wire library issues.
The Wire library seems to be hanging.
On the 20x4 display it hung during LCD backpack probing for auto detection.
On the 16x2 display it hung during i2c slave address probing.
It could be a h/w issue like bad/poor connections or wires between the LCD backpack and the Every board.
It could be due to an issue with single byte reads as I've seen some reported issues with that.
hd44780_I2Cexp does single byte reads during auto detection.
But a byte read issue wouldn't explain the hang during slave address probing.
Does a simple i2c address scanner work on the Every board with both LCD devices?
Unfortunately the Mega core Wire library doesn't come with one, so you'll have to pull one over from somewhere else.
Are the LCD devices working on the Every board if you use the Library provided by the vendor?
If it doesn't work with their library, then it is likely a core issue and there may not be a solution to work around it.
--- bill