Close

How to debug W806 and W801 MCUs?

imarcinsznimarcinszn wrote 04/09/2022 at 13:36 • 3 min read • Like

W806 is quite an interesting product in terms of price and performance. One of the biggest drawbacks of this platform is lack of popular hardware debugger for it. Official CK-Link Lite debuggers are pretty expensive and not widely available. But as turns out it can be also achieved without official debugger but with use of simple STM32 “Blue Pill board”

What is is necessary to start

A) Hardware

B) Software

and a little bit of time...

How to get it working?

1) Upload CKLinkLite2.30.hex to STM32 “Blue Pill board”

2) Open project that is located in SDK: WM_SDK_W806\tools\W806\projects\SDK_Project\project\CDK_WS\CDK_WS.cdkws

3) Enabe “Download To Flash” parameter in Debug settings

Right-click on W806_SDK → Options for “W806_SDK”



4) Connect STM32 and W806 together

STM32

W806

A0

RST_N

A1

PA1

A5

PA4

3V3

3V3

GND

GND

5) ConnectSTM32 via USB to PC

6) Update drivers in Windows Manager

After updating driver CDK IDE should see connected hardware in Debug Tab in Project parameters:


7) Compile project – in contrast to STM32CubeIDE CDK is not automatically compiling project after clicking Debug button

8) Starting Debugging

At this point you should see CDK changing to Debug mode:



Like

Discussions

AndrejChoo wrote 12/30/2022 at 11:40 point

Hi. I am trying to debug according to the described manual and get the error "Not select flash algorithm!". 

And also after disconnecting/connecting the ck-link, the CDK stops seeing it until I reinstall the driver. What am I doing wrong?

  Are you sure? yes | no

André van Schoubroeck wrote 11/18/2022 at 17:08 point

I am running csky-debugserver-bin from AUR,   (DebugSever version 5.12.9)

However, it does not work when I connect it to a blue pill running the said firmware, connected to a W806 board.

It will report the device is busy. Looking at the schematic up at the github where the firmware is for download, it shows leds, which I connected, and then the busy led is also lit. So this error report might be the status reported from the bluepill cklink.  The schematic also shows a pull down resistor at PA8, which I tried placing, but this does not appear to have an effect either.

If the schematic is correct, the only thing that might effect the behaviour is the fact the USB Pull Up resistor is controlled by PB5, rather then always pulled up as on the Blue PIll. 

(The csky-debugserver itself appears to be fine, as it sees the C-Sky Linux Development Board correctly)

  Are you sure? yes | no

André van Schoubroeck wrote 12/07/2022 at 12:10 point

I have bought an "official" €50 CK-Link Lite, to test whether it works, and analyse its behaviour. It works, and I have identified the problem: It is indeed the USB Pull up.

In its boot process, it boots the bootloader, which enumerated, and then starts the application, which disconnect and reconnect the USB (by controlling PB5) and then enumerates as a different device. 

As the Blue Pill has a permanent pull up, this obviously doesn't work. However, when supplying external power (eg. by plugging the W806 board into USB) , one can physically unplug and replug the USB cable, and then it works.

  Are you sure? yes | no

Ken Yap wrote 11/11/2022 at 00:48 point

Thanks for this. I'm still watching this MCU architecture as dev boards are about $2-3 now on AliExpress, excluding shipping. Dev support looks a bit weak, have to tangle with Chinese documents.

The other family I'm watching is the WCH CH32V003 which is actually more STM32 class but RISC-V architecture. Chips really cheap starting at $0.10 in quantity,  It's still early days for this, with keen people on EEVBlog ordering samples to play with and hopefully support tools will improve from that.

  Are you sure? yes | no

NYH-workshop wrote 07/29/2022 at 14:04 point

Hello there, I tried this Debugging tutorial - and I experienced some new issues along the way.

One of it is the CDK version - the CKLinkLite on the Blue Pill board is only working on version 2.12.1. Any higher versions, the CDK would not detect it anymore despite the driver changes.

Also, I couldn't get it to load or debug due to the absence of the ELF file for "Flash Algorithm". 

Currently the CDK only has these, and they are not compatible to the W806 board.

I found out that you need that specific W806 board's Flash Algorithm ELF from this site (it's called W806_Flash_Tool.elf): https://www.bilibili.com/video/BV1L44y1J7Jz/

And there are some tutorials explaining how to debug the W806 but these are in Mandarin and I could not really source these extra files since they require an account that can be registered within China:

- https://oshwhub.com/l88889686/cklinkw80x-fang-zhen-qi

- https://bbs.elecfans.com/jishu_2180011_1_1.html

It would be great if you have the W806_Flash_Tool.elf for this one. :)

  Are you sure? yes | no

André van Schoubroeck wrote 12/09/2022 at 18:46 point

The file is in the repository containing the hex file linked in the article, https://github.com/henrycoding/cklink-lite

However how to use it in the command line version?

  Are you sure? yes | no