LonganNanoTest
Getting familar with the Sipeed Longan Nano board
Install / Use
/learn @MuellerA/LonganNanoTestREADME
<h1>Tests</h1>
<table>
<tr><th>Led</th><td>Onboard RGB Led</td></tr>
<tr><th>Freq</th><td>Output wave signal on pin A8/CK_OUT0 (select wave form in main())</td></tr>
<tr><th>Usart</th><td>USART0 (115200,8N1), Pins TX0, RX0</td></tr>
<tr><th>Lcd</th><td>Onboard LCD 160x80, SPI master</td></tr>
<tr><th>Dma</th><td>DMA mem to CRC register</td></tr>
<tr><th>UsartIrq</th><td>USART0 (115200,8N1), Echo serial input to serial output and LCD with 10 character per second, using 1k buffer</td></tr>
<tr><th>PA8</th><td>Read GPIO PA8 which is connected to BOOT0 button</td></tr>
<tr><th>EspLink</th><td>Connect Rx0/Tx0/Gnd/Rst to an ESP8266 running <a href="https://github.com/jeelabs/esp-link/releases/tag/v3.2.47.alpha">esp-link v3.2.47</a></td></tr>
<tr><th>EspLinkWeb</th><td>Connect Rx0/Tx0/Gnd/Rst to an ESP8266 running <a href="https://github.com/jeelabs/esp-link/releases/tag/v3.2.47.alpha">esp-link v3.2.47</a> and update a User Defined Web Page (copy from html folder)</td></tr>
<tr><th>EspLinkSocket</th><td>Connect Rx0/Tx0/Gnd/Rst to an ESP8266 running <a href="https://github.com/jeelabs/esp-link/releases/tag/v3.2.47.alpha">esp-link v3.2.47</a> and start TCP server (telnet or netcat to esp-link port 5555 or 6666)</td></tr>
<tr><th>I2c</th><td>Connect a 3.3V 1602 LCD via PCF8574 (I2C-to-parallel) to port I2C0 (pins B6,B7) in master mode</td></tr>
<tr><th>SpiDma</th><td>Evaluate SPI with and without DMA with and without IRQ</td></tr>
<tr><th>GpioIrq</th><td>Display BOOT0 button status on LED via Irq Handler</td></tr>
<tr><th>LcdFonts</th><td>Show test string in various fonts on LCD</td></tr>
<tr><th><a href="Can">Can</a></th><td>Connect two Longan Nanos via CAN bus</td></tr>
<tr><th><a href="SdCard">SdCard</a></th><td>Read/Write SD card</td></tr>
<tr><th><a href="Flash">Flash</a></th><td>Using 64MBit SPI Flash memory</td></tr>
</table>
<h1>Case</h1>
<p>3D Printer files for a case are in the folder <a href="_CaseStl">_CaseStl</a>.</p>
<h1>License</h1>
<p>My code uses the <a href="LICENSE">MIT License</a>. The repository contains code from other sources, for their license conditions check the files in the lib/ folders.</p>
<h1>Resources</h1>
<img src="https://github.com/kprasadvnsi/longan_nano_pinout/releases/download/v1.1.0/longan_nano_pinout_v1.1.0_w1419_h1000_small.png" alt="pin map" width="100%"/>
<h2>Boards</h2>
<p>
<table>
<tr><th>Board</th><th>MCU</th><th>Flash</th><th>SRAM</th></tr>
<tr><td>Longan Nano</td><td>GD32VF103CBT6</td><td>128kB</td><td>32kB</td></tr>
<tr><td>Longan Nano Lite</td><td>GD32VF103C8T6</td><td>64kB</td><td>20kB</td></tr>
</table>
</p>
<h2>Documentation, Examples, etc</h2>
<table>
<tr><td>Sipeed Longan Nano <a href="http://dl.sipeed.com/LONGAN/Nano/">Specs Tools</a> <a href="https://longan.sipeed.com/en/">Wiki</a> <a href="https://en.bbs.sipeed.com/c/14-category/">BBS</a></td></tr>
<tr><td><a href="http://www.gd32mcu.com/download/down/document_id/222/path_type/1">GD32VF103 User Manual 1.2</a></td></tr>
<tr><td><a href="http://www.gd32mcu.com/download/down/document_id/221/path_type/1">GD32VF103 Datasheet 1.3</a></td></tr>
<tr><td><a href="http://www.gd32mcu.com/download/down/document_id/228/path_type/1">GD32VF103 Firmware Library User Guide 1.0</a></td></tr>
<tr><td><a href="http://www.gd32mcu.com/download/down/document_id/227/path_type/1">GD32VF103 Demo Suites 1.1.0 (.rar)</a></td></tr>
<tr><td><a href="http://www.gd32mcu.com/download/down/document_id/266/path_type/1">GD32VF103 Firmware Library 1.1.1 (.rar)</a></td></tr>
<tr><td><a href="https://content.riscv.org/wp-content/uploads/2019/06/riscv-spec.pdf">The RISC-V Instruction Set Manual Volume I: Unprivileged ISA</a></td></tr>
</table>
<h2>platformio.ini</h2>
<pre>
[env:sipeed-longan-nano-lite]
platform = gd32v
board = sipeed-longan-nano-lite
framework = gd32vf103-sdk
upload_protocol = dfu
[env:sipeed-longan-nano]
platform = gd32v
board = sipeed-longan-nano
framework = gd32vf103-sdk
upload_protocol = dfu</pre>
Longan Nano Lite needs version >= 1.1.1 of the GD32V platform.
<h2>DFU Upload (Linux)</h2> <ol> <li>connect USB</li> <li>press buttons RESET, BOOT0</li> <li>release button RESET</li> <li>release button BOOT0</li> <li>start upload in PlatformIO</li> </ol> <h2>PIN Connections</h2> <table> <tr><th colspan="3">A</th><th colspan="3">B</th><th colspan="3">C</th><th colspan="3">D</th> <tr><th>Pin</th><th>5VT</th><th>OnBoard Function</th><th>Pin</th><th>5VT</th><th>OnBoard Function</th><th>Pin</th><th>5VT</th><th>OnBoard Function</th><th>Pin</th><th>5VT</th><th>OnBoard Function</th></tr> <tr><td>A0</td><td>-</td><td></td> <td>B0</td><td>-</td><td>LCD RS</td> <td></td><td></td><td></td> <td>[D0/OSCIN]</td><td>-</td><td>8MHz Clk</td></tr> <tr><td>A1</td><td>-</td><td>Green LED active low</td><td>B1</td><td>-</td><td>LCD RST</td> <td></td><td></td><td></td> <td>[D1/OSCOUT]</td><td>-</td><td>8MHz Clk</td></tr> <tr><td>A2</td><td>-</td><td>Blue LED active low</td> <td>[B2]</td><td>*</td><td>LCD CS</td></tr> <tr><td>A3</td><td>-</td><td></td> <td>B3</td><td>*</td><td></td></tr> <tr><td>A4</td><td>-</td><td></td> <td>B4</td><td>*</td><td></td></tr> <tr><td>A5/SCK0</td><td>-</td><td>LCD SPI Clk</td> <td>B5</td><td>-</td><td></td></tr> <tr><td>A6</td><td>-</td><td></td> <td>B6</td><td>*</td><td></td></tr> <tr><td>A7/MOSI0</td><td>-</td><td>LCD SPI MOSI</td> <td>B7</td><td>*</td><td></td></tr> <tr><td>A8</td><td>*</td><td>10k PullDown?, connected to BOOT0 button active high</td><td>B8</td><td>*</td><td></td></tr> <tr><td>A9</td><td>*</td><td></td> <td>B9</td><td>*</td><td></td></tr> <tr><td>A10</td><td>*</td><td></td> <td>B10</td><td>*</td><td></td></tr> <tr><td>A11/USBFS_DM</td><td>*</td><td>USB D-</td> <td>B11</td><td>*</td><td></td></tr> <tr><td>A12/USBFS_DP</td><td>*</td><td>USB D+</td> <td>B12/NSS1</td><td>*</td><td>TF CARD SPI CS</td> <td>C13</td><td>-</td><td>Red LED active low</td></tr> <tr><td>A13</td><td>*</td><td></td> <td>B13/SCK1</td><td>*</td><td>TF CARD SPI Clk</td> <td>C14/OSC32IN</td><td>-</td><td>32kHz Clk</td></tr> <tr><td>A14</td><td>*</td><td></td> <td>B14/MISO1</td><td>*</td><td>TF CARD SPI MISO, 10k PullUp</td><td>C15/OSC32OUT</td><td>-</td><td>32kHz Clk</td></tr> <tr><td>A15</td><td>*</td><td></td> <td>B15/MOSI1</td><td>*</td><td>TF CARD SPI MOSI, 10k PullUp</td></tr> <tr><td colspan="99">[x] not available as header pin; 5VT (5 Volt Tolerant Input): * yes, - no</td></tr> </table> <h2>Troubles with Longan Nano and GD32V Platform</h2> <h3>Compile</h3> <ul> <li><pre>.../.platformio/packages/framework-gd32vf103-sdk/GD32VF103_standard_peripheral/gd32vf103.h:179:41: error: redeclaration of C++ built-in type 'bool' [-fpermissive] 179 | typedef enum {FALSE = 0, TRUE = !FALSE} bool;</pre> <p>Put this line in comments, then C++ will compile the SDK files.</p> </li> <li><pre>Adding dfu suffix to firmware.bin sh: 1: dfu-suffix: not found</pre> <p>dfu-utils only gets installed when uploading with dfu. Build with target 'upload' once, then the program will be found.</p> </li> </ul> <h3>Upload</h3> <ul> <li>DFU on Linux: <ul> <li>GD32V 1.1.1: Longan Nano Lite working fine. Longan Nano only after download & compile of <a href="https://sourceforge.net/p/dfu-util/dfu-util/ci/master/tree/">latest dfu-util</a>.</li> <li>GD32V 1.2.0: Error messages after upload, but seems to work. Sometimes a reset is needed after upload and sometimes not.</li> </ul> </li> <li>JLink on Linux (tried with 1.1.1): Gives error message after upload, but after power cycling the Longan Nano the program is working (reset is not enough).</li> <li>DFU on Windows (tried with 1.1.1): didn't get it working. Use <a href="https://longan.sipeed.com/en/get_started/blink.html#usb-dfu-download_1">GigaDevice Dfu Tool</a> instead.</li> <li>JLink on Windows: didn't try yet.</li> </ul>Related Skills
node-connect
354.2kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
112.2kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
354.2kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
354.2kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
