RetroBSD

2.11BSD operating system for microcontrollers
It is currently Tue Sep 22, 2020 1:04 pm

All times are UTC




Post new topic Reply to topic  [ 23 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: Sun Nov 01, 2015 5:17 am 
Committer
User avatar

Joined: Wed Oct 10, 2012 11:01 pm
Posts: 1081
Location: Sunnyvale, CA
I've reworked the TFT LCD driver, and extended it with a support for Novatek NT35702 and Ilitek ILI9341 chips (in addition to Sitronix ST7781). The chip is automatically detected by the driver at startup. The chip specific code moved to separate source files, like gpanel-ili9341.c, gpanel-nt35702.c and gpanel-st7781.c. Now it's easy to add any new chip of this kind.


Top
 Profile  
 
PostPosted: Sun Nov 01, 2015 6:33 am 
Contributor

Joined: Mon Nov 12, 2012 1:34 pm
Posts: 1092
Hi Serge,

I still want html5 support :).

Just gotta say it :) :).

Lots of fun.

I am right now looking at WiFire board from Digilent as an MZ...EF board?

Will one of LiteBSD versions just run on it? Your comments please!

Wiz


Top
 Profile  
 
PostPosted: Sun Nov 01, 2015 6:42 am 
Committer
User avatar

Joined: Wed Oct 10, 2012 11:01 pm
Posts: 1081
Location: Sunnyvale, CA
Hi Wiz,
wiz wrote:
I am right now looking at WiFire board from Digilent as an MZ...EF board?
Will one of LiteBSD versions just run on it? Your comments please!

WiFire is a perfect board for LiteBSD. Last revision has MZ EF processor installed. LiteBSD binaries foe this board are already available. You can always download the latest version from the autobuild page: http://litebsd.org/wiki/autobuild.php.

--Serge


Top
 Profile  
 
PostPosted: Sun Nov 01, 2015 10:48 am 
Contributor

Joined: Mon Nov 12, 2012 1:34 pm
Posts: 1092
Hi Serge,

Thanks. I notice some of their docs still talk about MZ...EC on this board, so I will be sure and specify EF.

warm regards,
Wiz


Top
 Profile  
 
PostPosted: Sun Nov 01, 2015 5:36 pm 
Contributor
User avatar

Joined: Thu Nov 08, 2012 7:04 am
Posts: 2401
Location: Rapa Nui
The ili9341 driver is the 8bit parallel one. Do you plan an SPI as well?

_________________
Pukao Hats Cleaning Services Ltd.


Top
 Profile  
 
PostPosted: Sat Nov 21, 2015 1:17 am 

Joined: Sat Nov 21, 2015 1:14 am
Posts: 9
Playing off what Pito said, would it be possible to use a ILI9340 SPI display? I've been tinkering with a fubarino, and have so far not had much luck figuring how I would hook it up to use as the console. I'm specifically referring to this display:
https://www.adafruit.com/products/1480


Top
 Profile  
 
PostPosted: Thu Nov 26, 2015 8:02 am 
Committer
User avatar

Joined: Wed Oct 10, 2012 11:01 pm
Posts: 1081
Location: Sunnyvale, CA
Shaun_Floyd wrote:
Playing off what Pito said, would it be possible to use a ILI9340 SPI display? I've been tinkering with a fubarino, and have so far not had much luck figuring how I would hook it up to use as the console. I'm specifically referring to this display:
https://www.adafruit.com/products/1480

Yes, I have it in my near plans. I'm going to use a different display (http://www.adafruit.com/products/1651), but it should be possible to handle both ILI9141 and ILI9140 chips by the same driver.


Top
 Profile  
 
PostPosted: Thu Nov 26, 2015 4:06 pm 
Contributor
User avatar

Joined: Thu Nov 08, 2012 7:04 am
Posts: 2401
Location: Rapa Nui
SPI is essential. Most people will be using SPI with "none arduino layout" boards (ie. where they cannot plug a 8/16bit tft shield directly in).
Once upon a time I purchased 16bit tft display and I soon recognized be too lazy to mess with ~24 wires in order to display a text with a few graph. primitives :)
I've been using SPI displays only since then.
SPI is ok for most apps with retrobsd.. :)
With 25MHz SPI it might happen the analog clock will work over SPI fine :P

_________________
Pukao Hats Cleaning Services Ltd.


Top
 Profile  
 
PostPosted: Sat Nov 28, 2015 9:35 am 
Committer
User avatar

Joined: Wed Oct 10, 2012 11:01 pm
Posts: 1081
Location: Sunnyvale, CA
A beta version of driver for ILI9341 TFT display is ready: sys/pic32/gpanel-spi.c. I've tested it using chipKIT WF32 board and Adafruit 2.8" TFT Touch Shield for Arduino. The kernel configuration looks like:
Code:
device  sgpanel at spi2
                pins RD4,       # CS - Digital #10
                     RD3        # DC - Digital #9


Top
 Profile  
 
PostPosted: Wed Dec 02, 2015 9:08 am 

Joined: Sat Nov 21, 2015 1:14 am
Posts: 9
Checked out the spi drivers; thanks for the help. I edited the config file and ran kconfig. I'm still having a little trouble; I can't figure out where to hook up the spi clock pin from the display to the microcontroller (a fubarino in my case). Is this something that needs to be defined? I looked through the drivers and couldn't find any reference to a clock pin.


Top
 Profile  
 
PostPosted: Wed Dec 02, 2015 11:18 am 
Committer
User avatar

Joined: Thu Oct 11, 2012 8:45 am
Posts: 1801
Location: Room 217, Floor 8, Arm 8, Wheel S7, Mars Base Alpha 3
The Fubarino SD's pins are listed on their wiki:

https://github.com/fubarino/fubarino.gi ... n-Features

Including the SPI pins and which is the SPI clock pin (SCK) for each of the two channels. It's not something that can be defined, it's fixed in hardware and which you choose depends on which SPI channel you are using.

_________________
Why not visit my shop? http://majenko.co.uk/catalog
Universal IDE: http://uecide.org
"I was trying to find out if it was possible to only eat one Jaffa Cake. I had to abandon the experiment because I ran out of Jaffa Cakes".


Top
 Profile  
 
PostPosted: Wed Dec 02, 2015 3:49 pm 
Contributor
User avatar

Joined: Thu Nov 08, 2012 7:04 am
Posts: 2401
Location: Rapa Nui
Enclosed the Fubarino SD (pic32MX795F512H) schematics v 1.5.
Mind there is a 1.4 version of the schematics available, which is a little bit different (pic32MX4..).


Attachments:
Fubarino_SD_v15_sch.pdf [118.51 KiB]
Downloaded 596 times

_________________
Pukao Hats Cleaning Services Ltd.
Top
 Profile  
 
PostPosted: Wed Dec 02, 2015 5:57 pm 
Contributor
User avatar

Joined: Thu Nov 08, 2012 7:04 am
Posts: 2401
Location: Rapa Nui
As a first step I've wired my lovely 2.2inch tft (the most common one http://www.ebay.com/itm/2-2-inch-2-2-SP ... SwT5tWPHt7 ) to Fubarino SD as follows:

Code:
SPI3 used

PIC     TFT PINS        FUBARINO SD
--------------------------------------
RD1     SCK             7
RD2     SDO             8
RD3     SDI             9

RE0     CS              16
RE1     DC              17

        LED             to 5V via 390ohm resistor (or a smaller value for more brightness)
        RES             RST
        VCC             Vout (5V)
        GND             GND


The Config:
Code:
# SPI ports
controller      spi2                           # SD card
controller      spi3                           # Pins RD1, RD2, RD3

# microSD card
device          sd0     at spi2 pin RG9        # select pin
options         "SD_FAST_MHZ=24"               # speed XX MHz

# TFT 2.2in QVGA 240x320 SPI panel
device             sgpanel at spi3
                   pins RE0,          # CS
                   RE1                # DC


The welcome screen:
Code:
spi2: pins sdi=RG7/sdo=RG8/sck=RG6
spi3: pins sdi=RD2/sdo=RD3/sck=RD1
uart2: pins rx=RF4/tx=RF5, interrupts 40/41/42, console
sd0: port SPI2, pin cs=RG9
sgpanel: port SPI3, pins cs=RE0/dc=RE1
gpanel0: <Ilitek ILI9341> display 320x240
gpio1: portB, pins iiiiiiiiiiiiiiii


Speed at my 48MHz cpu (default 10MHz SPI):
Code:
# ./speed
Screen size 320 x 240.
Graphics speed:
  20920 pixels/second
    247 lines/second
     32 rectangles/second
    117 circles/second
    805 characters/second
#


IT WORKS !!
FANTASTIC !!
THANKS!!


PS: Speed at 24MHz SPI
Code:
# ./speed
Screen size 320 x 240.
Graphics speed:
  23923 pixels/second
    309 lines/second
     44 rectangles/second
    153 circles/second
    952 characters/second
#

It seems the SPI speed is not the bottleneck here (maybe the first time in retrobsd's history)
:) :) 8-) 8-) :ugeek: :ugeek:

Attachment:
tetris_SPI.JPG
tetris_SPI.JPG [ 131.1 KiB | Viewed 31107 times ]


PS: I think we need a separate RES pin for resetting the tft panel (even I am not happy about that). It seems to me we must be able to initialize the tft display anytime (ie when OS is up and running)..

_________________
Pukao Hats Cleaning Services Ltd.


Top
 Profile  
 
PostPosted: Sun Dec 06, 2015 3:55 am 

Joined: Sat Nov 21, 2015 1:14 am
Posts: 9
Thanks for the response. Used your config modifications (Pito) and hooked it all up. I get this error. Could it be a TFT issue? Or something else? Do I need to tell the pic which driver to use?


spi3: pins sdi=RD2/sdo=RD3/sck=RD1
uartusb: port USB, interrupt 45, console
uart2: pins rx=RF4/tx=RF5, interrupts 40/41/42
sd0: port SPI2, pin cs=RG9
sgpanel: port SPI3, pins cs=RE0/dc=RE1
gpanel0: Unknown chip ID = 0xffffff


Top
 Profile  
 
PostPosted: Sun Dec 06, 2015 7:57 am 
Contributor
User avatar

Joined: Thu Nov 08, 2012 7:04 am
Posts: 2401
Location: Rapa Nui
1. What is your tft-panel chip like?? An ILI9341??
Quote:
The chip is automatically detected by the driver at startup.
There is only ILI9341 with SPI to offer yet..
PS: Serge added the 9341 detection 2d ago - see github - I am using an older revision. So maybe a bug if you have the 9341 there).

2. Double/Triple check the wiring (I messed with the wiring for 2hours, as usual :lol: :lol: )

3. Mind the current setup does the init of the tft-panel chip ONLY after the Reset button (on the fubarino) has been pressed.. When the display init is ok you will see a "BSD" on the display during retrobsd's boot.

PS: we need an "sgpanelinit" command and an RES signal for an init of the tftpanel anytime..
P.

_________________
Pukao Hats Cleaning Services Ltd.


Top
 Profile  
 
PostPosted: Mon Dec 07, 2015 12:45 am 

Joined: Sat Nov 21, 2015 1:14 am
Posts: 9
I've got a 2.8in ili9341 (linked it earlier in the thread). Just did a pull of the newest code; going to compile and see how it goes. I'm thinking I may just have a dud TFT; haven't gotten it to work with much else.

EDIT: Yup, used the newest github, still getting unknown chip ID. Going to try to get in touch with adafruit I guess.


Top
 Profile  
 
PostPosted: Mon Dec 07, 2015 7:25 am 
Contributor
User avatar

Joined: Thu Nov 08, 2012 7:04 am
Posts: 2401
Location: Rapa Nui
Quote:
I've got a 2.8in ili9341 (linked it earlier in the thread).
Your tft panel up there is listed ili9340 - thus it will not be recognized.. (the init reads the tft's ID out of the tft's chip)..
Btw, the difference is almost nothing, maybe two lines of code somewhere..
The latest github's gpanel-spi.c :
Code:
483     /* Identify the LCD controller chip. */
484     _chip_id = read_id();
485     switch (_chip_id) {
486     default:
487         /* Disable outputs. */
488         gpio_set_input(_dc);
489         gpio_set_input(cs);
490         printf("gpanel0: Unknown chip ID = 0x%04x\n", _chip_id);
491         return 0;
492
 
493     case 0x009341:
494         /* Ilitek ILI9341. */
495         ili9341_init_display(&hw);
496         break;
497     }
498     printf("gpanel0: <%s> display %ux%u\n", hw.name, gpanel_width, gpanel_height);
499     draw_logo();
500     return 1;
501 }

But it seems to me it could be an issue with your wiring. It reads the ID, and it shows 0xFFF..
It should return a number, ie. 0x009340.
And if you see the correct number you may try to add your chip:
Code:
493     case 0x009341:
494         /* Ilitek ILI9341. */
495         ili9341_init_display(&hw);
496         break;

     case 0x009340:
        /* Ilitek ILI9340. */
        ili9341_init_display(&hw);
         break;
...

PS: hopefully the ili9340 supports the undocumented command D9:
Code:
    /* Read ID4 from register #D3.
436      * Use undocumented command #D9 to get access to ID4. */

_________________
Pukao Hats Cleaning Services Ltd.


Top
 Profile  
 
PostPosted: Mon Dec 07, 2015 8:14 am 
Contributor
User avatar

Joined: Thu Nov 08, 2012 7:04 am
Posts: 2401
Location: Rapa Nui
Hmm :? , I think the switch(_chip_id) should be like (gpanel-spi.c):
Code:
    /* Identify the LCD controller chip. */

    _chip_id = read_id();

    switch (_chip_id) {

     case 0x009341:
         /* Ilitek ILI9341. */
        ili9341_init_display(&hw);
        break;

     case 0x009340:
         /* Ilitek ILI9340. */
        ili9341_init_display(&hw);    // maybe it works
        break;

     default:
         /* Disable outputs. */
        gpio_set_input(_dc);
        gpio_set_input(cs);
        printf("gpanel0: Unknown chip ID = 0x%04x\n", _chip_id);
        return 0;
     }

     printf("gpanel0: <%s> display %ux%u\n", hw.name, gpanel_width, gpanel_height);
     draw_logo();
     return 1;
 }

Try it with this code change, it may work (provided the ili9340 supports the d9 command).

_________________
Pukao Hats Cleaning Services Ltd.


Top
 Profile  
 
PostPosted: Tue Dec 08, 2015 6:32 pm 

Joined: Sat Nov 21, 2015 1:14 am
Posts: 9
I made a typo; I hadn't linked the display, that was an older TFT I was working with. The new TFT I'm using is here: https://www.adafruit.com/products/1770

EDIT: I edited the gpanel driver so it just automatically inited the 9341, and so now it says ili9341 in the boot screen, but still nothing on the tft. I had adafruit overnight me a new tft, and it still doesn't work.

EDIT2: My ineptitude preceeds me; I hadn't closed some pins on the back in order to make the display SPI instead of parallel. I've got it working now; however, is there a way to make the display do the console? Also, I can't get any of the demoes to work; at least the ones in gpanel. Keep getting the error "Cannot open /dev/tft0" or "/dev/tft0: Device not configured".

EDIT3: OK, I've got the demo code to work now. My new goal is to figure out how to get the it to act as the console now.


Top
 Profile  
 
PostPosted: Wed Dec 09, 2015 1:41 pm 

Joined: Mon Nov 24, 2014 1:07 pm
Posts: 58
Hi all,

This is absolutely brilliant work! I've hooked up my el cheapo 2.8 inch tft touchscreen and added a check for id 0xc0c0 so it's configured the same as the ST7781 and my screen now works a treat. I modified the fubarino Config file, and after realizing that the port b flags weren't right it's all working as expected.

The display was an ebay parallel interface tft that I only got working last month on an arduino. I couldn't find the right datasheet for it and after trying to force it to be used like the ST7781 it started working. It's the mcufriend display and looks exactly like the one in the first post of Serge's.

Flappy bird game works well. But tetris is a different story, the game grid is off the screen and I can't rotate the blocks. Something not quite right there but hey the rest is great. Keep up the good work Serge, Matt and all involved!!

Have fun, Dan


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 23 posts ]  Go to page 1, 2  Next

All times are UTC


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
cron




Powered by phpBB® Forum Software © phpBB Group

BSD Daemon used with permission