[Home] [Downloads] [Search] [Help/forum]


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  Forum
. -> [Folder]  Problems
. . -> [Subject]  I2C GLCD on MKR board?

I2C GLCD on MKR board?

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page


Posted by Cambo   (5 posts)  [Biography] 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.
[Go to top] top

Posted by Nick Gammon   Australia  (23,006 posts)  [Biography] 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.

Template:Arduino Please post Arduino-related questions to the Arduino Forum or to StackExchange: Arduino. This saves splitting questions and answers between this forum and the Arduino ones.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Cambo   (5 posts)  [Biography] 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
[Go to top] top

Posted by Cambo   (5 posts)  [Biography] 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.
[Go to top] top

Posted by Nick Gammon   Australia  (23,006 posts)  [Biography] 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
[Go to top] top

Posted by Cambo   (5 posts)  [Biography] 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).
[Go to top] top

Posted by Cambo   (5 posts)  [Biography] 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 ();

}
[Go to top] 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.


16,664 views.

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at HostDash]