diff options
| author | sakumisu <[email protected]> | 2025-11-25 20:31:23 +0800 |
|---|---|---|
| committer | sakumisu <[email protected]> | 2025-11-26 18:24:45 +0800 |
| commit | 31b79434cedde07f1cd3971ad279df019f3f99f1 (patch) | |
| tree | 1d73f78755d06f85c02ff50362862a2e0f570aa6 /docs | |
| parent | f9a8b29b8ae3a6883d87760211f5317e891b9fbd (diff) | |
docs: update rst
Signed-off-by: sakumisu <[email protected]>
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/source/demo/img/otg.png | bin | 0 -> 477332 bytes | |||
| -rw-r--r-- | docs/source/demo/usb_otg.rst | 15 | ||||
| -rw-r--r-- | docs/source/index.rst | 8 | ||||
| -rw-r--r-- | docs/source/usb/usb_ext.rst | 8 |
4 files changed, 24 insertions, 7 deletions
diff --git a/docs/source/demo/img/otg.png b/docs/source/demo/img/otg.png Binary files differnew file mode 100644 index 00000000..9605176a --- /dev/null +++ b/docs/source/demo/img/otg.png diff --git a/docs/source/demo/usb_otg.rst b/docs/source/demo/usb_otg.rst new file mode 100644 index 00000000..78692cc0 --- /dev/null +++ b/docs/source/demo/usb_otg.rst @@ -0,0 +1,15 @@ +OTG 功能的使用 +========================= + +如果需要使用 OTG 功能,首先使用的芯片需要支持 ID 检测功能,然后使能 ``CONFIG_USB_OTG_ENABLE`` 宏,将之前的例程中 ``usbh_initialize`` 或者 ``usbh_initialize`` +替换成 ``usbotg_initialize`` 即可。 + +ID 检测电路根据不同的 USB 接口类型有所不同,常见的有 micro-USB 和 USB-C 两种接口类型。 + +- 如果是 micro-USB 接口,则将 ID 线连接到芯片的 ID 引脚,并使能 ID 功能即可。 +- 如果是 USB-C 接口,由于没有 ID 引脚,则需要借助 CC 电路转换成 ID 然后连接到芯片的 ID 引脚,常见电路图如下所示(DNP 表示不焊接): + +.. figure:: img/otg.png + + +.. note:: 除 ID 引脚以外,还需要增加 VBUS 输出开关控制,当工作在 host 时,开启 VBUS 供电,当工作在 device 时,关闭 VBUS 供电。
\ No newline at end of file diff --git a/docs/source/index.rst b/docs/source/index.rst index 90c3b8aa..a6dc3d8a 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -44,10 +44,9 @@ CherryUSB 是一个小而美的、可移植性高的、用于嵌入式系统的 **其他相关链接** -- **CherryUSB 大纲** https://www.bilibili.com/video/BV1st4y1H7K2 -- **CherryUSB 从机协议栈视频教程** https://www.bilibili.com/video/BV1Ef4y1t73d -- **CherryUSB 腾讯会议** https://www.bilibili.com/video/BV16x421y7mM -- **github** https://github.com/sakumisu/CherryUSB +- **视频教程**: https://www.bilibili.com/cheese/play/ss707687201 +- **github** : https://github.com/sakumisu/CherryUSB +- **CherryUSB原理性分析和应用实践-汉斯期刊**: https://www.hanspub.org/journal/paperinformation?paperid=126903 .. toctree:: :maxdepth: 1 @@ -116,6 +115,7 @@ CherryUSB 是一个小而美的、可移植性高的、用于嵌入式系统的 demo/usbh_wifi demo/usbd_vendor demo/usbh_vendor + demo/usb_otg .. toctree:: :maxdepth: 1 diff --git a/docs/source/usb/usb_ext.rst b/docs/source/usb/usb_ext.rst index fa81f728..86b87a53 100644 --- a/docs/source/usb/usb_ext.rst +++ b/docs/source/usb/usb_ext.rst @@ -29,9 +29,11 @@ ZLP,顾名思义,零长度数据包,也就是数据长度为0 的短包。 -------------------- 从机接收:接收的长度与设置的长度相等;接收的最后一个包为短包。 -从机发送:发送的长度与设置的长度相等,如果发送的长度是 EP MPS 的整数倍,需要再发送一个 ZLP(仅限 control 和 bulk 传输)。 +从机发送:发送的长度与设置的长度相等,如果发送的长度是 EP MPS 的整数倍, **通常** 需要再发送一个 ZLP(仅限 control 和 bulk 传输)。 + +.. note:: 对于从机接收,并且是 bulk 传输,接收长度通常设计为 EP MPS,以下三种情况可以修改为多个 EP MPS: 固定长度;自定义协议并携带长度(例如 MSC); 主机手动发送 ZLP 或者短包(例如 RNDIS) + +.. note:: 对于从机发送,并且是 bulk 传输,发送长度没有限制,但是如果是 EP MPS 整数倍,通常需要发送 ZLP。自定义协议则不需要发送 ZLP,例如 MSC。 主机接收:同从机接收 主机发送:发送的长度与设置的长度相等 - -.. note:: 对于从机接收,并且是 bulk 传输,接收长度通常设计为 EP MPS,以下三种情况可以修改为多个 EP MPS: 固定长度;自定义协议并携带长度(例如 MSC); 主机手动发送 ZLP 或者短包(例如 RNDIS)
\ No newline at end of file |
