Author Topic: CH32V003 -A3 (SOP16) issue with SWIO (D1) and D4  (Read 631 times)

0 Members and 1 Guest are viewing this topic.

Offline rhodgesTopic starter

  • Frequent Contributor
  • **
  • Posts: 324
  • Country: us
  • Available for embedded projects.
    • My public libraries, code samples, and projects for STM8.
CH32V003 -A3 (SOP16) issue with SWIO (D1) and D4
« on: August 05, 2024, 04:28:17 pm »
I have been using the CH32V003 -A4 (SOP16) part for various projects and today I got bit.

I was using some GPIO pins and my scope to dig out some bug, and eventually I put a fast signal on D4. When I went to program a new image, it failed. In different ways. Some times, wlink said there was no part, sometimes it said it was the wrong part, and a couple others. Did I accidentally brick my CPU?

Something tickled my brain, and I noted that on the -A4 part, D4 and D1 (SWIO) are next to each other. I seem to remember some errata on some other part (probably STM32) where there was the possibility of crosstalk between two pins. I don't remember it well, but the workaround may have been to make them both outputs.

So with some hope, I thought maybe helping SWIO with a resistor might quiet it down. Assuming that is the problem, which I did not know, I just suspected. A 1K resistor to ground did not help. Then to VDD. Bingo! I was able to program it normally.

My personal errata now includes "Be careful about how to use D4 on that part. Input might be fine. Slow  or occasional output might be fine. But don't put a fast and continuous signal out D4."
Currently developing STM8 and STM32. Past includes 6809, Z80, 8086, PIC, MIPS, PNX1302, and some 8748 and 6805. Check out my public code on github. https://github.com/unfrozen
 

Offline zilp

  • Frequent Contributor
  • **
  • Posts: 329
  • Country: de
Re: CH32V003 -A3 (SOP16) issue with SWIO (D1) and D4
« Reply #1 on: August 05, 2024, 08:37:59 pm »
So with some hope, I thought maybe helping SWIO with a resistor might quiet it down. Assuming that is the problem, which I did not know, I just suspected. A 1K resistor to ground did not help. Then to VDD. Bingo! I was able to program it normally.

Well, SWIO is an open collector interface that is pulled down by the MCU to transmit, so it makes sense that pull-up is the way to go. Though I am surprised that  the programming adapter doesn't provide sufficiently low-impedance pull-up to enable reliable programming. A pull-up in the circuit makes sense in any case, though, to make sure that noise can't accidentally command the debugging interface to do weird things.
 

Offline HwAoRrDk

  • Super Contributor
  • ***
  • Posts: 1561
  • Country: gb
Re: CH32V003 -A3 (SOP16) issue with SWIO (D1) and D4
« Reply #2 on: August 06, 2024, 01:21:40 am »
Though I am surprised that  the programming adapter doesn't provide sufficiently low-impedance pull-up to enable reliable programming.

The WCH-LinkE programmer does actually feature a 1k pull-up on the SWIO line, but the other side of the resistor is connected to another GPIO pin (PC6) of the programmer MCU. I suppose this is so that it is switchable, and I would guess so that it can be turned off when the programmer is operating in SWD/JTAG mode.

Maybe there is a bug in the programmer firmware and this external 1k pull-up is not being enabled, leaving only the internal pull-up?
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf