对CH32F103的USB功能的一些问题

有个老外用户对CH32F103用usb功能的一些问题, 想请教一下

  1.  COREID, 这个我应该能自己找

  2. USB的D-, D+, 连到PA11和PA12时, 沁恒的例子应该不串22R电阻也不加1.5K上拉, 但是大部分bluepill是带的, 这额外的电阻和上拉会对usb有影响么?

  3. CH32F103的USB初始化, 和STM32F103的USB初始化是不是一样的? 需要额外的初始化操作么

  4. 有没有CH32F103的USB CDC的完整例子?

原文

  1. First, what is the Coreid that the CH32F103 presents when debugging? The STM32F1 is 0x1BA01477, for example.

  2. Does the datasheet say that 22 ohm resistors should be in series with the PA11/PA12 USB -/+ pins and that PA12 should be pulled up with a 1k5? The schematic on the evaluation board does not include these. Most Bluepills do include these, and I am wondering if that's part of the problem.

  3. Is the USB device on the CH32F103 intended to be register and memory compatible with STM32F103 ? The registers have the same names and bits, but there could be additional initialization required for the CH32F103 that is not required on the STM32F103.

  4. Are there any complete code examples of USB for the CH32F103, for example, a USB CDC implementation that you know of?

Thank you!


您好,关于CH32F103的USB,在芯片内部内置上来电阻,可通过程序配置开启,无需外接上拉电阻,如下图1、2。关于USB初始化,在初始化的时候要对状态寄存器全清,具体程序配置见下图3。在CH32F103 EVT中有CDC例程,可以参考下。CH32F103 EVT下载链接如下:

https://www.wch.cn/downloads/CH32F103EVT_ZIP.html 

image.png

图1

image.png

图2

image.png

图3


只有登录才能回复,可以选择微信账号登录