gud icon indicating copy to clipboard operation
gud copied to clipboard

support for USB to SPI + TFT display ?

Open gadh opened this issue 2 years ago • 11 comments

Hi thanks for your great work and contribution. can i use your USB display driver in order to drive ILI9163 FBTFT display panel connected to USB-To-SPI bridge (FT232H for example) ? the data path for example might be : FB APP -> GUD -> USB2SPI -> ILI9163

gadh avatar Jun 20 '22 15:06 gadh

No, that won't work. The USB device needs to implement the GUD protocol.

Sadly the FT232H does only have a UART driver in the Linux kernel, otherwise you could have used the FT232H as a SPI controller in Linux. There have been attempts to fix that: https://yhbt.net/lore/all/20181205161718.7451d98f@crub/t/

You can use a Pi Zero instead of the FT232H, but you can't use fbtft since fbdev is not supported. The Pi image has this generic driver that should work with ILI9163: https://github.com/notro/gud/wiki/MIPI-DBI-SPI-driver. Some perf numbers: https://github.com/notro/gud/wiki/Performance#spi-panels-on-raspberry-pi

notro avatar Jun 20 '22 16:06 notro

thanks alot for your quick response. if you were to choose another chip , what would you choose ? i have AMD Ryzen CPU running RHEL 8.x , and i need to send images to the LCD screen.

gadh avatar Jun 20 '22 19:06 gadh

also, FTDI told me FT232H can be used as an SPI master. does it help ? can Linux recognize it as such ?

gadh avatar Jun 20 '22 19:06 gadh

if you were to choose another chip , what would you choose ?

This is the only USB-SPI device that I know of having Linux support, but it's very expensive: https://diolan.com/dln-2

I've implemented the dln2 protocol on the Raspberry Pi Pico, but it's limited to USB fullspeed so probably too slow for your display: https://github.com/notro/pico-usb-io-board

notro avatar Jun 21 '22 16:06 notro

also, FTDI told me FT232H can be used as an SPI master. does it help ? can Linux recognize it as such ?

No Linux support as I've already said:

Sadly the FT232H does only have a UART driver in the Linux kernel, otherwise you could have used the FT232H as a SPI controller in Linux.

notro avatar Jun 21 '22 16:06 notro

tnx alot ! my display is small (160x128 pixels) and my refresh rate is also not high so 1MBps is enough for me

gadh avatar Jun 21 '22 17:06 gadh

ive been maintaining out of tree spi and i2c drivers for the ftdi mpsse devices. It really should be someone smarter and more intelligent then me doing it but alas. I had troubles passing the platform data for fbtft so i brought back the fbtft kernel module that loads that info into my personal tree to get fbtft to work bit it works well if u can pass the pdata. github.com/bm16ton/ft2232-mpsse-i2c-spi-kern-drivers/

bm16ton avatar Oct 26 '22 16:10 bm16ton

thanks @bm16ton ! you helped me alot and i successfully activated the FT232H and used it !! (with ILI9163 tiny LCD display) although what i understand is that your code is using the new DRM infrastructure and not the FBTFT

gadh avatar Oct 26 '22 17:10 gadh

ha that is also compatible! Tho it didnt work/perform as well as fbtft on my laptop but that was several kernel versions ago. i believe i have all the configs for the fbtft commented out but still in place. Tho you would hafta bring back the fbrft_device loading driver or write the pdata and pass it in a way fbtft would like. i remember two different panel drivers for ili9341 having same compatible string screwing things up last time i tried the drm driver. If i can ever get my hands on a stm32 with usb-hs and good libopencm3 support (ie not h7) id like to write an open source usb to io firmware and drivers. currently have usb to i2c/adc/gpio_with_irq etc and kernel drivers but want faster bus for spi so i can use these tfts. Currently forest gumping my way thru bringing the libopencm3 gud firmware up to newest version of protocol on my f407. it enumerates, no errors, but color is all off and wonky, screen works fine before gud grabs it so guess im passing bad properties during usb setup. God this stuff is fun! Glad u found the mpsse stuff useful!

On Wed, 26 Oct 2022, 1:36 pm gadh, @.***> wrote:

thanks @bm16ton https://github.com/bm16ton ! you helped me alot and i successfully activated the FT232H and used it !! although what i understand is that your code is using the new DRM infrastructure and not the FBTFT

— Reply to this email directly, view it on GitHub https://github.com/notro/gud/issues/14#issuecomment-1292384087, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADAWMPYF4TLN2YQ7YF7E7M3WFFT3BANCNFSM5ZJHZQZQ . You are receiving this because you were mentioned.Message ID: @.***>

bm16ton avatar Oct 27 '22 01:10 bm16ton

thanks for all your efforts man could you please point out the differences in code between FBTFT and DRM methods ? currently the DRM is not stable enough. sometimes the "enable" function is not called but only the "probe" (of my 9163 LCD)

gadh avatar Oct 27 '22 06:10 gadh

oh certainly, in ft232h-int.c starting at line 1690 is where the spi slave devices are listed change the compatible line to the fbtft driver of your choice, if u want u can try adding a swnode for your device to see if fbtft accepts property_entrys these days i have one already line 1672 for ili9341 but never worked for me. then at line 1640 is where you add the gpio names etc currently set to csn and ce for nrf24 but dc, reset, maybe irq depending on your displays io requirements. recompile the driver and your done with the ftdi side. Next i up-ported fbtft_device, tho probly last time i did that was kernel 5.16 hopefully only minor cosmetic changes since then check github.com/bm16ton/linux-kernel under drivers/staging/fbtft i just brought the whole stack up cuz im lazy. then load the fbrft_device module with the correct parameters for your board and itll take off. Yeah i had issues with the drm driver only starting sometimes, plus a handful of other things popped up. I think i heard somewhere fbtft might get removed, i hope its just a rumor. Let me know if anything else i can do to help.

On Thu, 27 Oct 2022, 2:15 am gadh, @.***> wrote:

thanks for all your efforts man could you please point out the differences in code between FBTFT and DRM methods ? currently the DRM is not stable enough. sometimes the "enable" function is not called but only the "probe" (of my 9163 LCD)

— Reply to this email directly, view it on GitHub https://github.com/notro/gud/issues/14#issuecomment-1293043906, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADAWMPZSC2HM52DDPOI7YBDWFIMYDANCNFSM5ZJHZQZQ . You are receiving this because you were mentioned.Message ID: @.***>

bm16ton avatar Oct 27 '22 08:10 bm16ton