wsdutche / u8glib

Automatically exported from code.google.com/p/u8glib
Other
0 stars 0 forks source link

U8glib on Teensy++2.0 and SSD1351 1.5" Adafruit display #342

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Using teensy++2.0 and 1.5" ssd1351 from adafruit.
2. Wired up like this The numbers in parens are arduino pin numbers.
   B0 (20) -> OC (OLEDCS)
   B1 (21) -> CL (SCK)
   B2 (22) -> SI (MOSI)
   B5 (25) -> DC (A0?)
   B6 (26) -> R (Reset)
3. Using Arduino, with the following constructor, the graphics demo works great:
   U8GLIB_SSD1351_128X128_HICOLOR u8g( 20 /*cs*/, 25 /*dc*/, 26 /*rst*/);
  and
   U8GLIB_SSD1351_128X128GH_HICOLOR u8g( 20 /*cs*/, 25 /*dc*/, 26 /*rst*/);

   Using C and running the hello world example, the constructor:
   u8g_InitHWSPI(&u8g, &u8g_dev_ssd1351_128x128_hicolor_hw_spi, PN(1,1), PN(1,0), PN(1,6))
   only shows a very dim Hello World! and in reverse! And, I have to use different pin names. The CS and DC pins are PN(1,0) and PN(1,5) respectively. I have to use SCLK and OLEDCS (PN(1,1) and PN(1,0) resp) to get anything on the display at all. Using the pins used in Arduino sketches the display remains blank.

What is the expected output? What do you see instead?
Hello World! displayed on the OLED. What I see instead is a very dim Hello 
World! in reverse.

What version of the product are you using? On what operating system?
Latest release (1.17) on Linux Mint.

Please provide any additional information below.
I tried Ucglib and I can't get the C code to work (where do I tell the library 
what pins to use?), the Arduino code works great. Could it be that I need to 
close the jumper labeled BS0 below the microsd socket for 3 PIN SPI (vs the 
default 4 PIN SPI)? See image here 
http://www.adafruit.com/images/1200x900/1431-07.jpg 
And why does it work in Arduino C++ but not in C even when using the same 
constructor (the C++ constructor calls the C constructor).

Original issue reported on code.google.com by vibhor.c...@gmail.com on 13 May 2015 at 3:59

GoogleCodeExporter commented 8 years ago
What about
u8g_InitHWSPI(&u8g, &u8g_dev_ssd1351_128x128gh_hicolor_sw_spi, ... ?

Maybe also the setColor function has an issue...

Original comment by olikr...@gmail.com on 13 May 2015 at 11:03

GoogleCodeExporter commented 8 years ago
The GH variant of the constructor does nothing. And in the hello_world.c there 
is no setColor function. Here is the code:

//this is what I've changed.
u8g_InitHWSPI(&u8g, &u8g_dev_ssd1351_128x128gh_hicolor_hw_spi, PN(1,2), 
PN(1,1), PN(1,6));
void sys_init(void)
{
#if defined(__AVR__)
  /* select minimal prescaler (max system speed) */
  CLKPR = 0x80;
  CLKPR = 0x00;
#endif
}

void draw(void)
{
  u8g_SetFont(&u8g, u8g_font_6x10);
  u8g_DrawStr(&u8g, 0, 15, "Hello World!");
}

int main(void)
{
  sys_init();
  u8g_setup();

  for(;;)
  {  
    u8g_FirstPage(&u8g);
    do
    {
      draw();
    } while ( u8g_NextPage(&u8g) );
    u8g_Delay(100);
  }

}

After playing around more with this, I realize that the Hello World! in reverse 
is an artefact. Now I can only get it to display an all white screen or a white 
screen with lots of scattered colored pixels. I am attaching a photo of the 
screen. The vertical bands are just screen refreshes only visible to the 
camera. To us, the screen looks like the white parts with the random colored 
pixels.

I have checked ALL combinations of the pins, leaving the reset pin as PN(1,6):
1st:2nd pins
1,0:1,1
1,0:1,2
1,0:1,5
1,1:1,0
1,1:1,2
1,1:1,5
1,2:1,0
1,2:1,1
1,2:1,5
1,5:1,0
1,5:1,1
1,5:1,2

In a couple of cases I get the whole white screen, in the rest it's either the 
screen as I've attached or blank. And after everything I ran the arduino 
graphics_test and it ran just fine.

Original comment by vibhor.c...@gmail.com on 14 May 2015 at 12:36

Attachments:

GoogleCodeExporter commented 8 years ago
Well finally, i also can not say much here. U8glib does not really support 
Teensy. I added some contributed code for the Teensy, but i do not know whether 
this works or not and i can also not test this. Same is true for color 
displays. I tried to move all color related code to ucglib. However ucglib also 
does not support Teensy.

Original comment by olikr...@gmail.com on 14 May 2015 at 4:38

GoogleCodeExporter commented 8 years ago
I can help test teensy related code, if you'd like. Alternatively, I can try 
the C source of Ucglib, if you could tell me where the SPI pins are defined...

Original comment by vibhor.c...@gmail.com on 14 May 2015 at 7:03

GoogleCodeExporter commented 8 years ago
for ucglib: Standard SPI.h library is used here. SW SPI is also supported. Pins 
have to be provided as arguments of the constructor.

Original comment by olikr...@gmail.com on 16 May 2015 at 11:38