Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Entire forum
➜ Forum
➜ Problems
➜ I2C GLCD on MKR board?
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Cambo
(5 posts) Bio
|
Date
| Fri 08 Apr 2022 01:37 PM (UTC) Amended on Fri 08 Apr 2022 01:39 PM (UTC) by Cambo
|
Message
| Hi Nick,
Your GLCD I2C hardware and library (http://www.gammon.com.au/lcd) work great for me and I've been using them for some years now, thank you. I'm keen to get the code working on the MKR SAMD boards and whilst the code compiles OK it doesn't work and I can't really see why - would you be up for givung me a pointer as to which parts of the library I should be looking at to get this working? Cheers. | Top |
|
Posted by
| Nick Gammon
Australia (23,120 posts) Bio
Forum Administrator |
Date
| Reply #1 on Sat 09 Apr 2022 01:56 AM (UTC) |
Message
| I have virtually no experience with the SAMD boards, so I can't help you, sorry.
I suggest you ask on the Arduino Forum or Arduino Stack Exchange as per the boilerplate below.
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Cambo
(5 posts) Bio
|
Date
| Reply #2 on Wed 13 Apr 2022 08:50 AM (UTC) |
Message
| Hi Nick,
Thanks for getting back to me, appreciated.
Kind regards | Top |
|
Posted by
| Cambo
(5 posts) Bio
|
Date
| Reply #3 on Thu 14 Apr 2022 09:59 AM (UTC) |
Message
| PS, for anyone else follwoing along.... the issue comes from the first call of Wire.endTransmission() in LCD.begin() which crashes the MCU - when I find the solution I will post the fix. | Top |
|
Posted by
| Nick Gammon
Australia (23,120 posts) Bio
Forum Administrator |
Date
| Reply #4 on Sat 16 Apr 2022 07:57 AM (UTC) |
Message
| On the AVR boards the endTransmission is where the work is actually done, so perhaps there is a clash between that and initialising the LCD. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Cambo
(5 posts) Bio
|
Date
| Reply #5 on Sun 17 Apr 2022 01:55 PM (UTC) |
Message
| Thanks Nick, I've tested some more and found that this error occurs regardless of whether the LCD is connected or not. I've also found that your I2C Scanner code returns a valid device address as per below. This is leading me to think that whatever is being sent in the first bunch of LCD.begin() data is throwing the issue. I've tried changing the I2C clock speed from 10000 to 1000000 with other speeds in-between but no change is observed.... I will try to figure out 'what' is being sent in that first packet of data.
I2C scanner. Scanning ...
Found address: 32 (0x20)
Found address: 64 (0x40)
Found address: 104 (0x68)
Found address: 110 (0x6E)
Done.
Found 4 device(s). | Top |
|
Posted by
| Cambo
(5 posts) Bio
|
Date
| Reply #6 on Tue 07 Jun 2022 01:10 PM (UTC) |
Message
| Hi Nick,
A quick update with a little progress. I can get the backlight LED to blink on and off with the code below so the hardware and basic operation is working on the ARM.... now just have to work out why the demo doesn't work.
#include <Wire.h>
void setup()
{
Wire.begin(); // join i2c bus (address optional for master)
}
void loop()
{
Wire.beginTransmission (0x20); // expander has I2C address 0x20
Wire.write (0x00); // register 0 is the I/O direction register for Port A
Wire.write (0x00); // 0x00 for all pins to output mode, 0xFF for all pins to input mode
Wire.endTransmission ();
Wire.beginTransmission (0x20); // expander has I2C address 0x20
Wire.write (0x12); // register 0x12 is the I/O port "A"
Wire.write (0x56); // what to put on that port
Wire.endTransmission ();
Wire.beginTransmission (0x20); // expander has I2C address 0x20
Wire.write (0x12); // register 0x12 is the I/O port "A"
Wire.write (0x3F); // 0x3F turns the backlight on.
Wire.endTransmission ();
delay (1000);
Wire.beginTransmission (0x20); // expander has I2C address 0x20
Wire.write (0x12); // register 0x12 is the I/O port "A"
Wire.write (0x3E); // 0x3E turns the backlight off.
Wire.endTransmission ();
} | Top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
18,790 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top