emulating a OLED display on a VGA and/or a LCD monitor

Post here all questions related to LibMaple core if you can't find a relevant section!
Post Reply
Y@@J
Posts: 57
Joined: Mon Sep 28, 2020 8:51 pm

emulating a OLED display on a VGA and/or a LCD monitor

Post by Y@@J »

Hi,

I'd like to build a ST7920 emulator that outputs a VGA or composite signal.
I found only one open sourced ST7920 emulator, on the BigTreeTech Git ; it outputs to a color TFT.

For now, it is mostly about reading data formatted for this ubicuitous 128x64 monochrome LCD. Unfortunately, it seems to me it was written with Cube. I tried Cube 2 times, I gave up 2 times ! I can't navigate in the sources and it is unreadable because of the quantity of files and folders (it's part of a whole controller with GUI and a dual display (Marlin + BTT GUI). Want to switch between Marlin and OctoPrint on a 7" touch LCD (HDMI, VGA, composite).

I'm looking for a starting point : tutorial + slave example (with the Roger's core), so I can learn about how to receive data from a SPI master (the printer motherboard, configured for the ST7920). Obviously, I've a logic analyser, a scope, Visual Micro (payed version), a ST Link (and another one that will soon become a Black Magic Probe). Only brains are missing : don't know how and where to start. Been stuck for 3 days reading on the web, learning nothing.
User avatar
fpiSTM
Posts: 1738
Joined: Wed Dec 11, 2019 7:11 pm
Answers: 91
Location: Le Mans
Contact:

Re: Looking for a suitable SPI slave example/tutorial

Post by fpiSTM »

I moved it to libmaple section.
For VGA, maybe you can look to: viewtopic.php?f=10&t=347&hilit=vga
Y@@J
Posts: 57
Joined: Mon Sep 28, 2020 8:51 pm

Re: Looking for a suitable SPI slave example/tutorial

Post by Y@@J »

Thanks for the answer. VGA will be the last task (but is the easier).
Meanwhile, reading more, I discovered the sources I found on Git are a PlatformIO project. Don't really like VSCode, but better than nothing. For some reason, I didnt see "platformio.ini" while exploring subdirectories. Forgot to link the repo whith the ST7920 emulator sources : https://github.com/bigtreetech/BIGTREET ... enFirmware.
stevestrong
Posts: 502
Joined: Fri Dec 27, 2019 4:53 pm
Answers: 8
Location: Munich, Germany
Contact:

Re: Looking for a suitable SPI slave example/tutorial

Post by stevestrong »

For libmaple (Roger's core) a good starting point would be the ILI9341 lib.

An alternative lib: https://www.youtube.com/watch?v=VxIWeGYEXvg
Y@@J
Posts: 57
Joined: Mon Sep 28, 2020 8:51 pm

Re: Looking for a suitable SPI slave example/tutorial

Post by Y@@J »

@stevestrong It is not about using a SPI display, it is about emulating it. It's a bit different : I want to receive and read data, build a bitmap and send it to VGA. I've a ILI9341 in the drawers, but I doubt it will help : a color TFT will give more complicated data.

This being said, you made me realize that it will be easier to use a MC as SPI master instead of the 3D printer motherboard : at least it is possible to create a still recognizable pattern. Will use u8g2 as I've been using it for a long time. [EDIT] success : after drawing one pixel in the buffer, I can see it in PulseView, following 13 cryptic command bytes I'm attempting to decode reading the datasheet !

I'm a long time subscriber of Alex's channel, and it's my prefered subscription ! I watched this video again yesterday while googling about the ST7920.
Y@@J
Posts: 57
Joined: Mon Sep 28, 2020 8:51 pm

Re: Looking for a suitable SPI slave example/tutorial

Post by Y@@J »

Most of the work is done.
Switching the u8glib driver from ST7920 to SSD1306 made things much easier (encoding is more straightforward). I can now display an image I capture from the SPI bus.
The SPI master runs u8glib (as does Marlin) on a Nano.
The SPI slave also runs on a Nano, as I couldn't get a STM32 working example for a SPI ISR.
Of course, all quick and dirty for now.

Also tested a Nano as VGA adapter : works fine for PAL / 128x64 on the 7" 52Pi display. But it will never be able to decode and display. Too slow, and not enough room for the ring buffer.

Seriously ? Nobody knows about a working Roger's Core SPI slave example ? I'm so near from displaying Marlin on a 7" touch screen along with OctoPrint... :(

I just need a SPI handler for the Roger's core... Or it will be one of the Due I have in the drawers... Or even code it for the RasPi.
Attachments
MarlinCapture.jpg
MarlinCapture.jpg (61.29 KiB) Viewed 5903 times
DSC_7837.JPG
DSC_7837.JPG (88.09 KiB) Viewed 5903 times
DSC_7833.JPG
DSC_7833.JPG (74.27 KiB) Viewed 5903 times
Y@@J
Posts: 57
Joined: Mon Sep 28, 2020 8:51 pm

Re: Looking for a suitable SPI slave example/tutorial

Post by Y@@J »

Many thanks !

2H45AM here, just flashed a bootloader on another BP, will test all this tomorrow...
I knew these threads. But when I read "DMA" and "SD card", I stopped reading immediately...

By the way I understood why the example I was trying to use (extremely simple) was "crashing" : it uses the read() function, and the header told me 1hour ago that this function is blocking until data is available... I thought there was an interrupt set at initialization time, and read() was accessing a buffer (as Serial does). As a result the loop() never turned.
stevestrong
Posts: 502
Joined: Fri Dec 27, 2019 4:53 pm
Answers: 8
Location: Munich, Germany
Contact:

Re: Looking for a suitable SPI slave example/tutorial

Post by stevestrong »

If you want to receive a lot of data or quickly over SP slave then DMA is indispensable, unless the MCU does not have anything else do except wait for data over SPI.
Using only interrupts without DMA does not avoid data loss at high SPI clock.
For DMA you may have a look to this thread (read through all the posts).
Y@@J
Posts: 57
Joined: Mon Sep 28, 2020 8:51 pm

Re: Looking for a suitable SPI slave example/tutorial

Post by Y@@J »

A SPI frame is 1048 bytes (8 * (3+128)) and 12ms long with a LPC1769. It is up to 3x better than what gives a 328P (25-30ms). But I have no idea of the SPI parameters. When idle, the refresh rate is one frame every half a second or so. It's difficult to evaluate when playing with the UI. I had up to 25 ips, but not 100% sure. It is realistic : 12ms = 83Hz.
Anyway, DMA is scarry ! Still reading the threads. Last time I played whith low level coding was... 1992 (with VGA graphics cards !)
And also got screenshots from the printer motherboard on the serial monitor !
Also learning about the "BluePill VGA project".
Post Reply

Return to “General discussion”