Yangff / kflash.py

kflash, A Python-based cross-platform Kendryte K210 UART ISP Utility

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

kflash, A Python-based Kendryte K210 UART ISP Utility

Sample Usage

# Linux or macOS
python3 kflash.py firmware.bin
python3 kflash.py -t firmware.bin # Open a Serial Terminal After Finish

# Windows CMD or PowerShell
python kflash.py firmware.bin
python kflash.py -t firmware.bin # Open a Serial Terminal After Finish

# Windows Subsystem for Linux
sudo python3 kflash.py -p /dev/ttyS13 firmware.bin # ttyS13 Stands for the COM13 in Device Manager
sudo python3 kflash.py -p /dev/ttyS13 -t firmware.bin # Open a Serial Terminal After Finish

Requirments

  • Python3
  • PySerial

Windows

python get-pip.py 
python -mpip install pyserial

macOS

# Install Homebrew, an awesome package manager for macOS
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" 
brew install python
python3 -mpip3 install pyserial

Ubuntu, Debian

sudo apt update
sudo apt install python3 python3-pip
sudo pip3 install pyserial

Fedora

sudo dnf install python3
sudo python3 -m pip install pyserial

CentOS:

sudo yum -y install epel-release
sudo yum -y install python36u python36u-pip
sudo ln -s /bin/python3.6 /usr/bin/python3
sudo ln -s /bin/pip3.6 /usr/bin/pip3
sudo pip3 install pyserial

Trouble Shooting


Could not open port /dev/tty*: [Errno 13] Permission denied: '/dev/tty*'

For Windows Subsystem for Linux, you may have to use sudo due to its docker like feature

  • Add your self to a dialout group to use usb-to-uart devices by
sudo usermod -a -G dialout $(whoami)
  • Logout, and log in.

UART Auto Detecting is Not Working, or Select the Wrong UART Port

Windows

  • Check the COM Number for your device at the Device Manager, such as USB-SERIAL CH340(COM13).
python kflash.py -p COM13 firmware.bin

Windows Subsystem For Linux(WSL)

  • Check the COM Number for your device at the Device Manager, such as USB-SERIAL CH340(COM13).
sudo python3 kflash.py -p /dev/ttyS13 firmware.bin # You have to use *sudo* here

Linux

  • Check the USB Device Name, Usually presented as ttyUSB*
ls /dev/ttyUSB*
  • It will print :
$ ls /dev/ttyUSB*
/dev/ttyUSB0
/dev/ttyUSB2
/dev/ttyUSB13
  • Choose the one you think belongs to your device, or you may try multimule names.
python3 kflash.py -p /dev/ttyUSB13 firmware.bin

macOS

  • Check the USB Device Name, Usually presented as cu.*
ls /dev/cu.*
  • It will print :
$ ls /dev/ttyUSB*
/dev/cu.wchusbserial1410
/dev/cu.wchusbserial1437
/dev/cu.SLAB_USBtoUART2333
  • Choose the one you think belongs to your device, or you may try multimule names.
python3 kflash.py -p /dev/cu.wchusbserial1410 firmware.bin

You may unable to find the device even in the /dev, check the link below for drivers.


About

kflash, A Python-based cross-platform Kendryte K210 UART ISP Utility

License:MIT License


Languages

Language:Python 100.0%