RGB LCD Shield (ID714)

by adafruitandy on Sat Oct 13, 2012 4:34 pm

Adafruit, could you "tweak" your RGB LCD Shield (I2C with tac buttons ) (ID714) libraries so it would work with the
Teensy 3.0 stamp that you also sell? This ARM stamp (Arduino software compatible) overclocks at 96 MHZ! :shock:
Right now, your sketch "hello world" displays nothing on the Teensy 3.0 but displays properly when used on an Arduino. :wink:

BTW... I was able to make your Macetech DS3231 "precision" I2C RTC, on the ported Adruino "wire" library for the Teensy 3.0 to work. Since you are using this same library, on your RGB shield, then I don't believe that this wire library is the problem. :wink:
adafruitandy
 
Posts: 17
Joined: Sat Oct 13, 2012 4:23 pm

Re: RGB LCD Shield (ID714)

by adafruit_support_bill on Sun Oct 14, 2012 5:30 am

The problem is most likely in the delayMicroseconds() function in the Arduino library. The shield library uses delayMicroseconds() to implement the timing constraints for sending commands to the LCD controller.
User avatar
adafruit_support_bill
 
Posts: 28240
Joined: Sat Feb 07, 2009 9:11 am

Re: RGB LCD Shield (ID714)

by adafruitandy on Sun Oct 14, 2012 7:30 am

Ok, let me know when you "tweak" the delay(microseconds) and get the LCD library to work with the Teensy 3.0. I will buy several more RGB LCD shields from Adafruit. :wink:
adafruitandy
 
Posts: 17
Joined: Sat Oct 13, 2012 4:23 pm

Re: RGB LCD Shield (ID714)

by adafruit_support_rick on Sun Oct 14, 2012 12:01 pm

Actually, if the problem is with the delay(microseconds) call, then it's not something that can be fixed in the adafruit library. It's a problem with the implementation of the delay function in the Teensy 3.0 runtime. You should contact PJRC with a bug report.
User avatar
adafruit_support_rick
 
Posts: 10978
Joined: Tue Mar 15, 2011 10:42 am
Location: Buffalo, NY

Re: RGB LCD Shield (ID714)

by paulstoffregen on Fri Oct 19, 2012 5:38 pm

Teensy 3.0 has a very accurate delayMicroseconds() function.

One possible issue is the pullup resistors on the SDA and SCL pins. Teensy 3.0 does not have the pullup resistors when using the Wire library, so you must connect pullup resistors to those pins. Arduino has weak pullups when using Wire. Unfortunately, this chip's I2C hardware doesn't allow the on-chip pullup resistors (apparaently that technically violates the I2C standard, even though it usually works and is very convenient).

I saw there's two 4.7K resistors on this board, but I couldn't find a PDF schematic to view, so I can't tell if those are on the SDA and SCL lines, or connected to something else.

I looked at the library code briefly. It looks like it should work. I suspect missing pullup resistors is probably the issue. If not, I'll investigate further.

On delayMicroseconds, there are 14 uses in this library. The code is a simplistic adapation of the normal LiquidCrystal library, with the digitalWrite calls replaced with the I/O expander. Most of the delayMicrosecond uses are for very short delays... which would be meaningful with normal digitalWrite, but they're far shorter than the 180+ microsecond overhead to update the MCP23017 chip. One of the uses is for 50000 us, which will work accurately on Teensy 3.0, but it's well over the documented maximum of 16383 us for Arduino!

http://arduino.cc/en/Reference/DelayMicroseconds
paulstoffregen
 
Posts: 272
Joined: Sun Oct 11, 2009 10:23 am
Location: Portland, Oregon, USA

Re: RGB LCD Shield (ID714)

by adafruit_support_rick on Sun Oct 21, 2012 3:59 am

@Paul -
- Yes, the two 4.7K resistors are pull-ups on SDA and SCL (see below for schematic).
- Thanks for pointing out the delayMicroseconds(50000) call.
- I don't see anything obviously wrong with the library, either. Inspired by your a.x = (xha << 8 | xla) >> 4; example on Kickstarter, I even did a quick scan for potential type-portability situations.

@adafruitandy -
How are you powering the shield?
Did you modify the "hello world" sketch at all?

RGB_LCD_SHIELD_schem.png
RGB_LCD_SHIELD_schem.png (27.76 KiB) Viewed 2144 times
User avatar
adafruit_support_rick
 
Posts: 10978
Joined: Tue Mar 15, 2011 10:42 am
Location: Buffalo, NY

Re: RGB LCD Shield (ID714)

by adafruitandy on Sun Oct 21, 2012 5:14 am

How are you powering the shield?


On my Arduino, I am using the +5vdc. (Works fine)
On the Teensy, I am using the power, from the USB (+5 VDC) Vin

Ut oh ... just realize the Teensy can power the shield at 5 VDC BUT the
Teensy 3.0 ARM is a 3 vdc device which means the I2C bus is running at 3.0 vdc logic ? :oops:
Probably need to obtain level converters OR Adafruit should design a RGB Display shield for 3 VDC and 5 VDC operation :shock:

Did you modify the "hello world" sketch at all?


Absolutely not. :!:

Since Adafruit sells both the Teensy 3.0 and the Adafruit RGB I2C shield then it should be only a matter
of Adafruit hooking your RGB display to the Teensy 3.0 and tweaking the libraries, you designed, for proper operation. :wink:
Please note: I do not have any expensive professional test equipment to root-out this problem. :wink:

Yes, the two 4.7K resistors are pull-ups on SDA and SCL


The way the construction states both I2C pullups are on the top side of the RGB shield. By installing (soldering) the 2x16 display
there is no more access to these resistors. :shock: The installation should require the user to install them on the back in case
there are modifications on the I2C bus. :wink: What happens if you need to remove these resistors?
Also, you really should provide schematics for your kits. :shock:
Last edited by adafruitandy on Sun Oct 21, 2012 5:33 am, edited 2 times in total.
adafruitandy
 
Posts: 17
Joined: Sat Oct 13, 2012 4:23 pm

Re: RGB LCD Shield (ID714)

by adafruit_support_rick on Sun Oct 21, 2012 5:24 am

adafruitandy wrote:On the Teensy, I am using the power, from the USB (+5 VDC) Vin

Okay, just wanted to make sure you weren't trying to run it off the 3.3 from the Teensy.

adafruitandy wrote:Since Adafruit sells both the Teensy 3.0 and the Adafruit RGB I2C shield then it should be only a matter
of Adafruit hooking your RGB display to the Teensy 3.0 and tweaking the libraries, you designed, for proper operation.

Yup, and we will do that (although I don't think it's necessarily a simple "tweak"). Teensy 3.0 supplies are limited - I don't have one here.
adafruitandy wrote:Please note: I do not have any expensive professional test equipment to root-out this problem.

We're not expecting you to do that. But it helps us to ask you to collect as much diagnostic information as you can
adafruitandy wrote:Also, you really should provide schematics for your kits.

Schematic and board layout are linked right on the tutorial page
User avatar
adafruit_support_rick
 
Posts: 10978
Joined: Tue Mar 15, 2011 10:42 am
Location: Buffalo, NY

Re: RGB LCD Shield (ID714)

by adafruitandy on Sun Oct 21, 2012 5:38 am

@driverblock
Did you read my "re-edited" post on the 3vdc I2C bus? :oops:
adafruitandy
 
Posts: 17
Joined: Sat Oct 13, 2012 4:23 pm

Re: RGB LCD Shield (ID714)

by adafruit_support_rick on Sun Oct 21, 2012 5:41 am

Aha! That would do it! Here ya go:
http://www.adafruit.com/products/757
User avatar
adafruit_support_rick
 
Posts: 10978
Joined: Tue Mar 15, 2011 10:42 am
Location: Buffalo, NY

Re: RGB LCD Shield (ID714)

by paulstoffregen on Sun Oct 21, 2012 6:04 am

It turns out I actually have this RGB LCD shield. Well, it wasn't fully soldered, but for the sake of testing I finished soldering it. Then I hooked it up to a Teensy 3.0.

It worked on the first try!
Attachments
adafruit_rgb_lcd_test.jpg
adafruit_rgb_lcd_test.jpg (98.88 KiB) Viewed 2136 times
paulstoffregen
 
Posts: 272
Joined: Sun Oct 11, 2009 10:23 am
Location: Portland, Oregon, USA

Re: RGB LCD Shield (ID714)

by paulstoffregen on Sun Oct 21, 2012 6:07 am

Hopefully this photo can help you troubleshoot the problem.

A level converter is technically the correct way to hook this up. But the 4.7k resistors don't inject a huge current to the pins, so it's not a big deal.

As you can see from the photo, it does indeed work. I did not edit any code at all.
paulstoffregen
 
Posts: 272
Joined: Sun Oct 11, 2009 10:23 am
Location: Portland, Oregon, USA

Re: RGB LCD Shield (ID714)

by adafruit_support_rick on Sun Oct 21, 2012 6:53 am

Curiouser and curiouser…
Thanks, Paul!

@adafruitandy
Does your setup look like this?
User avatar
adafruit_support_rick
 
Posts: 10978
Joined: Tue Mar 15, 2011 10:42 am
Location: Buffalo, NY

Re: RGB LCD Shield (ID714)

by adafruitandy on Sun Oct 21, 2012 10:09 am

Does your setup look like this?


Yes, exactly :D

driverblock and paulstoffregen thanks for your help! :D
It is nice conversing with knowledgeable support other than
the ones, that I have encountered at, "Sparky Hqtrs in Boulder, Co

I just reduced the I2C bus just down to only the display (without using level converters) and now the
RGB shield LCD display works with no library modifications necessary on the Teensy 3.0.

To say that the Arduino library "ports" work flawslessy on the Teensy ARM 3.0 at 24, 48 and 96 MHz is an extreme understatement! 8)

BTW ...I think I would still need proper level conversion to run at the high "overclocked" speed of 96 Mhz and with other I2C bus modules? :wink:
adafruitandy
 
Posts: 17
Joined: Sat Oct 13, 2012 4:23 pm

Re: RGB LCD Shield (ID714)

by adafruit_support_rick on Sun Oct 21, 2012 12:55 pm

I2C busses are independently clocked. The system clock rate does not determine the bus speed (apart from, of course, forcing an upper limit).

I don't know what the Teensy 3.0 I2C is clocked at, but a lot of I2C client devices have a top limit of 400KHz. If I'm remembering correctly, the ATMega 328 and 32U4 can run I2C at 400KHz. It's entirely possible that the Teensy 3.0 runs I2C at the exactly the same speed as a Uno or Leonardo.
User avatar
adafruit_support_rick
 
Posts: 10978
Joined: Tue Mar 15, 2011 10:42 am
Location: Buffalo, NY