ch32-rs / ch32v203-demo

8 stars 2 forks source link

Question: "probe-rs info" command increases the LED blinking frequency?? #3

Open Dicklessgreat opened 7 months ago

Dicklessgreat commented 7 months ago

It is not a direct bug in this demo, but the behavior is a little concerning, so I thought I would report it.

Environment: Windows 10, WCH-LINK, CH32V203 evaluation board (I don't know the name. Please refer the attached picture ) image

What I did:

I builded and flashed the program of this repo over USB with wchisp. I actually thought the LEDs were blinking slowly at this point, but I didn't really care and decided to move on. Next, I connected WCH-LINK to try probe-rs to see if I could flash it (I did this without knowing that probe-rs did not yet support ch32v203) and ran the probe-rs info command to check if it recognized correctly, and then, the LED on the board suddenly blinked faster.

My guess is that the CPU clock was not set correctly at the time of rcc.apb2pcenr.modify(), and at some procedure during the execution of probe-rs info refreshed the CPU clock and it had run at 8MHz.

I would be happy to hear any insights you may have come up with from the above. Thanks.

andelf commented 7 months ago

Thanks for your report. That's interesting

Dicklessgreat commented 7 months ago

Thanks, I'll go deeper later. I made a discussion at probe-rs project

Dicklessgreat commented 7 months ago

Sharing missing context: I forgot to write how frequent it blinks. It takes around 1 second per toggling state(lit to not lit, or not lit to lit) when it is "slow"(or, before probe-rs info) And it takes around 0.25 second per toggling state when it is "fast"(or, after probe-rs info)