Brion Sohn
Well-known member
So I have tried a ton or stuff, Seaching the web, looking on hear at similar topics and I probably am just Missing something completely but I cannot get even the basic "Hello World" u8G2 example to work OK Display.
So here is the basic sketch.
I have got this to work on a normal Arduino Uno and an Arduino Pro Micro but for some reason I am either missing the Pins needed or something I need to do within the sketch to get the SPI Communication to work:
I have the display hooked up in the following way to the Teensy LC:
Basically I know the code works with the Arduinos (UNO and ProMicro) and have used all the same hookups to the MOSI (SDA), SCK, and chosen pins on those and it worked.. So I am either missing something in connection OR I have to change something in the CODE/Library that I have just not been able to find reference too online and I am clueless to know what it is.
Any help to get this working with the Teensy LC would be greatly appreciated as that is the processor of choice which I want to use.
So here is the basic sketch.
Code:
/*
HelloWorld.ino
Universal 8bit Graphics Library (https://github.com/olikraus/u8g2/)
Copyright (c) 2016, olikraus@gmail.com
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or other
materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <Arduino.h>
#include <U8g2lib.h>
#ifdef U8X8_HAVE_HW_SPI
#include <SPI.h>
#endif
#ifdef U8X8_HAVE_HW_I2C
#include <Wire.h>
#endif
/*
U8g2lib Example Overview:
Frame Buffer Examples: clearBuffer/sendBuffer. Fast, but may not work with all Arduino boards because of RAM consumption
Page Buffer Examples: firstPage/nextPage. Less RAM usage, should work with all Arduino boards.
U8x8 Text Only Example: No RAM usage, direct communication with display controller. No graphics, 8x8 Text only.
*/
// Please UNCOMMENT one of the contructor lines below
// U8g2 Contructor List (Frame Buffer)
// The complete list is available here: https://github.com/olikraus/u8g2/wiki/u8g2setupcpp
// Please update the pin numbers according to your setup. Use U8X8_PIN_NONE if the reset pin is not connected
/// MANY DISPLAY TYPES DELETED
//U8G2_UC1609_SLG19264_F_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8);
U8G2_UC1609_SLG19264_F_4W_HW_SPI u8g2(U8G2_R0, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8);
// End of constructor list
void setup(void) {
u8g2.begin();
}
void loop(void) {
u8g2.clearBuffer(); // clear the internal memory
u8g2.setFont(u8g2_font_ncenB08_tr); // choose a suitable font
u8g2.drawStr(0,10,"Hello World!"); // write something to the internal memory
u8g2.sendBuffer(); // transfer internal memory to the display
delay(1000);
}
I have got this to work on a normal Arduino Uno and an Arduino Pro Micro but for some reason I am either missing the Pins needed or something I need to do within the sketch to get the SPI Communication to work:
I have the display hooked up in the following way to the Teensy LC:
Code:
Display K and A Backlight LED is connected and On
Teensy GND --> 19264-05 v3.2 GND
Teensy 3V --> 19264-05 v3.2 VDD
Teensy Pin 13 --> 19264-05 v3.2 SCK
Teensy Pin 11 --> 19264-05 v3.2 SDA
Teensy Pin 10 --> 19264-05 v3.2 CS (chosen pin standard position)
Teensy Pin 9 --> 19264-05 v3.2 CD (chosen pin standard position)
Teensy Pin 8 --> 19264-05 v3.2 RST (chosen pin standard position)
Basically I know the code works with the Arduinos (UNO and ProMicro) and have used all the same hookups to the MOSI (SDA), SCK, and chosen pins on those and it worked.. So I am either missing something in connection OR I have to change something in the CODE/Library that I have just not been able to find reference too online and I am clueless to know what it is.
Any help to get this working with the Teensy LC would be greatly appreciated as that is the processor of choice which I want to use.