X-Ryl669 / wifi_display

E-ink wireless display
15 stars 0 forks source link

Using the custom stm32_application with default UART connector #1

Open VanLaser opened 7 years ago

VanLaser commented 7 years ago

Hello,

I intend to hookup the same e-paper display to a Raspberry PI Zero, using its UART GPIO pins, and I'd like to make the whole display process faster by trying to custumize the way image data (pixels) is sent to the display. For that, the serial commands provided by default to draw lines, circles or pixels is not enough. Would it be possible to use/modify the stm32 application (custom FW) in order to define my custom PI->display serial cmd "API", but still keep the default UART connection (through the white connector) to the PI? I.e. no soldering or other modifications involved (apart from what's needed to flash the STM). Any advice would be appreciated, thaks!

X-Ryl669 commented 7 years ago

Yes, and this is what I did in this fork. You do not need to solder anything on the UART line, but you still need to solder the ST FLASH pins. If you want to have a look to the protocol, I've implemented, it's in the file https://github.com/X-Ryl669/wifi_display/blob/master/stm32_application/main.c

Basically, the serial link is set to 460kBaud, you'll need to send 2 bytes for the STM32 to accept the next items (to avoid noise on line), the 2 bytes are 0x2d and 0x5a (these are the magic word that are unlikely to happen after a board reset).

Then you'll send the command (update screen, clean screen, etc...) and then the RLE compressed bitmap, wait a bit, and it's displayed!

You'll need to compile the code without defining "UseSPI" for having communication over UART. Also notice that the STM32 use the UART TX (so the RPi RX in your case) for a debug line and display what it does, so it can be useful to figure out what it does not work ;-)

X-Ryl669 commented 7 years ago

Also, please notice that the RLE compressor is in PHP. You'll likely have to convert it to C code (not too hard, it's very simple code, should map almost 1:1).

VanLaser commented 7 years ago

Hello and thanks for answering! I also already asked the other "culprit" of playing with this device (https://github.com/davidgfnet/wifi_display/issues/9). In the last few days I managed to understand some of the things you specify in your first reply (haven't looked yet on the actual image compression and display parts); I managed to hookup the SWDIO pins (ST FLASH), configured openocd successfully (from the same Raspberry PI), dumped an image etc.

Since my use case is different (I want the display to act as a terminal display, so - interactively and in some sort of "text mode" with the fonts already loaded on the STM, but also capable of displaying "normal" images similar to an e-book reader - of course, with slow refresh rate - so probably with 'deffered io') I have now to study the actual e-paper display part (STM32 -> e-ink) to see how is the drawing performed and what can be done about only drawing (refreshing) some blocks, lines etc. Thanks again for the details and also for your UART code!!! :)

sam1006 commented 7 years ago

@X-Ryl669 can we also upload FW in stm32 using UART as guys are doing here http://grauonline.de/wordpress/?page_id=1004 https://github.com/rogerclarkmelbourne/Arduino_STM32

X-Ryl669 commented 7 years ago

If you write a bootloader for it, you can. Honestly, st-link dongles are 5$ and I've better to do than spend days to write such bootloader.

VanLaser commented 7 years ago

@sam1006 If you have a raspberry with Linux on it, you can use openocd with the PI UART connected to the waveshare's SPDIO pins to read/write the STM flash.