|
|
@@ -53,6 +53,7 @@
|
|
|
<li class="toctree-l2"><a class="reference internal" href="#essemi">基于 Essemi 系列芯片</a></li>
|
|
|
<li class="toctree-l2"><a class="reference internal" href="#nxp-mcx">基于 NXP MCX系列芯片</a></li>
|
|
|
<li class="toctree-l2"><a class="reference internal" href="#artinchip">基于 Artinchip 系列芯片</a></li>
|
|
|
+<li class="toctree-l2"><a class="reference internal" href="#canmv-k230">基于 canmv-k230 芯片</a></li>
|
|
|
<li class="toctree-l2"><a class="reference internal" href="#st">基于 ST 系列芯片</a><ul>
|
|
|
<li class="toctree-l3"><a class="reference internal" href="#usb-device">USB Device 移植要点</a></li>
|
|
|
<li class="toctree-l3"><a class="reference internal" href="#usb-host">USB Host 移植要点</a></li>
|
|
|
@@ -179,7 +180,7 @@
|
|
|
<h2>基于 bouffalolab 系列芯片<a class="headerlink" href="#bouffalolab" title="Link to this heading"></a></h2>
|
|
|
<p>仓库参考:<a class="reference external" href="https://github.com/CherryUSB/cherryusb_bouffalolab">https://github.com/CherryUSB/cherryusb_bouffalolab</a></p>
|
|
|
<ul class="simple">
|
|
|
-<li><p>BL616/BL808 是一个 USB2.0 并且内置高速 PHY 芯片,共 5个端点(包含端点0)。支持主从机。</p></li>
|
|
|
+<li><p>BL616/BL808:USB2.0 内置 HS phy 芯片,支持主从机。device 支持 5 个端点(包括端点0),不支持双向同时使用。</p></li>
|
|
|
<li><p>USB 的相关应用位于 <cite>examples/usbdev</cite> 和 <cite>examples/usbhost</cite> 目录下,根据官方环境搭建完成后,即可编译使用。</p></li>
|
|
|
</ul>
|
|
|
</section>
|
|
|
@@ -187,7 +188,7 @@
|
|
|
<h2>基于 HPMicro 系列芯片<a class="headerlink" href="#hpmicro" title="Link to this heading"></a></h2>
|
|
|
<p>仓库参考:<a class="reference external" href="https://github.com/CherryUSB/cherryusb_hpmicro">https://github.com/CherryUSB/cherryusb_hpmicro</a></p>
|
|
|
<ul class="simple">
|
|
|
-<li><p>HPM 系列芯片均 USB 2.0 并且内置高速 PHY,支持主从机,端点共 8/16 个,并且可以同时使用双向,不同芯片个数有差异</p></li>
|
|
|
+<li><p>HPM 系列: USB2.0 内置 HS phy 芯片,支持主从机。device 支持 8/16 端点(包括端点0),并且可以同时使用双向,不同芯片个数有差异。</p></li>
|
|
|
<li><p>USB 的相关应用位于 <cite>samples/cherryusb</cite> ,根据官方环境搭建完成后,即可编译使用。</p></li>
|
|
|
</ul>
|
|
|
</section>
|
|
|
@@ -195,8 +196,9 @@
|
|
|
<h2>基于 esp32s2/s3/p4 系列芯片<a class="headerlink" href="#esp32s2-s3-p4" title="Link to this heading"></a></h2>
|
|
|
<p>仓库参考:<a class="reference external" href="https://github.com/CherryUSB/cherryusb_esp32">https://github.com/CherryUSB/cherryusb_esp32</a></p>
|
|
|
<ul class="simple">
|
|
|
-<li><p>esp32s2/s3 支持全速主从机,esp32p4 支持高速主从机</p></li>
|
|
|
-<li><p>默认提供主机 demo,并且使用 esp 组件库进行开发, 在 <a class="reference external" href="https://components.espressif.com/">https://components.espressif.com/</a> 中搜索 cherryusb 即可</p></li>
|
|
|
+<li><p>esp32s2/s3:USB2.0 内置全速 PHY 芯片,支持主从机,device 支持 7 个端点(包括端点0),并且可以同时使用双向。</p></li>
|
|
|
+<li><p>esp32p4:一个 USB2.0 内置全速 PHY 芯片,一个 USB2.0 内置高速 PHY 芯片,支持主从机。</p></li>
|
|
|
+<li><p>默认 demo 采用组件库安装的形式,在 <a class="reference external" href="https://components.espressif.com/">https://components.espressif.com/</a> 中搜索 cherryusb 即可</p></li>
|
|
|
</ul>
|
|
|
</section>
|
|
|
<section id="id1">
|
|
|
@@ -211,22 +213,28 @@
|
|
|
<h2>基于 Essemi 系列芯片<a class="headerlink" href="#essemi" title="Link to this heading"></a></h2>
|
|
|
<p>仓库参考:<a class="reference external" href="https://github.com/CherryUSB/cherryusb_es32">https://github.com/CherryUSB/cherryusb_es32</a></p>
|
|
|
<ul class="simple">
|
|
|
-<li><p>支持全速和高速主从机</p></li>
|
|
|
+<li><p>支持全速和高速主从机。device 支持 6 个端点(包括端点0),并且可以同时使用双向。</p></li>
|
|
|
</ul>
|
|
|
</section>
|
|
|
<section id="nxp-mcx">
|
|
|
<h2>基于 NXP MCX系列芯片<a class="headerlink" href="#nxp-mcx" title="Link to this heading"></a></h2>
|
|
|
<p>仓库参考:<a class="reference external" href="https://github.com/CherryUSB/cherryusb_mcx">https://github.com/CherryUSB/cherryusb_mcx</a> 或者 <a class="reference external" href="https://github.com/RT-Thread/rt-thread/tree/master/bsp/nxp/mcx">https://github.com/RT-Thread/rt-thread/tree/master/bsp/nxp/mcx</a></p>
|
|
|
<ul class="simple">
|
|
|
-<li><p>支持全速 IP 和高速 IP, 高速 IP 支持主机和从机</p></li>
|
|
|
-<li><p>支持全速和高速主从机</p></li>
|
|
|
+<li><p>支持全速 IP 和高速 IP, 高速 IP 支持主机和从机。device 支持 8 个端点(包括端点0),并且可以同时使用双向。</p></li>
|
|
|
</ul>
|
|
|
</section>
|
|
|
<section id="artinchip">
|
|
|
<h2>基于 Artinchip 系列芯片<a class="headerlink" href="#artinchip" title="Link to this heading"></a></h2>
|
|
|
<p>仓库参考:<a class="reference external" href="https://gitee.com/artinchip/luban-lite">https://gitee.com/artinchip/luban-lite</a></p>
|
|
|
<ul class="simple">
|
|
|
-<li><p>支持全速和高速主从机,主机采用 EHCI + OHCI。</p></li>
|
|
|
+<li><p>支持全速和高速主从机,主机采用 EHCI + OHCI。device 支持 8 个端点(包括端点0),并且可以同时使用双向。</p></li>
|
|
|
+</ul>
|
|
|
+</section>
|
|
|
+<section id="canmv-k230">
|
|
|
+<h2>基于 canmv-k230 芯片<a class="headerlink" href="#canmv-k230" title="Link to this heading"></a></h2>
|
|
|
+<p>仓库参考:<a class="reference external" href="https://github.com/CherryUSB/k230_sdk">https://github.com/CherryUSB/k230_sdk</a></p>
|
|
|
+<ul class="simple">
|
|
|
+<li><p>K230: 两个 USB2.0 内置 HS PHY 芯片,支持主从机。device 支持 16 个端点(包括端点0),并且可以同时使用双向。</p></li>
|
|
|
</ul>
|
|
|
</section>
|
|
|
<section id="st">
|
|
|
@@ -235,8 +243,8 @@
|
|
|
<p>默认提供以下 demo 工程:</p>
|
|
|
<ul class="simple">
|
|
|
<li><p>F103 使用 fsdev ip</p></li>
|
|
|
-<li><p>F429 主从使用 USB1, 引脚 pb14/pb15, 并且都使用 dma 模式</p></li>
|
|
|
-<li><p>H7 设备使用 USB0, 引脚 pa11/pa12,没有开DMA 模式。主机使用 USB1 ,引脚 pb14/pb15,并且需要做 nocache 处理</p></li>
|
|
|
+<li><p>F429 主从使用 USB1, 引脚 pb14/pb15, 默认从机没有开启 DMA 模式</p></li>
|
|
|
+<li><p>H7 设备使用 USB0, 引脚 pa11/pa12,没有开 DMA 模式。主机使用 USB1 ,引脚 pb14/pb15,并且需要做 nocache 处理</p></li>
|
|
|
</ul>
|
|
|
<p>demo 底下提供了 <strong>stm32xxx.ioc</strong> 文件,双击打开,点击 <strong>Generate Code</strong> 即可。</p>
|
|
|
<div class="admonition caution">
|
|
|
@@ -247,7 +255,7 @@
|
|
|
<ul class="simple">
|
|
|
<li><p>usb ip 区别:F1使用 fsdev,F4/H7使用 dwc2</p></li>
|
|
|
<li><p>dwc2 ip 区别: USB0 (引脚是 PA11/PA12) 和 USB1 (引脚是 PB14/PB15), 其中 USB1 默认全速,可以接外部PHY 形成高速主机,并且带 dma 功能</p></li>
|
|
|
-<li><p>F4 无cache,H7 有 cache</p></li>
|
|
|
+<li><p>F4 无 cache,H7 有 cache</p></li>
|
|
|
</ul>
|
|
|
<p>如果是 STM32F7/STM32H7 这种带 cache 功能,需要将 usb 使用到的 ram 定位到 no cache ram 区域。举例如下</p>
|
|
|
<div class="highlight-C notranslate"><div class="highlight"><pre><span></span><span class="n">cpu_mpu_config</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span><span class="w"> </span><span class="n">MPU_Normal_NonCache</span><span class="p">,</span><span class="w"> </span><span class="mh">0x24070000</span><span class="p">,</span><span class="w"> </span><span class="n">MPU_REGION_SIZE_64KB</span><span class="p">);</span>
|
|
|
@@ -339,10 +347,9 @@
|
|
|
</pre></div>
|
|
|
</div>
|
|
|
<ul class="simple">
|
|
|
-<li><p>如果使用 fsdev ip,(V1.5.0 开始需要增加 <strong>fsdev/usb_glue_st.c</strong>) 在 <cite>usb_config.h</cite> 中实现以下宏:</p></li>
|
|
|
+<li><p>如果使用 fsdev ip,(V1.5.0 开始需要增加 <strong>fsdev/usb_glue_st.c</strong>) 在 <cite>usb_config.h</cite> 中实现以下宏,具体数值不同芯片不一样:</p></li>
|
|
|
</ul>
|
|
|
-<div class="highlight-C notranslate"><div class="highlight"><pre><span></span><span class="cp">#define CONFIG_USBDEV_EP_NUM 8</span>
|
|
|
-<span class="cp">#define CONFIG_USBDEV_FSDEV_PMA_ACCESS 2</span>
|
|
|
+<div class="highlight-C notranslate"><div class="highlight"><pre><span></span><span class="cp">#define CONFIG_USBDEV_FSDEV_PMA_ACCESS 2</span>
|
|
|
</pre></div>
|
|
|
</div>
|
|
|
<ul class="simple">
|
|
|
@@ -385,7 +392,7 @@
|
|
|
<h3>USB Host 移植要点<a class="headerlink" href="#usb-host" title="Link to this heading"></a></h3>
|
|
|
<p>前面 6 步与 Device 一样。需要注意,host 驱动只支持带 dma 的 hs port (引脚是 PB14/PB15),所以 fs port (引脚是 PA11/PA12)不做支持(没有 dma 你玩什么主机)。</p>
|
|
|
<ul class="simple">
|
|
|
-<li><p>添加 CherryUSB 必须要的源码( <strong>usbh_core.c</strong> 、 <strong>usbh_hub.c</strong> 、 <strong>usb_hc_dwc2.c</strong> 、以及 <strong>osal</strong> 目录下的适配层文件),以及想要使用的 class 驱动,并且可以将对应的 <strong>usb host.c</strong> 添加方便测试。</p></li>
|
|
|
+<li><p>添加 CherryUSB 必须要的源码( <strong>usbh_core.c</strong> 、 <strong>usbh_hub.c</strong> 、 <strong>usb_hc_dwc2.c</strong> 、 <strong>usb_glue_st.c</strong> 以及 <strong>osal</strong> 目录下的适配层文件),以及想要使用的 class 驱动,并且可以将对应的 <strong>usb host.c</strong> 添加方便测试。</p></li>
|
|
|
</ul>
|
|
|
<figure class="align-default">
|
|
|
<img alt="../_images/stm32_16.png" src="../_images/stm32_16.png" />
|
|
|
@@ -401,16 +408,7 @@
|
|
|
</figure>
|
|
|
<ul class="simple">
|
|
|
<li><p>复制一份 <strong>cherryusb_config_template.h</strong>,放到 <cite>Core/Inc</cite> 目录下,并命名为 <cite>usb_config.h</cite></p></li>
|
|
|
-<li><p>增加 <strong>usb_glue_st.c</strong> 文件,并在 <cite>usb_config.h</cite> 中实现以下宏:</p></li>
|
|
|
</ul>
|
|
|
-<div class="highlight-C notranslate"><div class="highlight"><pre><span></span><span class="c1">// 以下细节如有出入,请对照 stm32xxx.h 文件修改</span>
|
|
|
-<span class="c1">// 需要根据硬件实际的 fifo 深度进行修改,默认是最基础的配置</span>
|
|
|
-<span class="cp">#define CONFIG_USBHOST_PIPE_NUM 12</span>
|
|
|
-<span class="cp">#define CONFIG_USB_DWC2_NPTX_FIFO_SIZE (512 / 4)</span>
|
|
|
-<span class="cp">#define CONFIG_USB_DWC2_PTX_FIFO_SIZE (1024 / 4)</span>
|
|
|
-<span class="cp">#define CONFIG_USB_DWC2_RX_FIFO_SIZE ((1012 - CONFIG_USB_DWC2_NPTX_FIFO_SIZE - CONFIG_USB_DWC2_PTX_FIFO_SIZE) / 4)</span>
|
|
|
-</pre></div>
|
|
|
-</div>
|
|
|
<div class="admonition note">
|
|
|
<p class="admonition-title">Note</p>
|
|
|
<p>以下两个步骤从 V1.5.0 开始不再需要,<strong>fsdev/usb_glue_st.c</strong>, <strong>dwc2/usb_glue_st.c</strong> 文件中已经实现</p>
|