CS110/CS110P Lab 11
Computer Architecture I@ShanghaiTech
IMPORTANT: Read the FAQ from @103 before posting on Piazza!
Your Tasks
- Bring the following material to the Lab.
- Your Laptop;
- A type-c cable that is capable of transferring data. Recharge-only type-c cables do not work.
- Refer to the table to lookup your tasks for this lab.
| Registered in CS110P | Not Registered in CS110P | |
|---|---|---|
| Registered in CS110 | Complete this lab | Complete this lab |
| Not Registered in CS110 | Complete this lab to get Longan Nano board, but this lab is UNSCORED for you. | At your convenience |
Objective of this lab
- Install software and driver (Windows Only) to download provided firmware into the Longan Nano.
- Get a Longan Nano board from TA.
- Check if the Longan Nano board and its peripheral is working.
Task 1: Install Necessary Software
Overview
Our Longan Nano board uses DFU protocol to receive firmware from PC. Therefore, you need to configure the DFU tool or driver according to your operating system.
⚠️ OS Recommendation & Compatibility Warning
Due to driver stability issues, we strongly recommend using macOS or Linux for this lab.
For Windows Users: Recent system updates have caused significant driver regressions. If you must use Windows, please refer to the specific warning in Section 1.1 regarding the April 2026 security update.
1.1 Windows Version
- Download and install the Longan development kit for CA1 from
here.
The downloaded compressed archive contains an installation guide
(
readme.md). - Inflate
longan-dev-kit-ca1-windows-version-20250403.7z, follow steps 5 and 6 inreadme.mdto install the DFU driver AND DFU tool.
Note 1: There is a chance that your computer crashes into a bluescreen when the Longan Nano enters DFU mode. See Piazza post @103 for more details.
Note 2: The default filter for the DFU tool selects
.hex files instead of .bin. If you
cannot see .bin files, this is the most likely
cause.
Note 3: Compatibility Alert (April 2026): After the 2026-04 Security Update (KB5083769, OS Build 26200.8246), the Windows DFU tool may fail to recognize the device even though the driver is still visible in the system. If the DFU tool cannot see your Longan Nano, please check your update history. You may need to uninstall KB5083769 to restore functionality, or switch to a Linux/macOS environment.
1.2 Linux Version
You only need to use the dfu-util executable we
provided.
- For users with Intel/AMD CPU, download
dfu-utilfrom here. - Please use
tarand the commandtar xvf <path to Longan Nano dev pack>to decompress the file; otherwise, you may encounter permission issues in the following lab11. - Place this file anywhere. You may need to give the
dfu-utilexecution permission usingchmod +x dfu-util.
1.3 macOS Version
On macOS, the simplest way to install dfu-util
is via Homebrew. It automatically handles
execution permissions and path configurations.
Open your terminal and run:
brew install dfu-util
Note: If you don't have Homebrew installed, please visit brew.sh first.
Task 2: Download Sample Firmware to Longan Nano
2.1 Preparation
- Longan Nano Basics: Refer to Sipeed Official Website for Longan Nano Basics.
- Sample Firmware: Download the sample firmware from here.
2.2 Enter DFU mode (on Longan Nano)
This procedure is identical regardless of your PC's operating system.
- Hold BOOT0 button (and do not release)
- Hold RESET button (and do not release)
- Release RESET button
- Release BOOT0 button
Note: The temporal ordering of pressing and releasing buttons is of vital importance on entering DFU mode. Therefore, if the attempt of entering DFU fails, please first try repeating the above procedure before posting on Piazza.
2.3 Download (Write) to Device (on PC)
Windows
Use the GD32 MCU Dfu Tool_v3.8.1.5784 we
provided.
- Select
Download to Device, and open the.binfile we provided. - Keep
@0x80000000as default. Generally, you do not need to Verify After Download or Erase All. - Make sure the tool can see your device.
- Let the tool download your firmware to the device.
- Press RESET key on Longan Nano or click Leave DFU on PC to exit DFU mode.
Linux
USB Device Connectivity
Option A: For WSL2 Users
If you are using WSL2, please follow the official guide here to enable USB device access.
Troubleshooting Tip: If you encounter the error
WSL usbip: error: Attach Request failed - Device in error state, try:
- Physically reconnect the USB device.
- Run
usbipd unbind --busid <busid>.- Use the
--forceflag when binding:usbipd bind --force --busid <busid>.- Run the
attachcommand again.Option B: For VMware Users
When you plug in a USB device, select "Connect to a virtual machine".
Crucial Compatibility Setting: It is highly recommended to use USB 2.0.
- Shut down your VM.
- Go to VM Settings > USB Controller.
- Set USB compatibility to USB 2.0.
Use the dfu-util we provided:
cd <lab root>
./dfu-util -a 0 --dfuse-address 0x08000000:leave -D <path to sample firmware>
- If it complains that the device cannot be opened, but your
device is in DFU mode, use
sudoto rundfu-util. - The command will complain
Invalid DFU suffix signatureanddfu-util: Error during download get_status. Ignore those two errors. - Press RESET key to exit DFU mode.
- Note: If
dfu-utilcannot find your board, consider Piazza post @100.
macOS
Use dfu-util installed from Homebrew:
cd <lab root>
dfu-util -a 0 --dfuse-address 0x08000000:leave -D <path to sample firmware>
- The command will complain
Invalid DFU suffix signatureanddfu-util: Error during download get_status. Ignore those two errors. - Press RESET key to exit DFU mode.
2.4 Workflow Completion Self-Check
The following steps will guide you perform a self-check on the above steps.
- Press RESET. You should see
TEST (25s)and a circle on the screen. The color ofTEST (25s)should be white. - Push joystick up, down, left, right, and towards the middle.
You should see blue character
U,D,L,R, andCrespectively. WhenDappears, the color ofTESTshould be green. - Press the two buttons on the left side. You should see
SW1andSW2respectively.
If all of the above steps succeed, then your Longan Nano is functional for all Longan Nano parts of CS110/CS110P.
Task Check Procedure
(1 Point) Show TA that your Longan Nano is functional and sign your name on TA's table as acknowledge receipt for the Longan Nano.
When to Return Your Longan Nano
Refer to the table to lookup your schedule to return your Longan Nano.
| Registered in CS110P | Not Registered in CS110P | |
|---|---|---|
| Registered in CS110 | After completing Project 4 | After completing Lab 12 |
| Not Registered in CS110 | After completing Project 4 | No later than week 15 |