uLisp-esp32 VGA Mini Computer


#1

I build another uLisp Mini Computer, this time it uses VGA output and a PS/2 keyboard,
using the very impressive library ‘FabGl’ from Fabrizio Di Vittorio and his
Loopback Terminal example (-> https://github.com/fdivitto/FabGL).

I used the TTGO VGA32 board (you can get the board at aliexpress or banggood (and probably others) for around 10-15 US$), but any ESP32 rev.1 board with a few resistors added should work. A circuit diagram is included in the repository of the FabGl library.

A screen resolution of 640x240 pixels is used, giving 80x25 characters for the terminal.
uLisp’s workspace size is 5081 lisp cells with this configuration.
With the ESP32-WROVER modules (4MB PSRAM) a higher resolution of 640x350 (maybe even higher)
should be possible when using my LargeWorkspace flag, but I haven’t tested this yet.

Here are some pictures of my uLisp-3.0a version supporting the VGA & PS2 keyboard,
I used my PC screen and a mini PS/2 keyboard:


Running (tak 18 12 6) needs 4189ms with this configuration, which is only about 1% slower than running it with uLisp-3.0a without VGA support.

Building uLisp 3.0a with FabGl support:

You can download the uLisp version from my github-page at https://github.com/Kaef/ulisp-esp.
Install the FabGl library with the arduino library manager and configure uLisp to
use FabGl (see defines around line 28-45 of ulisp-3.0a-esp.ino: comment out
the definitions ESP_WROVER_KIT, PS2_KEYBOARD and LARGE_WORKSPACE and define USE_FABGL).

Have fun!


#2

I died and woke up in heaven - it’s '80 again! But better - we have flat screens and uLisp instead of DOS :D This is awesome!


#3

Hi Kaef,

This is awesome. Thinking of building this !
Great work !


#4

Hi Kaef ,

I’m a bit confused about which esp32 boards I can use ?

Regards,
Ronny


#5

Hi Ronny,

I’m happy that you are interested in building this.
In general you can use any ESP32 board, the VGA output only requires 5 resistors (for 8 color mode) or 8 resistors for 64 color mode (I didn’t test to change colors from uLisp, but because terminal escape sequences are needed this should be easily possible). Two additional resistors are required for the PS/2 keyboard. You can find a circuit plan in the FabGl documentation on GitHub or maybe in the VGA32 board description at your reseller.
For my first test I used the ESP-VGA32 board, which has all necessary connectors for vga and keyoard. Unfortunately adding a sd-card to this board (to save uLisp code and images) is rather difficult, because the IOs are not lead out. Therefore I want to use a board with sd-card support and probably 4 MB PSRAM, I think the TTGO-T8 board should be fine. The changes need to be make to uLisp are minimal: changing some GPIO definitions and change the FabGl VGA setup call (if 8 color mode or other GPIO lines used). I have a T8 on my desk, but I think I can’t do the tests in december… (but I probably build a prototype in january).

Have fun,
best regards,
Klaus


#6

Hi Kaef ,

Thanks , I will order the TTGO-T8 board on banggood.
Regards,
Ronny


#7

Hi Kaef ,

This week I got my TTGO-T8 board and uploaded your lisp 3.0a
Unfortunately I can not get it running.
The board tries to startup but for some reason it’s rebooting forever.
I have a screen of the serial port. (see below)
My questions are

  • what must I choose in arduino to compile /upload (I’ve tried several but same results) since there’s no ttgo-t8 in the libraries.
  • what options do I choose for a board that you think or know that I have to select.

Hope you can help me,
See below serial dump at booting.

Kind regards,
Ronny

uLisp 3.0a (Kaef)

System information:

reset reason: 12

wakeup cause: 0

compiled: Feb 21 2020 16:31:48

Features:

  printfreespace

  serialmonitor

  sdcardsupport

  FabGl (VGA & PS/2 keyboard support)

Guru Meditation Error: Core 1 panic’ed (IllegalInstruction). Exception was unhandled.
Memory dump at 0x400d25bc: d1f6f6e1 76623132 11210335
Core 1 register dump:
PC : 0x400d25c2 PS : 0x00060530 A0 : 0x800d2734 A1 : 0x3ffb1f40
A2 : 0x400d2b68 A3 : 0x00074240 A4 : 0x00000000 A5 : 0x00000000
A6 : 0x00000000 A7 : 0x00000001 A8 : 0x800d25b1 A9 : 0x3ffb1f20
A10 : 0x00074240 A11 : 0x0000000a A12 : 0x2acfc501 A13 : 0xfefefefe
A14 : 0x00010620 A15 : 0x00000005 SAR : 0x00000017 EXCCAUSE: 0x00000000
EXCVADDR: 0x00000000 LBEG : 0x400e46e4 LEND : 0x400e4746 LCOUNT : 0x00000002

Backtrace: 0x400d25c2:0x3ffb1f40 0x400d2731:0x3ffb1f60 0x400d2dd7:0x3ffb1f80 0x400e5203:0x3ffb1fb0 0x40090481:0x3ffb1fd0

Rebooting…


#8

Hi @Ronny,
I think I used the wrover module.
Please make sure that support for PSRAM is enabled in the arduino tools menu.
Also try to enable only one of sdcardsupport or FabGl in the uLisp sketch.
I didn’t get these both options working at the same time by now (but iirc uLisp didn’t crash if both options were enabled). I remember that uLisp was running at the ttgo-t8 with one of these options enabled…
I’ll investigate and wirte a more specific answer asap.
Best regards,
Kaef


#9

ok , thanks.

Hope to hear from you again.
Regards,
Ronny


#10

Hi Kaef ,

Commenting out the sdcard , seems to solve the reboots :
// #define sdcardsupport

I got it working now !
Next thing is to find an ps2 keyboard …

What do you use in arduino under tools - partition scheme ?
I used the top one.
What is this PSRAM actually ? Does the ttgo-t8 have psram ?

Kind regards,
Ronny


#11

Hi @manes6969,
great that you got your board working with uLisp.
I’m using the 'default partition scheme.
PSRAM is an additional RAM chip soldered on some boards, TTGO-T8 has a 4MB PSRAM chip and uLisp uses for the workspace.
I get the following starting message from uLisp (you can see the defines I activated):

setupFabGl
8 color mode setup: R:25, G:26, B:27, H:5, V:23

uLisp 3.0a (Kaef)
System information: ESP32-TTGO_T8
reset reason: 1
wakeup cause: 0
compiled: Feb 22 2020 13:37:04
Features:
  printfreespace
  printfreesymbolspace
  serialmonitor
  LARGE_WORKSPACE_SETUP
  FabGl (VGA & PS/2 keyboard support)
  initworkspace: PSRAM, 512k (-7)

524280|32k> 

HTH,
best regards,
Kaef


#12

Hi Kaef,

This is what I get :

setupFabGl

uLisp 3.0a (Kaef)

System information:
reset reason: 1
wakeup cause: 0
compiled: Feb 22 2020 12:21:20
Features:
printfreespace
serialmonitor
FabGl (VGA & PS/2 keyboard support)

initworkspace: PSRAM, 512k (-7)

524280>

Kind regards
Ronny


#13

Hi Kaef,

How can I change text color from within Lisp ?

Regards,
Ronny


#14

Hi @manes6969,

to change text color FabGl supports some ANSI/VT100/VT102 escape-sequences.
I think printing these sequences within uLisp should work, but I haven’t tested it.
You may look at some FabGl examples and/or documentation to find out the sequences to write.

Regards,
Kaef


#15

Hi Kaef ,

I managed to change colors.
Now I want to use the sdcard interface on the ttgo board
Its connected to pins 2 ,13,14 & 15
So I changed the vga pins so that 15 is now 27.
This free’s up the pin 15 for sdcard
However when booting I got a Card Mount Failed ! message.
Do you have any idea what can cause this ?

Kind regards,
Ronny


#16

Hi Ronny,

great that you’re able to change colors. Could you send an example how you’d done it?

SD-Card:
I get the same message when trying to use FabGL and sdcard in parallel, using just one of them is working as expected. Sadly I don’t know the reason for this and I think there are two options to go:

  • maybe FabGl uses the hardware resources needed by the sd-card subsystem. The author of FabGl could be contacted and he may have a solution to solve this.
  • it may be possible to use a software spi to talk to the sdcard. This may be a bit slower, but I think it could work.

Best regards,
Kaef

PS: I’l post an issue to the FabGL github page… (https://github.com/fdivitto/FabGL/issues/49)


#17

Hi Kaef ,

Here is some code to change colors :

(defun wbs (&rest b)
(dolist (i b) (write-byte i)))

(defun fgcolor (n)
(wbs (char-code #\Escape) (char-code #[) (char-code #\3) (+(char-code #\0) n) (char-code #\m)))

(defun Hfgcolor (n)
(wbs (char-code #\Escape) (char-code #[) (char-code #\9) (+(char-code #\0) n) (char-code #\m)))

(defun bgcolor (n)
(wbs (char-code #\Escape) (char-code #[) (char-code #\4) (+(char-code #\0) n) (char-code #\m)))

(defun Hbgcolor (n)
(wbs (char-code #\Escape) (char-code #[) (char-code #\a) (+(char-code #\0) n) (char-code #\m)))

fgcolor changes de background color and bgcolor the backgroundcolor.
number n is from 0 …7
0=black ; 1=red ; 2=green ; 3=yellow ; 4=blue ; 5=magenta ; 6=cyan ; 7=white.
The functions Hfgcolor and Hbgcolor do the same but for the Highlighted colors.
This way you can change 16 out of the 64 colors
I’m thinking to add some lisp commands in your .ino file to be able to use all 64 colors.

SDCARD:

I noticed that you are already started a discussion with the fabgl guy.
I will follow it closely.
Do you think I can add some more relevant things ?

Kind regards,
Ronny


#18

Hi Ronny,

I try to use HSPI for the sdcard as fdivitto (FabGL) does (arduino uses VSPI by default), but that does not work either.
I’m not sure what I should try next, maybe using another esp32 board and connect the sdcard to the pins fdivitto uses by default? (MOSI = 17, MISO = 16, CLK = 14, CS = 13)

Best regards,
Kaef


#19

Hi Kaef

Unfortunately pin 17 is not available on the ttgo board.
I wonder which esp board fdivitto is using.
I guess the ttgo board is not a good choice for the sdcard … :-(

Regards,
Ronny


#20

nor pin 16.