Black Lives Matter - Action and Equality. ... Adafruit is open and shipping.
0

Unexpected digital pin activity using RGB LCD shield
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Unexpected digital pin activity using RGB LCD shield

by jyelton_ncm on Tue Jan 07, 2020 6:00 pm

I am using this RGB LCD display with an Arduino Leonardo. It is working, but I cannot use digital pin 2 or 3 because they have some sort of activity that's not expected. Analog pins 4 & 5 are being used for I2C to communicate with the screen and buttons via an I2C expander. I was using digital pin 2 to provide steps to a stepper motor controller, and digital pin 3 to handle enable/disable of the controller. While I have enough free pins to abandon pins 2-3, I'd still like to know why these pins are being used (because I might need to use all of them at some point).

After setup(), the loop() continuously calls lcd.readButtons(). If I comment out this line, the digital IO activity stops.

The activity I presume is also communications, but these digital pins aren't connected to anything on the LCD shield. Here's a capture of it:

DS2_20201714485.png
Oscilloscope capture of digital pin output
DS2_20201714485.png (29.4 KiB) Viewed 80 times


Is there some way to stop these pins from being active while using the LCD shield?

jyelton_ncm
 
Posts: 3
Joined: Tue Dec 31, 2019 2:21 pm

Re: Unexpected digital pin activity using RGB LCD shield

by adafruit_support_bill on Tue Jan 07, 2020 6:27 pm

Analog pins 4 & 5 are being used for I2C to communicate with the screen and buttons via an I2C expander.

Not on your Leonardo. All communication with the shield is via the i2c bus. On an Arduino UNO the i2c bus is on analog pins 4 and 5. On the Leonardo that you are using, the i2c bus is on digital pins 2 and 3.

https://www.arduino.cc/en/Main/Arduino_BoardLeonardo

adafruit_support_bill
 
Posts: 78213
Joined: Sat Feb 07, 2009 10:11 am

Re: Unexpected digital pin activity using RGB LCD shield

by jyelton_ncm on Tue Jan 07, 2020 6:51 pm

Thank you for the response.

Are you sure? I've checked the schematics and drawing for the shield and it doesn't look like digital pins 0 through 13 are connected electrically to the shield at all.

Maybe something internal to the Leonardo where these pins are connected to each other for some reason? Looking at the Leonardo schematics, I do now see that D2 and D3 are going to SDA and SCL, which would explain a bit, but how does it communicate with the shield?

I checked the shield and pins 12 and 13 of the MCP23017 (SCL and SDA, respectively) are connected to A5 and A4 (also respectively). There was no continuity to the D2 and D3... So now I'm wondering how SDA and SCL get where they're supposed to. Sorry for the confusion!

jyelton_ncm
 
Posts: 3
Joined: Tue Dec 31, 2019 2:21 pm

Re: Unexpected digital pin activity using RGB LCD shield

by adafruit_support_bill on Tue Jan 07, 2020 8:05 pm

Those pins are cros-connected on the Leonardo board itself.

Different processors have different pin capabilities. And this caused a lot of shield compatibility issues when the Arduino team started branching out beyond the Atmega 168 and 328 processors used in the original Arduino boards.

Starting with Rev3, they added extra pins to the header footprint - including the SDA and SCL pins next to the AREF pin. All boards now have their i2c signals replicated on the SDA and SCL pins. They also have their SPI signals replicated on the 6-pin ICSP header. This allows all Rev-3 compatible shields to work with all Rev-3 compatible processor boards.

The RGB/LCD shield was designed at about the same time R3 was introduced. For forward compatibility with R3 boards, it has connections to the SDA and SCL pins. But, since there were very few R3 boards in actual use at the time, it still maintains the 'classic' Arduino UNO compatible connections to A4 and A5. You can see this on the shield schematic here: https://learn.adafruit.com/rgb-lcd-shie ... -print-8-2

adafruit_support_bill
 
Posts: 78213
Joined: Sat Feb 07, 2009 10:11 am

Re: Unexpected digital pin activity using RGB LCD shield

by jyelton_ncm on Tue Jan 07, 2020 8:25 pm

Thank you very much adafruit_support_bill. That explains it perfectly. Updates and backward compatibility always throw a spanner into the works, right?

jyelton_ncm
 
Posts: 3
Joined: Tue Dec 31, 2019 2:21 pm

Re: Unexpected digital pin activity using RGB LCD shield

by adafruit_support_bill on Tue Jan 07, 2020 9:10 pm

Yea, trying to maintain compatibility in a rapidly changing technology environment is always a bear.

adafruit_support_bill
 
Posts: 78213
Joined: Sat Feb 07, 2009 10:11 am

Please be positive and constructive with your questions and comments.