tabemann / zeptoforth

A not-so-small Forth for Cortex-M
MIT License
190 stars 18 forks source link

What would be the cheapest way to have the console on a LCD display #105

Open extrowerk opened 5 months ago

extrowerk commented 5 months ago

I'd like to attach a display and a keyboard to my rp2040 to be able to experiment with ZForth without any computer.

For this I am currently looking at a simple serial-terminal solution using a separate microcontroller and some pasive parts. In this case an ATTiny85 would take care about the serial input and output handling, so it would need 2 UART pin and a common ground for communication. See here: http://www.technoblogy.com/show?TV4

I am wondering if it would be possible to extend ZForth to eliminate the need of the additional microcontroller. Is there any other easy/cheap way to connect an LCD display and a serial keyboard to an rp2040 board?

tabemann commented 5 months ago

On Tue, Jun 4, 2024, 03:01 extrowerk @.***> wrote:

I'd like to attach a display and a keyboard to my rp2040 to be able to experiment with ZForth without any computer.

For this I am currently looking at a simple serial-terminal solution using a separate microcontroller and some pasive parts. In this case an ATTiny85 would take care about the serial input and output handling, so it would need 2 UART pin and a common ground for communication. See here: http://www.technoblogy.com/show?TV4

I am wondering if it would be possible to extend ZForth to eliminate the need of the additional microcontroller. Is there any other easy/cheap way to connect an LCD display and a serial keyboard to an rp2040 board?

zeptoforth already comes with optional support for SSD1306 OLED and ST7735S LCD displays, and it should not be hard to hack together support for PS/2 keyboards per https://forums.raspberrypi.com/viewtopic.php?t=329630 . There really should be no need for an external microcontroller. (zeptoforth comes with built-in console redirection that I use in examples like https://github.com/tabemann/zeptoforth/blob/master/test/rp2040/st7735s_terminal_1.fs .)

I have already implemented much of the underlying logic for terminal display for these two sorts of display in https://github.com/tabemann/zeptoforth/blob/master/test/common/ssd1306_print.fs , https://github.com/tabemann/zeptoforth/blob/master/test/rp2040/st7735s_print_8.fs (for 8-bit color), and https://github.com/tabemann/zeptoforth/blob/master/test/rp2040/st7735s_print.fs (for 16-bit color). Note however that this code is somewhat slow and could be optimized considerably.

Travis

extrowerk commented 4 months ago

4OK Working on my concept...

tabemann commented 4 months ago

Nice. Let me know when you've chosen a display so I can create a display driver for it. (Note that for larger displays and depths greater than 2 this may need to be specifically a text display driver due to memory constraints.)

Travis

On Thu, Jun 27, 2024 at 3:03 AM extrowerk @.***> wrote:

4OK.png (view on web) https://github.com/tabemann/zeptoforth/assets/5569059/a0997deb-176f-4200-aea4-20d26daa9766 Working on my concept...

— Reply to this email directly, view it on GitHub https://github.com/tabemann/zeptoforth/issues/105#issuecomment-2194049193, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABDMC2DSHBSDXSYZC3CV7FLZJPBLRAVCNFSM6AAAAABIX62MXCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCOJUGA2DSMJZGM . You are receiving this because you commented.Message ID: @.***>

tabemann commented 4 months ago

On Thu, Jun 27, 2024 at 9:44 AM Travis Bemann @.***> wrote:

Nice. Let me know when you've chosen a display so I can create a display driver for it. (Note that for larger displays and depths greater than 2 this may need to be specifically a text display driver due to memory constraints.)

Travis

On Thu, Jun 27, 2024 at 3:03 AM extrowerk @.***> wrote:

4OK.png (view on web) https://github.com/tabemann/zeptoforth/assets/5569059/a0997deb-176f-4200-aea4-20d26daa9766 Working on my concept...

One note - it might be a good idea to design in an SD card slot. I say this because zeptoforth (and zeptoscript) has support for FAT32 filesystems on SDHC/SDXC cards, and if you are designing a standalone system like this it would be a very good idea to add support for them (so, for instance, you could store code in and load code from files and edit code with zeptoed, and so you could exchange files with external systems).

Travis

Message ID: @.***>

extrowerk commented 4 months ago

I have designed a PCB, which holds an Rpi Pico running Zeptoforth and an STM32F103, which takes care about the PS2 keyboard and for the LCD handling. It provides a reasonable subset of VT100. https://github.com/ht-deko/vt100_stm32 The display is a generic 3,2" 320x240 SPI display : https://www.aliexpress.com/item/1005003005413104.html

So now I have 3 microcontroller here, an rpi pico, an stm32 and an atmega for the keyboard. It is overkill , but this way i can use it as a dumb terminal aswell.

photo1718804892

tabemann commented 4 months ago

On Thu, Jun 27, 2024 at 11:45 AM extrowerk @.***> wrote:

I have designed a PCB, which holds an Rpi Pico running Zeptoforth and an STM32F103, which takes care about the PS2 keyboard and for the LCD handling. It provides a reasonable subset of VT100. https://github.com/ht-deko/vt100_stm32 The display is a generic 3,2" 320x240 SPI display : https://www.aliexpress.com/item/1005003005413104.html

So now I have 3 microcontroller here, an rpi pico, an stm32 and an atmega for the keyboard. It is overkill , but this way i can use it as a dumb terminal aswell.

photo1718804892.jpeg (view on web) https://github.com/tabemann/zeptoforth/assets/5569059/c5986a49-3900-4ddb-9faf-749cc125a438

I see you have already made a good amount of progress there! This is definitely a cool project.

Travis

extrowerk commented 4 months ago

Travis, do you think it would be possible to support this LCD in Zeptoforth? Also what kind of input is supported? This CardKB comes with I2C firmware in default, but there is an UART and a PS2 firmware aswell. Does Zeptoforth supports any of this? I am interested in simplifying this setup, but ideally i would keep as much GPIO pins free as possible.

tabemann commented 4 months ago

On Fri, Jun 28, 2024 at 2:11 AM extrowerk @.***> wrote:

Travis, do you think it would be possible to support this LCD in Zeptoforth? Also what kind of input is supported? This CardKB comes with I2C firmware in default, but there is an UART and a PS2 firmware aswell. Does Zeptoforth supports any of this? I am interested in simplifying this setup, but ideally i would keep as much GPIO pins free as possible.

I do think it would be possible to add support to zeptoforth. zeptoforth on the RP2040 supports I2C, along with SPI and UART communications, and there is also support for the RP2040's PIO's. IMO the best approach would be to use two RP2040 boards, one for the terminal (screen and keyboard) and one for user software, and linking them together using a soft UART implemented on the user RP2040 side via PIO to keep two hard UART's free for the user, and taking up as few pins on the user RP204 as possible.

Travis

Message ID: @.***>