How to display the Bad Apple video and Sipeed logo on the Sipeed Longan Nano TFT display.
Information
none
Operating system used
Windows 10 Pro
Software prerequisites
Git
Platformio
Visual Studio Code
Procedure
- Install the Longan_GD32VF_examples in your PlatformIO project directory:
Type: cd C:\Users\<user>\Documents\PlatformIO\Projects
Type: git clone https://github.com/sipeed/Longan_GD32VF_examples
- Copy the two files bmp.bin (contains Bad Apple animation) and logo.bin (contains Sipeed logo) which can be found at:
C:\Users\<user>\Documents\PlatformIO\Projects\Longan_GD32VF_examples\gd32v_lcd\put_into_tf_card
onto a micro SD card and insert the micro SD card into the development board.
Note : The micro SD card is FAT32 formatted.
- Select Open Project and select:
C:\Users\<user>\Documents\PlatformIO\Projects\Longan_GD32VF_examples\gd32v_lcd
- There are several methods to upload the firmware to development board:
- Method A: Using a USB-A - Mini USB-B cable (upload_protocol = serial), a FTDI FT232RL adapter and PlatformIO to upload the firmware.
- Method B: Using a USB-A - USB-C cable (upload_protocol not used), and "GD32 Dfu Tool" to upload the firmware.
- Method C: Using a USB-A - USB-C cable (upload_protocol = sipeed-rv-debugger), the Sipeed RV Debugger Plus and PlatformIO to upload the firmware.
For method A or B, see tutorial:
Programming the Sipeed Longan Nano using Visual Code and PlatformIO and upload to development board
For method C, see tutorial:
Using Sipeed RV Debugger Plus to upload firmware and to debug code
- In this tutorial I will be using method C to upload the firmware to the development board.
Note: In this photo,the TFT display shows the Sipeed logo (logo.bin).
Of course this photo is made AFTER the firmware is uploaded.
You should not see anything.
- Change the upload_protocol to sipeed-rv-debugger in the platformio.ini file:
[env:sipeed-longan-nano]
;Platform, choose gd32v
platform = gd32v
;Optional gd32vf103-sdk or arduino
framework = gd32vf103-sdk
;Development board
board = sipeed-longan-nano
;Default serial, optional jlink, gd-link, dfu, sipeed-rv-debugger
upload_protocol = sipeed-rv-debugger
;jlink, gd-link, ft2232, sipeed-rv-debugger, altera-usb-blaster, um232h, RV-Link
debug_tool = sipeed-rv-debugger
- It is recommended to change the main.c file:
C:\Users\<user>\Documents\PlatformIO\Projects\Longan_GD32VF_examples\gd32v_lcd\src\main.c
Change the following line:
for (int i=0; i<2189;i++)
This for-loop processes in total 2190 bitmap images, which are stored in the
Longan_GD32VF_examples\gd32v_lcd\put_into_tf_card\bmp.bin file.
This bmp.bin file contains exactly 2190 Bad Apple bitmap images.
If you create your own bmp.bin file you need to update this value or better not to use a fixed value at all.
The solution is to replace line:
for (int i=0; i<2189;i++)
with
for (int i=0; i<(f_size(&fil) / 256000);i++)
Note: 256000 = 160 * 80 * 2
- Build and upload the firmware to the development board.
First you will see the Sipeed logo (logo.bin) for a few seconds and then the Bad Apple animation (bmp.bin).
Sipeed logo (logo.bin)
Bad Apple animation (bmp.bin)
- A tutorial how to create the two bin files (logo.bin and bmp.bin), see:
How to create bmp.bin and logo.bin files to be displayed on the Sipeed Logan Nano TFT display
|