Longan Nano

Hi,



Is there anyone that can help me setup my Longan Nano under PlatformIO? I can build the blink example but I can’t upload.

I have the sipeed-rv-debugger connected but maybe I don’t have it wired correctly.

Each time I try to “upload” I get a strange error:

[code]
Processing sipeed-longan-nano (platform: gd32v; board: sipeed-longan-nano; framework: gd32vf103-sdk; board_build.mcu: GD32VF103CBT6; board_build.f_cpu: 108000000L)

CONFIGURATION: https://docs.platformio.org/page/boards/gd32v/sipeed-longan-nano.html
PLATFORM: GigaDevice GD32V 1.0.0 > Sipeed Longan Nano
HARDWARE: GD32VF103CBT6 108MHz, 32KB RAM, 128KB Flash
DEBUG: Current (altera-usb-blaster) External (altera-usb-blaster, gd-link, jlink, sipeed-rv-debugger, um232h)
PACKAGES: toolchain-gd32v 9.2.0, tool-openocd-gd32v 0.1.1, framework-gd32vf103-sdk 1.0.0, tool-gd32vflash 0.1.0
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 0 compatible libraries
Scanning dependencies…
No dependencies
MethodWrapper([“checkprogsize”], [".pio/build/sipeed-longan-nano/firmware.elf"])
Memory Usage -> http://bit.ly/pio-memory-usage
DATA: [= ] 7.0% (used 2310 bytes from 32768 bytes)
PROGRAM: [= ] 5.0% (used 6572 bytes from 131072 bytes)
text data bss dec hex filename
6460 112 2198 8770 2242 .pio/build/sipeed-longan-nano/firmware.elf
([“upload”], [".pio/build/sipeed-longan-nano/firmware.bin"])
AVAILABLE: altera-usb-blaster, gd-link, jlink, serial, sipeed-rv-debugger, um232h
CURRENT: upload_protocol = serial
MethodWrapper([“upload”], [".pio/build/sipeed-longan-nano/firmware.bin"])
Auto-detected: /dev/ttyUSB0
stm32flash -g 0x08000000 -b 115200 -w “.pio/build/sipeed-longan-nano/firmware.bin” “/dev/ttyUSB0”
Failed to init device.
stm32flash Arduino_STM32_0.9

http://github.com/rogerclarkmelbourne/arduino_stm32

Using Parser : Raw BINARY
Interface serial_posix: 115200 8E1

*** [upload] Error 1
[/code]

My .ini file is:
[code]
[env:sipeed-longan-nano]
platform = gd32v
board = sipeed-longan-nano
framework = gd32vf103-sdk
; change microcontroller
board_build.mcu = GD32VF103CBT6

; change MCU frequency
board_build.f_cpu = 108000000L
[/code]

Any ideas? Thanks.



FYI, my lcd display only display a white background on the device, not sure if that is normal.

Hi,



It seems that you did not choose the correct upload_protocol.



If you use a serial port to connect to a longan board, you need to specify
</s><i> </i>upload_protocol = serial upload_port = /dev/ttyUSB1 ; If you have both /dev/ttyUSB0 and /dev/ttyUSB1, select /dev/ttyUSB1 <e>
If you use jtag to connect, need to specify </s>upload_protocol = sipeed-rv-debugger<e>


The complete configuration file looks like this: [code] [env:sipeed-longan-nano] platform = gd32v ; Platform, choose gd32v framework = arduino ; Optional gd32vf103-sdk or arduino board = sipeed-longan-nano ; Development board monitor_speed = 115200 ; Serial monitor baudrate upload_protocol= serial ; Download tool Default serial port, optional jlink, gd-link, dfu, sipeed-rv-debugger,etc. upload_port = /dev/ttyUSB1 ; If you have both /dev/ttyUSB0 and /dev/ttyUSB1, select /dev/ttyUSB1 debug_tool = sipeed-rv-debugger ; Debugging tool default jlink, optional sipeed-rv-debugger, etc. [/code]

You can find more information at our WIKI.https://longan.sipeed.com/en/get_started/blink.html