A small LCD attached to the USB port can be very useful. It can show CPU load, RAM usage, network traffic and so on. Anything you could ever imagine on the separate small display - what could be better? Another good thing is that it is really inexpensive. All you need is a well-known STM32F103 board called “blue pill”, ST7565R-based LCD, several wires and a bit of time.
Frankly speaking, I started this project in order to play a bit with libopencm3. Blinking LEDs is too boring, yet another weather station is also something I would never use, so I quickly came up with an idea to play with USB bulk interface. It took about two evenings including debugging and at the end it shows the status of my home NAS using modified lcd4linux.
Modified lcd4linux can be taken here.
So, let’s assume you already have the blue pill board and some ST7565R-based LCD module. Here is the wiring:
STM32 pin | LCD Module pin |
---|---|
A2 | RST (RSE) |
A3 | RS |
A4 | CS |
A5 | SCL |
A7 | SI |
Do not forget also to attach the power supply to the LCD module.
In case if you have a pretty cheap GMG12864-06D module here is the wiring:
Now let’s flash the bootloader. This is the very first thing I do if I plan to update the FW later. You can take the source code here or just flash this binary. After bootloader is flashed do the following steps:
git clone --recurse-submodules https://github.com/Sl-Alex/SlAlexUSBLCD.git
./make_all.sh
you will get two binary files: *.bin
files, the one with *_BL.bin
is for bootloader,
another one can be flashed directly. If you decided to use the bootloader then run the following command:
dfu-util -w -D <path_to_the_fw>
dfu-util should be version 0.10 or higher, because it has -w
switch which tells dfu-util to wait for device to appear. You can build it by yourself or take the pre-built binaries here