Remustgx / u8glib

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

Teensy 3.0\3.1 Hardware SPI Support #256

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Constructor for HW SPI 
U8GLIB_SSD1306_128X64_2X display(SS, 9, 14);
vs for SW which works
U8GLIB_SSD1306_128X64_2X display(SLK, MOSI, SS, 9, 14);

What is the expected output? What do you see instead?
Blank Display, works in software mode but conflicts with SD Card on SPI bus.

What version of the product are you using? On what operating system?
Windows 7 X64 with Arduino IDE 1.0.5 with Teensy addon.

Please provide any additional information below.

Original issue reported on code.google.com by blackspa...@gmail.com on 22 Apr 2014 at 2:32

GoogleCodeExporter commented 8 years ago
Not sure how to support this as it is difficult for me to test. Precondition is 
to use different chip signal lines for both devices.
Is it Teensy 3.x? Currently there is no HW support for Teensy 3.x

Original comment by olikr...@gmail.com on 22 Apr 2014 at 5:08

GoogleCodeExporter commented 8 years ago
I am using different CS pins. I understand that is it hard to test and not 
supported. Maybe you can point me to the function I can try and work on to get 
it to work. I had it working with the Adafruit lib modified for hardware SPI.

I am working with a PCB so currently can't make any changes to hardware till 
the next hardware revision.

Thanks for anything you can help with.

Original comment by blackspa...@gmail.com on 22 Apr 2014 at 5:15

GoogleCodeExporter commented 8 years ago
you need to implement your own "com" procedure. Someone else had done a nice 
description on this:
http://blog.bastelhalde.de/?p=759

Original comment by olikr...@gmail.com on 22 Apr 2014 at 5:36

GoogleCodeExporter commented 8 years ago
Awesome, I will try and get it to work then. Let you know how it goes.

Original comment by blackspa...@gmail.com on 22 Apr 2014 at 7:27

GoogleCodeExporter commented 8 years ago
Does the Arduino version of the library support adding your own stub or is it 
only the ARM version? Do you think the ARM version will still working with the 
Arduino IDE? I am trying to keep using the Arduino IDE so the device is easily 
hackable by others. 

Thanks.

Original comment by blackspa...@gmail.com on 23 Apr 2014 at 4:39

GoogleCodeExporter commented 8 years ago
The arm version does not include the C++ interface. So it might be difficult 
for the Arduino users.
On the other side, there is a generic C++ constructor, which allows you to 
specify the com interface:
U8GLIB(u8g_dev_t *dev, u8g_com_fnptr com_fn)

Then, for the Arduino Users, this should be:
U8GLIB(u8g_dev_ssd1306_128x64_2x_sw_spi, my_com_fn)
where "my_com_fn" has to be supplied by you as described in the mentioned 
tutorial. Another good thing by using the arduino variant is, that you do not 
need to provide the delay procedures (these are already part of the arduino 
variant).

Original comment by olikr...@gmail.com on 23 Apr 2014 at 4:51

GoogleCodeExporter commented 8 years ago
Okay I have this mostly setup.

How do I specify the DC and reset pins, in the com interface?

So something like this?

U8GLIB(u8g_dev_ssd1306_128x64_2x_hw_spi, u8g_com_hw_spi_fn);

or is it sw_spi even if using hardware?

Also where do you define the object name? In my case display.

Original comment by blackspa...@gmail.com on 23 Apr 2014 at 5:28

GoogleCodeExporter commented 8 years ago
> How do I specify the DC and reset pins, in the com interface?
Your com procedure has to deal with these lines, so if you use fixed pins, then 
just use fixed bins in your com callback procedure. No need to specify them on 
the constructor.

> or is it sw_spi even if using hardware?
The device type does not matter. You can use u8g_dev_ssd1306_128x64_2x_hw_spi 
or u8g_dev_ssd1306_128x64_2x_sw_spi. Only your com procedure matters.

> Also where do you define the object name? In my case display.
Should be this:
U8GLIB display(u8g_dev_ssd1306_128x64_2x_hw_spi, u8g_com_hw_spi_fn);

Original comment by olikr...@gmail.com on 23 Apr 2014 at 9:32

GoogleCodeExporter commented 8 years ago
Thanks so much!!! I got it to work!! Now I just need to clean it up and make it 
more flexiable so anyone can use it. 

I will post on github once its ready.

Actually all it does is uses the Arduino SPI library which is installed by 
Teensy software so the same functions work.  Might be easy to get it to work on 
the core library. 

This post helped as well
http://forum.pjrc.com/threads/24357-u8glib-now-has-an-ARM-variant?p=46427

And looked the Adafruit library as well.

So does your library use the Arduino SPI library or direct port\registers?

Thanks.

Original comment by blackspa...@gmail.com on 24 Apr 2014 at 4:09

GoogleCodeExporter commented 8 years ago
Great.

Regarding HW SPI: I decided to to write directly to the uC registers. Now i 
know it had been a wrong devision. In ucglib (another more recent lib from me) 
i am using SPI fronm the IDE to be more portable.

Original comment by olikr...@gmail.com on 24 Apr 2014 at 4:42

GoogleCodeExporter commented 8 years ago
No problem, it was a good exercise, ;). Cool, I will have to check out the 
ucglib library. I have a Color LCD here. If you want I can test for you. Its a 
2.2in LCD with the iL9341 driver. Right now its connected to a Arduino UNO. I 
haven't had a chance to really play with it.

Original comment by blackspa...@gmail.com on 24 Apr 2014 at 5:06

GoogleCodeExporter commented 8 years ago
Yes, iL9341 is supported and standard SPI.h should work. In fact i learned a 
lot from U8glib and did a major cleanup of the internal interfaces for Ucglib.

Original comment by olikr...@gmail.com on 24 Apr 2014 at 8:08

GoogleCodeExporter commented 8 years ago
Ucglib is available here for download:
http://forum.arduino.cc/index.php?topic=222327.0
Or drop me an e-mail for the latest release.

Original comment by olikr...@gmail.com on 24 Apr 2014 at 8:11

GoogleCodeExporter commented 8 years ago
u8glib 2.x should use the Arduino SPI library instead of the AVR sub system.
will put this into "Milestone-Collect"
However i did not check if this request already exists.

Original comment by olikr...@gmail.com on 16 Jun 2014 at 7:20

GoogleCodeExporter commented 8 years ago
Any updates on the status of hardware SPI for the Teensy 3.0/3.1?

Original comment by lucas.be...@gmail.com on 3 Oct 2014 at 10:15

GoogleCodeExporter commented 8 years ago
It works great with the code stub that uses the Arduino\Teensy SPI library. 

Original comment by blackspa...@gmail.com on 3 Oct 2014 at 10:18

GoogleCodeExporter commented 8 years ago
Which code stub exactly, have you published any of your code to github yet (if 
not, could you)?

I'm currently trying to get an eBay SSD1306 128x64 OLED working with the Teensy 
3.1, but to no avail. I've got the display working on an Uno with u8glib, so I 
know the display works. Not sure if it's a voltage level thing (shouldn't be) 
or SPI speed thing.

Thanks

Original comment by lucas.be...@gmail.com on 5 Oct 2014 at 11:38

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
I'm currently using NHD-3.12-25664UMB3 Controller: SSD1322, 256x64 pixels BLUE 
graphic OLED display by New Haven with HW SPI on Teensy 3.0 in 16bit mode.
About 50 FPS ):

Thanks to Hoss from pjrc Teensy forum, he was able to adapt the Teensy 3 
hardware SPI code from Adafruit_ST7735 driver to work in U8G.

Here is the forum link:
page 3,post #52
http://forum.pjrc.com/threads/23445-Teensy-3-0-and-u8glib/page3

complete U8glib Arduino library folder containing U8G version 1.15 for 
Arduino/Teensy3.x including Hoss tweaks.
link: 
http://forum.pjrc.com/attachment.php?attachmentid=2033&d=1400770307

IMPORTANT NOTE: Needed for HW Spi on teensy 3.x with Hoss U8G modify Library, 
in you're code.
#include <SPI.h>

Chris O.

Original comment by diese...@netzero.net on 6 Oct 2014 at 3:52

GoogleCodeExporter commented 8 years ago
Thank you for the update.

Original comment by olikr...@gmail.com on 6 Oct 2014 at 6:52

GoogleCodeExporter commented 8 years ago
Hi, sorry for late reply.

Here is my add-on that I use with the Teensy 3.1

https://github.com/FriedCircuits/Ug8lib_Teensy

Works well since it is using the Teensy SPI library and therefore hardware SPI. 
Should work for any SPI display.

Remember most displays are 3.3v buy Teensy can handle 3.3v and is mostly 5v 
tolerant. 

Original comment by blackspa...@gmail.com on 6 Oct 2014 at 9:23