initial commit

This commit is contained in:
shell committed 2026-10-11 21:48:59 +08:00
commit b44ce7bd77
2716 files changed
+559005

No files matched your search

+13
View File
@@ -0,0 +1,13 @@
.clear-both {
clear: both;
}
.sidebar-sponsor {
display: flex;
justify-content: center;
padding: 0.4rem var(--sidebar-item-spacing-horizontal) 0.6rem;
}
.sidebar-sponsor iframe {
border: 0;
border-radius: 6px;
}
+11
View File
@@ -0,0 +1,11 @@
{# Override furo's sidebar brand: keep the original (logo, links home), then add
a GitHub Sponsors button just below it. Using "!sidebar/brand.html" includes
the theme's own template, so we don't re-list furo's sidebar components and
stay decoupled from furo's internal layout. #}
{% include "!sidebar/brand.html" %}
<div class="sidebar-sponsor">
<iframe src="https://github.com/sponsors/hathach/button"
title="Sponsor TinyUSB"
height="32" width="114"
loading="lazy"></iframe>
</div>
+21
View File
@@ -0,0 +1,21 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Layer_1" x="0px" y="0px" style="enable-background:new 0 0 1382 768;" xml:space="preserve" width="224" height="89.6" viewBox="-56 -57.19 1490 595.81">
<style type="text/css">
.st0{fill:#000;}
</style>
<rect x="-56" y="-57.19" width="1490" height="595.81" rx="60" ry="60" fill="#fff"/>
<g>
<g>
<g>
<path class="st0" d="M402.26,321.44c6.2-6.18,13.5-8.71,27.53-8.71h56.48c15.72,0,25,2.79,30.63,8.71 c7.04,6.99,9.28,15.16,9.28,41.28v104.52h-43v-17.68c-18.55,15.16-25.28,17.96-39.05,17.96h-21.09 c-13.76,0-21.07-1.68-27.24-7.83c-5.35-5.37-8.97-14.36-8.97-34.57c0-19.11,2.79-30.92,9.56-37.67c7-7.02,15.99-10.4,43.79-10.4 c14.91,0,30.36,1.71,43.01,4.5v-13.77c0-15.17-0.85-18.26-2.82-20.51c-1.98-1.71-4.78-2.28-11.24-2.28h-21.62 c-5.91,0-9.01,0.57-10.7,2.28c-2.24,2.25-2.53,5.34-3.09,14.61h-40.71C393.27,336.06,395.8,327.58,402.26,321.44z M483.18,428.75 v-25.84h-28.36c-16.32,0-20.25,1.12-23.06,3.91c-2.79,2.84-3.36,6.2-3.36,13.23c0,7.88,0.57,12.08,2.81,14.34 c2.25,2.22,5.33,2.5,10.95,2.5h12.07C463.24,436.88,469.13,436.06,483.18,428.75z"/>
<path class="st0" d="M642.16,467.24V447.3c-19.39,16.87-26.14,20.23-38.79,20.23h-16.28c-16.32,0-25.01-2.8-31.74-9.54 c-9.26-9.26-12.93-22.78-12.93-68.01c0-45.52,4.47-58.42,14.03-67.99c6.76-6.72,15.73-9.53,31.18-9.53h16.86 c12.92,0,19.95,2.81,37.67,17.69V259.9h43v207.34H642.16z M642.16,426.5v-73.6c-9.01-4.21-15.47-6.17-22.49-6.17h-15.43 c-7.88,0-11.57,1.11-14.08,3.64c-3.93,3.64-5.03,10.13-5.03,39.6c0,29.5,1.11,35.7,5.03,39.65c2.51,2.5,6.2,3.37,14.08,3.37 h14.02C625.57,432.99,632.58,431,642.16,426.5z"/>
<path class="st0" d="M716.83,321.44c6.17-6.18,13.49-8.71,27.52-8.71h56.49c15.73,0,24.99,2.79,30.64,8.71 c7.01,6.99,9.26,15.16,9.26,41.28v104.52h-43v-17.68c-18.54,15.16-25.29,17.96-39.05,17.96h-21.05 c-13.78,0-21.11-1.68-27.26-7.83c-5.35-5.37-9.01-14.36-9.01-34.57c0-19.11,2.81-30.92,9.56-37.67 c7.03-7.02,16.02-10.4,43.83-10.4c14.91,0,30.34,1.71,42.99,4.5v-13.77c0-15.17-0.84-18.26-2.81-20.51 c-1.94-1.71-4.79-2.28-11.24-2.28h-21.63c-5.91,0-8.99,0.57-10.67,2.28c-2.27,2.25-2.53,5.34-3.12,14.61h-40.72 C707.84,336.06,710.38,327.58,716.83,321.44z M797.74,428.75v-25.84h-28.35c-16.31,0-20.26,1.12-23.05,3.91 c-2.81,2.84-3.38,6.2-3.38,13.23c0,7.88,0.57,12.08,2.82,14.34c2.24,2.22,5.32,2.5,10.95,2.5h12.06 C777.8,436.88,783.7,436.06,797.74,428.75z"/>
<path class="st0" d="M856.96,467.24V305.41c0-19.39,2.55-29.52,9.01-35.96c6.47-6.46,13.77-9.55,30.34-9.55h35.41v32.57h-20.82 c-5.6,0-7.28,0.57-8.96,1.96c-1.42,1.71-1.96,4.75-1.96,12.38v6.19h31.75v33.44h-31.48v120.79H856.96z"/>
<path class="st0" d="M947.94,467.24V312.72h42.96v23.59c16.04-16.59,24.17-23.87,36.53-23.87H1044v42.42h-19.94 c-11.79,0-20.78,1.11-33.16,6.17v106.2H947.94z"/>
<path class="st0" d="M1199.3,312.72v154.52h-43.27v-20.48c-19.66,17.69-26.13,20.77-40.18,20.77h-18.82 c-13.49,0-21.92-2.8-27.79-8.71c-6.2-6.46-9-14.59-9-37.1v-109h43.27v104.24c0,6.44,0.83,10.11,3.36,12.66 c2.53,2.5,5.06,3.37,12.64,3.37h12.39c7.28,0,13.77-1.71,24.13-6.2V312.72H1199.3z"/>
<path class="st0" d="M1257.74,291.34h-42.42V259.9h42.42V291.34z M1257.74,467.24h-42.42V312.72h42.42V467.24z"/>
<path class="st0" d="M1349,433.26h-18.53c-7.06,0-9.86-0.59-11.24-1.7c-1.42-1.69-1.98-3.93-1.98-10.68v-74.44H1349v-33.72 h-31.75v-21.38h-43.27v21.38v33.72v85.97c0,15.73,1.96,22.76,7.03,27.81c5.34,5.35,13.19,8.4,27.82,8.4 c11.51,0,23.04-1.68,29.78-3.36l10.39-2.7V433.26z"/>
</g>
</g>
<path class="st0" d="M469.56,213.53c-1.48-9.33-6.54-12.01-18.77-15.91c-9.28-2.98-71.47-22.79-71.47-22.79 s-43.35-16.38-75.48,6.78c-4.32,3.13-8.81,6.68-13.31,10.47c3.78-4.5,7.34-8.99,10.45-13.31c23.09-32.18,6.65-75.5,6.65-75.5 s-19.91-62.13-22.92-71.44c-3.93-12.2-6.6-17.27-15.94-18.72c-9.36-1.48-13.45,2.5-20.94,12.92c-5.71,7.91-43.77,60.94-43.77,60.94 s-28.94,36.16-16.87,73.88c1.64,5.06,3.63,10.43,5.86,15.89c-3.13-5-6.3-9.76-9.46-14.05c-23.47-31.89-69.73-29.66-69.73-29.66 s-65.26-0.26-75.02-0.27c-12.83-0.05-18.46,0.95-22.76,9.37c-4.29,8.42-1.75,13.57,5.83,23.9c5.76,7.88,44.44,60.45,44.44,60.45 s25.44,38.72,65.03,38.88c5.32,0.03,11.02-0.22,16.88-0.64c-5.69,1.42-11.19,2.98-16.24,4.64c-37.59,12.46-49.74,57.17-49.74,57.17 s-20.42,61.99-23.46,71.27c-3.98,12.18-4.79,17.84,1.9,24.51c6.69,6.7,12.36,5.87,24.53,1.85c9.27-3.03,71.24-23.58,71.24-23.58 s44.66-12.24,57.04-49.85c1.68-5.06,3.2-10.55,4.63-16.22c-0.42,5.84-0.64,11.53-0.6,16.85c0.21,39.6,38.98,64.98,38.98,64.98 s52.64,38.55,60.52,44.31c10.37,7.55,15.5,10.08,23.93,5.78c8.41-4.3,9.39-9.93,9.33-22.77c-0.04-9.75-0.43-75.01-0.43-75.01 s2.18-46.27-29.76-69.68c-4.3-3.15-9.05-6.31-14.03-9.41c5.44,2.19,10.79,4.18,15.87,5.77c37.72,12.03,73.85-16.98,73.85-16.98 s52.94-38.15,60.85-43.87C467.06,226.99,471.04,222.86,469.56,213.53z M244.76,165.48c7.13,1.11,10.66,16.26,7.87,33.82 c-2.75,17.56-10.75,30.88-17.88,29.76c-7.11-1.13-10.65-16.26-7.89-33.82C229.63,177.69,237.64,164.36,244.76,165.48z M153.6,212.02c3.25-6.43,18.75-5.09,34.57,2.96c15.85,8.05,26.05,19.8,22.78,26.22c-3.27,6.41-18.75,5.1-34.59-2.95 C160.52,230.2,150.33,218.45,153.6,212.02z M201.66,299.59c-12.56,12.58-26.87,18.63-31.96,13.54 c-5.11-5.09,0.94-19.41,13.49-31.99c12.55-12.59,26.86-18.65,31.97-13.56C220.27,272.68,214.23,287.01,201.66,299.59z M270.82,329.06c-6.43,3.27-18.19-6.89-26.26-22.71c-8.08-15.84-9.43-31.34-3-34.61c6.41-3.27,18.15,6.9,26.24,22.73 C275.88,310.29,277.25,325.78,270.82,329.06z M287.49,255.75c-17.55,2.81-32.7-0.71-33.83-7.82c-1.13-7.12,12.18-15.16,29.74-17.95 c17.54-2.79,32.69,0.71,33.82,7.82C318.35,244.91,305.05,252.96,287.49,255.75z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 5.6 KiB

+18
View File
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="280" height="140" version="1.1" viewBox="0 0 74.083 37.042" xmlns="http://www.w3.org/2000/svg">
<g transform="translate(-60.931 -79.245)">
<g transform="matrix(1.0442 0 0 1.1531 -27.105 33.588)" fill="#fff">
<path d="m86.972 39.594c-1.4683 3.2e-5 -2.6588 1.181-2.66 2.6384v26.844c3.3e-5 1.4583 1.1909 2.6404 2.66 2.6404h65.63c1.469-3.2e-5 2.66-1.1822 2.66-2.6404v-26.844c-1e-3 -1.4575-1.1917-2.6384-2.66-2.6384z" color="#000000" fill="#fff" style="-inkscape-stroke:none"/>
</g>
<g transform="matrix(.35278 0 0 -.35278 -160.36 421.93)" fill="#231f20">
<path transform="translate(672.09 955.48)" d="m0 0h-21.484v-12.601h-5.349v-6.436h5.349v-25.383c0-11.331 7.252-13.87 17.223-13.87 4.352 0 8.613 0.272 12.873 0.907v6.073c-0.816-0.09-2.266-0.362-3.535-0.362-3.807 0-5.077 0.816-5.077 4.896v27.739h8.612v6.436h-8.612z"/>
<path transform="translate(693.61 925.33)" d="m0 0h-0.049c-1.518 0-2.165-0.896-2.165-2.24v-0.05h4.504v0.05c0 1.344-0.771 2.24-2.29 2.24"/>
<path transform="translate(700.92 925.5)" d="m0 0h-0.124c-1.443 0-2.265-0.995-2.265-2.389v-0.074h4.654v0.074c0 1.394-0.822 2.389-2.265 2.389"/>
<path transform="translate(750.09 943.78)" d="m0 0c-6.165 0-11.876-2.267-14.505-5.893v4.986h-20.578v-45.326h21.484v36.533c1.27 0.272 2.449 0.453 3.717 0.453 4.715 0 5.44-2.538 5.44-6.436v-30.55h21.484v30.278c0 11.694-7.523 15.955-17.042 15.955"/>
<path transform="translate(811.83 942.88)" d="m0 0-10.516-23.57-11.784 23.57h-23.388l24.204-48.046-6.799-15.411h8.249l28.193 63.457z"/>
<path transform="translate(706 920)" d="m0 0h-17.421v2.637c0 2.938 1.194 5.675 4.43 5.675h0.124c2.24 0 3.335-1.269 3.932-2.514 0.647 1.469 1.667 2.738 3.883 2.738h0.224c3.086 0 4.828-2.39 4.828-5.774zm-0.598-9.412h-3.16c0.622 1.07 0.971 1.917 0.971 2.737 0 0.871-0.424 1.618-1.493 1.618h-0.05c-0.797 0-1.394-0.249-3.037-1.692-2.339-2.065-3.459-2.912-5.574-2.912h-0.05c-2.787 0-4.555 1.816-4.555 4.231 0 1.219 0.175 1.941 0.548 2.687h3.161c-0.548-0.945-0.797-1.518-0.797-2.314 0-0.845 0.548-1.568 1.493-1.568h0.05c0.821 0 1.12 0.25 2.788 1.692 2.762 2.39 3.832 2.912 5.824 2.912h0.048c2.739 0 4.555-1.917 4.555-4.305 0-1.195-0.298-2.215-0.722-3.086m-4.479-10.93h-12.344v3.011h12.643c1.567 0 2.189 0.548 2.189 1.319 0 0.772-0.622 1.32-2.189 1.32h-12.643v3.01h12.344c3.658 0 5.301-1.841 5.301-4.33 0-2.488-1.643-4.33-5.301-4.33m-9.641 53.817h12.114v-10.601h-12.114zm14.114 2h-16.114v-12.601h-2.685v-45.326h21.484v45.326h-2.685z"/>
<path d="m692.79 947.02h2.827v2.319h-2.827z"/>
<path d="m699.06 947.02h2.826v2.319h-2.826z"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.6 KiB

+1
View File
@@ -0,0 +1 @@
<svg version="1.1" viewBox="0.0 0.0 510.73490813648294 310.08923884514434" fill="none" stroke="none" stroke-linecap="square" stroke-miterlimit="10" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg"><clipPath id="p.0"><rect x="0" y="0" width="510.73490813648294" height="310.08923884514434" rx="20" ry="20"/></clipPath><g clip-path="url(#p.0)"><rect fill="#ffffff" x="0" y="0" width="510.73490813648294" height="310.08923884514434" rx="20" ry="20"/><path fill="#cfe2f3" d="m28.509478 231.92447l192.28346 0l0 48.629913l-192.28346 0z" fill-rule="evenodd"/><path stroke="#000000" stroke-width="1.0" stroke-linejoin="round" stroke-linecap="butt" d="m28.509478 231.92447l192.28346 0l0 48.629913l-192.28346 0z" fill-rule="evenodd"/><path fill="#000000" d="m55.37576 252.31943l0 -10.484375l1.390625 0l0 4.296875l5.453125 0l0 -4.296875l1.390625 0l0 10.484375l-1.390625 0l0 -4.9375l-5.453125 0l0 4.9375l-1.390625 0zm9.8967705 -3.796875q0 -2.109375 1.171875 -3.125q0.984375 -0.84375 2.390625 -0.84375q1.578125 0 2.5625 1.03125q1.0 1.015625 1.0 2.828125q0 1.46875 -0.4375 2.3125q-0.4375 0.828125 -1.28125 1.296875q-0.84375 0.46875 -1.84375 0.46875q-1.59375 0 -2.578125 -1.015625q-0.984375 -1.03125 -0.984375 -2.953125zm1.328125 0q0 1.453125 0.625 2.1875q0.640625 0.71875 1.609375 0.71875q0.96875 0 1.59375 -0.71875q0.640625 -0.734375 0.640625 -2.234375q0 -1.40625 -0.640625 -2.125q-0.640625 -0.734375 -1.59375 -0.734375q-0.96875 0 -1.609375 0.71875q-0.625 0.71875 -0.625 2.1875zm6.791733 1.53125l1.265625 -0.203125q0.109375 0.765625 0.59375 1.171875q0.5 0.40625 1.375 0.40625q0.890625 0 1.3125 -0.359375q0.4375 -0.359375 0.4375 -0.84375q0 -0.4375 -0.375 -0.6875q-0.265625 -0.171875 -1.3125 -0.4375q-1.421875 -0.359375 -1.96875 -0.609375q-0.546875 -0.265625 -0.828125 -0.734375q-0.28125 -0.46875 -0.28125 -1.015625q0 -0.515625 0.21875 -0.9375q0.234375 -0.4375 0.640625 -0.734375q0.296875 -0.21875 0.8125 -0.359375q0.53125 -0.15625 1.125 -0.15625q0.890625 0 1.5625 0.265625q0.671875 0.25 1.0 0.6875q0.328125 0.4375 0.4375 1.171875l-1.25 0.171875q-0.09375 -0.578125 -0.5 -0.90625q-0.40625 -0.34375 -1.15625 -0.34375q-0.890625 0 -1.28125 0.296875q-0.375 0.296875 -0.375 0.6875q0 0.25 0.15625 0.453125q0.15625 0.203125 0.5 0.34375q0.1875 0.078125 1.140625 0.328125q1.359375 0.359375 1.890625 0.59375q0.546875 0.234375 0.859375 0.6875q0.3125 0.4375 0.3125 1.09375q0 0.640625 -0.375 1.21875q-0.375 0.5625 -1.09375 0.875q-0.703125 0.3125 -1.59375 0.3125q-1.484375 0 -2.265625 -0.609375q-0.765625 -0.625 -0.984375 -1.828125zm10.65625 1.109375l0.1875 1.140625q-0.546875 0.109375 -0.984375 0.109375q-0.6875 0 -1.078125 -0.21875q-0.390625 -0.21875 -0.546875 -0.578125q-0.15625 -0.359375 -0.15625 -1.515625l0 -4.375l-0.953125 0l0 -1.0l0.953125 0l0 -1.890625l1.28125 -0.765625l0 2.65625l1.296875 0l0 1.0l-1.296875 0l0 4.4375q0 0.546875 0.0625 0.71875q0.078125 0.15625 0.21875 0.25q0.15625 0.078125 0.453125 0.078125q0.203125 0 0.5625 -0.046875zm12.972076 -2.515625l1.390625 0.34375q-0.4375 1.703125 -1.578125 2.609375q-1.125 0.890625 -2.765625 0.890625q-1.6875 0 -2.75 -0.6875q-1.0625 -0.6875 -1.625 -2.0q-0.546875 -1.3125 -0.546875 -2.8125q0 -1.640625 0.625 -2.859375q0.625 -1.21875 1.78125 -1.84375q1.15625 -0.640625 2.546875 -0.640625q1.5625 0 2.640625 0.8125q1.078125 0.796875 1.5 2.25l-1.375 0.3125q-0.359375 -1.140625 -1.0625 -1.65625q-0.6875 -0.53125 -1.734375 -0.53125q-1.21875 0 -2.03125 0.578125q-0.8125 0.578125 -1.140625 1.5625q-0.328125 0.96875 -0.328125 2.015625q0 1.328125 0.390625 2.328125q0.390625 1.0 1.21875 1.5q0.828125 0.484375 1.78125 0.484375q1.171875 0 1.96875 -0.671875q0.8125 -0.671875 1.09375 -1.984375zm2.4592743 -0.125q0 -2.109375 1.171875 -3.125q0.984375 -0.84375 2.390625 -0.84375q1.578125 0 2.5625 1.03125q1.0 1.015625 1.0 2.828125q0 1.46875 -0.4375 2.3125q-0.4375 0.828125 -1.28125 1.296875q-0.84375 0.46875 -1.84375 0.46875q-1.59375 0 -2.578125 -1.015625q-0.984375 -1.03125 -0.984375 -2.953125zm1.328125 0q0 1.453125 0.625 2.1875q0.640625 0.71875 1.609375 0.71875q0.96875 0 1.59375 -0.71875q0.640625 -0.734375 0.640625 -2.234375q0 -1.40625 -0.640625 -2.125q-0.640625 -0.734375 -1.59375 -0.734375q-0.96875 0 -1.609375 0.71875q-0.625 0.71875 -0.625 2.1875zm7.307358 3.796875l0 -7.59375l1.15625 0l0 1.078125q0.84375 -1.25 2.421875 -1.25q0.6875 0 1.265625 0.25q0.578125 0.234375 0.859375 0.640625q0.28125 0.40625 0.40625 0.953125q0.0625 0.359375 0.0625 1.25l0 4.671875l-1.28125 0l0 -4.625q0 -0.78125 -0.15625 -1.171875q-0.15625 -0.390625 -0.546875 -0.625q-0.375 -0.234375 -0.890625 -0.234375q-0.8125 0 -1.421875 0.53125q-0.59375 0.515625 -0.59375 1.96875l0 4.15625l-1.28125 0zm10.963608 -1.15625l0.1875 1.140625q-0.546875 0.109375 -0.984375 0.109375q-0.6875 0 -1.078125 -0.21875q-0.390625 -0.21875 -0.546875 -0.578125q-0.15625 -0.359375 -0.15625 -1.515625l0 -4.375l-0.953125 0l0 -1.0l0.953125 0l0 -1.890625l1.28125 -0.765625l0 2.65625l1.296875 0l0 1.0l-1.296875 0l0 4.4375q0 0.546875 0.0625 0.71875q0.078125 0.15625 0.21875 0.25q0.15625 0.078125 0.453125 0.078125q0.2Line truncated

After

Width:  |  Height:  |  Size: 84 KiB

+71
View File
@@ -0,0 +1,71 @@
# 0.10.0
*May 28, 2021*
- Rework tu_fifo_t with separated mutex for read and write, better support DMA with read/write buffer info. And constant address mode
- Improve audio_test example and add audio_4_channel_mic example
- Add new dfu example
- Remove pico-sdk from submodule
## Device Controller Driver (DCD)
- Add new DCD port for Silabs EFM32GG12 with board Thunderboard Kit (SLTB009A)
- Add new DCD port Renesas RX63N, board GR-CITRUS
- Add new (optional) endpoint API dcd_edpt_xfer_fifo
- Fix build with nRF5340
- Fix build with lpc15 and lpc54
- Fix build with lpc177x_8x
- STM32 Synopsys: greatly improve Isochronous transfer with `edpt_xfer_fifo()` API
- Support LPC55 port1 highspeed
- Add support for Espressif esp32s3
- nRF: fix race condition that could cause drop packet of Bulk OUT transfer
## USB Device Driver (USBD)
- Add new (optional) endpoint ADPI `usbd_edpt_xfer_fifo()`
## Device Class Driver
### CDC
- [Breaking] `tud_cdc_peek()`, `tud_vendor_peek()` no longer support random offset and dropped position parameter.
### DFU
- Add new DFU 1.1 class driver (WIP)
### HID
- Fix keyboard report descriptor template
- Add more hid keys constant from 0x6B to 0xA4
- [Breaking] rename API
- `HID_PROTOCOL_NONE/KEYBOARD/MOUSE` to `HID_ITF_PROTOCOL_NONE/KEYBOARD/MOUSE`
- `tud_hid_boot_mode()` to `tud_hid_get_protocol()`
- `tud_hid_boot_mode_cb()` to `tud_hid_set_protocol_cb()`
### MIDI
- Fix MIDI buffer overflow issue
- [Breaking] rename API
- Rename `tud_midi_read()` to `tud_midi_stream_read()`
- Rename `tud_midi_write()` to `tud_midi_stream_write()`
- Rename `tud_midi_receive()` to `tud_midi_packet_read()`
- Rename `tud_midi_send()` to `tud_midi_packet_write()`
## Host Controller Driver (HCD)
- No noticeable changes
## USB Host Driver (USBH)
- No noticeable changes
## Host Class Driver
- HID: Rework host hid driver, basically everything changes
## Contributors
Thanks to everyone who contributed to this release: @alisitsyn, @corvus-ossifragus, @hathach, @jgressmann, @joeycastillo, @kapacuk, @kasjer, @kkitayam, @ned-pcs, @noodlefighter, @ogatatsu, @PanRe, @perigoso, @pigrew, @sjanc, @xmos-jmccarthy.
+17
View File
@@ -0,0 +1,17 @@
# 0.10.1
*June 2, 2021*
- rework rp2040 examples and CMake build, allow better integration with pico-sdk
## Host Controller Driver (HCD)
- Fix rp2040 host driver: incorrect PID with low speed device with max packet size of 8 bytes
- Improve hub driver
- Remove obsolete `hcd_pipe_queue_xfer()`/`hcd_pipe_xfer()`
- Use `hcd_frame_number()` instead of micro frame
- Fix OHCI endpoint address and `xferred_bytes` in xfer complete event
## Contributors
Thanks to everyone who contributed to this release: @hathach, @kilograham.
+90
View File
@@ -0,0 +1,90 @@
# 0.11.0
*August 30, 2021*
- Add host/hid_controller example: only worked/tested with Sony PS4 DualShock controller
- Add device/hid_boot_interface example
- Add support for Renesas CCRX toolchain for RX mcu
## Device Controller Driver (DCD)
- Add new DCD port for SAMx7x (E70, S70, V70, V71)
- Add new mcu K32L2Bxx
- Add new mcu GD32VF103
- Add new mcu STM32l151
- Add new mcu SAML21
- Add new mcu RX65n RX72n
- Fix NUC120/121/126 USBRAM can only be accessed in byte manner. Also improve set_address & disable sof
- Add Suspend/Resume handling for Renesas RX family.
- Fix DA1469x no VBUS startup
### Synopsys
- Fix Synopsys set address bug which could cause re-enumeration failed
- Fix `dcd_synopsys` driver integer overflow in HS mode (issue #968)
### nRF5x
- Add nRF5x suspend, resume and remote wakeup
- Fix nRF5x race condition with `TASKS_EP0RCVOUT`
### RP2040
- Add RP2040 suspend & resume support
- Implement double buffer for both host and device (#891). However device EPOUT is still single buffered due to technical issue with short packet
## Device Stack
### USBD
- Better support big endian mcu
- Add `tuh_inited()` and `tud_inited()`, will separate `tusb_init/inited()` to `tud/tuh_init/inited()`
- Add `dcd_attr.h` for defining common controller attribute such as max endpoints
### Bluetooth
- Fix stridx error in descriptor template
### DFU
- Enhance DFU implementation to support multiple alternate interface and better support `bwPollTimeout`
- Rename `CFG_TUD_DFU_MODE` to simply `CFG_TUD_DFU`
### HID
- Fix newline usage keyboard (ENTER 0x28)
- Better support Hid Get/Set report
- Change max gamepad support from 16 to 32 buttons
### MIDI
- Fix midi available
- Fix midi data
- Fix an issue when calling midi API when not enumerated yet
### UAC2
- Fix bug and enhance of UAC2
### Vendor
- Fix vendor fifo deadlock in certain case
- Add `tud_vendor_n_read_flush()`
## Host Controller Driver (HCD)
### RP2040
- Implement double buffered to fix E4 errata and boost performance
- Lots of rp2040 update and enhancement
## Host Stack
- Major update and rework most of host stack, still needs more improvement
- Lots of improvement and update in parsing configuration and control
- Rework and major update to HID driver. Will default to enable boot interface if available
- Separate `CFG_TUH_DEVICE_MAX` and `CFG_TUH_HUB` for better management and reduce SRAM usage
## Contributors
Thanks to everyone who contributed to this release: @a-h, @BennyEvans, @ctag-fh-kiel, @DuMaM, @hathach, @HiFiPhile, @KarlK90, @kasjer, @kilograham, @kkitayam, @majbthrd, @mmosca, @mws-rmain, @ned-pcs, @nxf58843, @perigoso, @sabas1080, @salkinium, @tringis, @Wini-Buh, @xcguang, @xmos-jmccarthy, @zhangslice.
+31
View File
@@ -0,0 +1,31 @@
# 0.12.0
*October 19, 2021*
- add `CFG_TUSB_OS_INC_PATH` for os include path
## Device Controller Driver (DCD)
- Getting device stack to pass USB Compliance Verification test (chapter9, HID, MSC). Ports are tested:
nRF, SAMD 21/51, rp2040, stm32f4, Renesas RX, iMXRT, ESP32-S2/3, Kinetic KL25/32, DA146xx
- Added `dcd_edpt_close_all()` for switching configuration
- [Transdimension] Support `dcd_edpt_xfer_fifo()` with auto wrap over if fifo buffer is 4K aligned and size is multiple of 4K.
- [DA146xx] Improve vbus, reset, suspend, resume detection, and remote wakeup.
## Device Stack
- Add new network driver Network Control Model (CDC-NCM), update `net_lwip_webserver` to work with NCM (need re-configure example)
- Add new USB Video Class UVC 1.5 driver and video_capture example (work in progress)
- Fix potential buffer overflow for HID, bluetooth drivers
## Host Controller Driver (HCD)
No notable changes
## Host Stack
No notable changes
## Contributors
Thanks to everyone who contributed to this release: @Daft-Freak, @dshadoff, @hansfbaier, @hathach, @HiFiPhile, @kamtom480, @kasjer, @kkitayam, @majbthrd, @szymonh, @unlimitedcodeworks.
+42
View File
@@ -0,0 +1,42 @@
# 0.13.0
*February 23, 2022*
- [tu_fifo] Fix locked mutex when full, and return type in `peek_n()`
## Controller Driver (DCD & HCD)
- [DWC2] Generalize synopsys dwc2 with synopsys/dwc2 which support both FS and HS phy (UTMI and ULPI) for various MCUs.
- Broadcom 28/27xx on raspberrypi SBC
- Silicon Labs EFM32
- Espressif ESP32 Sx
- GigaDevice GD32
- ST STM32
- Infineon XMC
- [KL25] Add new HCD for NXP KL25
- [MUSB] Add new DCD and HCD for Mentor musb with TI MSP432E4
- [F1C100s] Add new DCD for Allwinner F1C100s family
- [PIC32MZ] Add new DCD for PIC32MZ
- [nRF] Fix/Enhance various race condition with: EASY DMA, request HFXO, EPOUT
- [ChipIdea] rename Transdimension to more popular ChipIdea Highspeed,
- [RP2040] various update/fix for hcd/dcd
- [FT9XX] new DCD port for Bridgetek FT90x and FT93x devices
- [DA1469X] Fix resume
- [OHCI] Fix device array out of bound
Note: legacy drivers such as st/synopsys, nxp/transdimension are still present in this release but won't receive more update and could be removed in the future.
## Device Stack
- [Audio] Support disabling feedback format correction (16.16 <-> 10.14 format)
- [MSC] Add `tud_msc_request_sense_cb()` callback, change most default sense error to medium not present (0x02, 0x3A, 0x00)
- [Video] Fix video_capture example fails enumeration when 8FPS
## Host Stack
No notable changes
## Contributors
Thanks to everyone who contributed to this release: @alisitsyn, @brtchip-gdm, @cr1901, @EmergReanimator, @hathach, @HiFiPhile, @JayToltTech, @jgressmann, @kasjer, @kkitayam, @leptun, @liamfraser, @majbthrd, @mkj, @mysterywolf, @NexusXe, @nxf58843, @perigoso, @rppicomidi, @Ryzee119, @scoudreau, @sharpie7, @suda-morris, @t123yh, @tannewt, @vmilea, @ZenithalHourlyRate.
+85
View File
@@ -0,0 +1,85 @@
# 0.14.0
*August 23, 2022*
- Improve compiler support for CCRX and IAR
- Add timeout to `osal_queue_receive()`
- Add `tud_task_ext(timeout, in_isr)` as generic version of `tud_task()`. Same as `tuh_task_ext()`, `tuh_task()`
- Enable more warnings `-Wnull-dereference -Wuninitialized -Wunused -Wredundant-decls -Wconversion`
## Add new examples
- `host/bare_api` to demonstrate generic (app-level) enumeration and endpoint transfer
- `dual/host_hid_to_device_cdc` to run both device and host stack concurrently, get HID report from host and print out to device CDC. This example only work with multiple-controller MCUs and rp2040 with the help of pio-usb as added controller.
## Controller Driver (DCD & HCD)
- Enhance rhports management to better support dual roles
- `CFG_TUD_ENABLED`/`CFG_TUH_ENABLED`, `CFG_TUD_MAX_SPEED`/`CFG_TUH_MAX_SPEED` can be used to replace `CFG_TUSB_RHPORT0_MODE`/`CFG_TUSB_RHPORT1_MODE`
- `tud_init(rhport)`, `tuh_init(rhport)` can be used to init stack on specified roothub port (controller) instead of `tusb_init(void)`
- Add dcd/hcd port specific defines `TUP_` (stand for tinyusb port-specific)
### dwc2
- Update to support stm32 h72x, h73x with only 1 otg controller
- Fix overwrite with grstctl when disable endpoint
### EHCI
- Fix an issue with EHCI driver
### msp430
- Fix for possible bug in msp430-elf-gcc 9.3.0
### nrf5x
- Fix DMA access race condition using atomic function
### pic32
- Fix PIC32 sanity
### rp2040
- Add PICO-PIO-USB as controller (device/host) support for rp2040
- Use shared IRQ handlers, so user can also hook the USB IRQ
- Fix resumed signal not reported to device stack
### stm32fsdev
- Add support for stm32wb55
## Device Stack
- [Audio] Add support for feedback endpoint computation
- New API `tud_audio_feedback_params_cb()`, `tud_audio_feedback_interval_isr()`.
- Supported computation method are: frequency with fixed/float or power of 2. Feedback with fifo count is not yet supported.
- Fix nitfs (should be 3) in `TUD_AUDIO_HEADSET_STEREO_DESCRIPTOR`
- Fix typo in `audiod_rx_done_cb()`
- [DFU] Fix coexistence with other interfaces BTH, RNDIS
- [MSC] Fix inquiry response additional length field
- [Vendor] Improve write performance
## Host Stack
- Add new API `tuh_configure(rhport, cfg_id, cfg_param)` for dynamic port specific behavior configuration
- [HID] Open OUT endpoint if available
- [Hub] hub clear port and device interrupts
### [USBH] Major improvement
- Rework usbh control transfer with complete callback. New API `tuh_control_xfer()` though still only carry 1 usbh (no queueing) at a time.
- Add generic endpoint transfer with `tuh_edpt_open()`, `tuh_edpt_xfer()`. Require `CFG_TUH_API_EDPT_XFER=1`
- Support app-level enumeration with new APIs
- `tuh_descriptor_get()`, `tuh_descriptor_get_device()`, `tuh_descriptor_get_configuration()`, `tuh_descriptor_get_hid_report()`
- `tuh_descriptor_get_string()`, `tuh_descriptor_get_manufacturer_string()`, `tuh_descriptor_get_product_string()`, `tuh_descriptor_get_serial_string()`
- Also add `_sync()` as sync/blocking version for above APIs
## Contributors
Thanks to everyone who contributed to this release: @alexandre-perrin, @ccrome, @cr1901, @Daft-Freak, @Firefishy, @hathach, @iabdalkader, @Iktek, @kasjer, @kilograham, @liamfraser, @M3gaFr3ak, @maddyaby, @majbthrd, @mingpepe, @Nikitarc, @perigoso, @phryniszak, @pigrew, @Qianhao2579, @robert-hh, @Ryzee119, @sjanc, @sknebel, @tannewt, @tfx2001, @Wini-Buh, @yoyopod.
+88
View File
@@ -0,0 +1,88 @@
# 0.15.0
*February 10, 2023*
- Add codespell to detect typo
- Add support for fuzzing and badge for oss-fuzz
- [osal]
- Allow the use of non-static allocation for FreeRTOS
- Fix FreeRTOS wrong task switch in some cases
- Fix tu_fifo memory overflown when repeatedly write to overwritable fifo (accumulated more than 2 depths)
- Better support for IAR (ARM) with ci build check for stm32 mcus.
- Fix Windows build for some mingw gnu make situations
## Controller Driver (DCD & HCD)
- Add new port support (WIP) for WCH CH32V307 USB Highspeed
- Add new port support (WIP) for PIC32MM/MX & PIC24
### nRF
- Fix endpoint internal state when closed
- Fix reception of large ISO packets
### rp2040
- [dcd] Implement workaround for Errata 15. This enable SOF when bulk-in endpoint is in use and reduce its bandwidth to only 80%
- [hcd] Fix shared irq slots filling up when `hcd_init()` is called multiple times
- [hcd] Support host bulk endpoint using hw "interrupt" endpoint. Note speed limit is 64KB/s
### samd
- [dcd] Add support for ISO endpoint
### dwc2
- [dcd] Add support for stm32u5xx
### esp32sx
- Fix Isochronous transfers only transmitted on even frame
### lpc_ip3511
- [dcd] Add isochronous support and fix endpoint accidental write
### ft90x
- Improve and enhance support for FT9xx MCU, tested with more examples
## Device Stack
### Video
- Add support for MJPEG
- Fix probe on macOS
### MIDI
- Support port name strings
- fix MS Header wTotalLength computation
### HID
- Add FIDO descriptor template
- change length in `tud_hid_report_complete_cb()` from `uint8_t` to `uint16_t`
### CDC
- Fix autoflush for FIFO < MPS
- Fix tx fifo memory overflown when DTR is not set and `tud_cdc_write()` is called repeatedly with large enough data
### USBTMC
- Fix packet size with highspeed
## Host Stack
- Retry a few times with transfers in enumeration since device can be unstable when starting up
- [MSC] Rework host mass storage API. Add new `host/msc_file_explorer` example
### CDC
- Add support for host cdc
- Fix host cdc with device without IAD e.g Arduino Due
## Contributors
Thanks to everyone who contributed to this release: @battlesnake, @benishor, @brtchip-gdm, @DRNadler, @gregdavill, @hadess, @hathach, @hfegran, @HiFiPhile, @jbruneaux31, @jmark1m, @kasjer, @kaysievers, @kilograham, @kkitayam, @kripton, @Lan-Hekary, @LynnL4, @maddyaby, @mingpepe, @nathaniel-brough, @P33M, @pete-pjb, @ReimuNotMoe, @rppicomidi, @scoudreau, @Skyler84, @Staacks, @tore-espressif, @tswan-quasi, @tyustli.
+148
View File
@@ -0,0 +1,148 @@
# 0.16.0
*November 24, 2023*
- New controller driver: MAX3421e (usb host shield), rusb2 (Renesas USB2.0), ChipIdea fullspeed
- New MCUs: MCXn9, nRF5340, STM32: G0, G4, L5, U575, U5A5, RA6m5, CH32F20x
- Add initial TypeC PowerDelivery support with STM32G4
- Remove submodules and use python script to manage repo dependencies #1947
- Add CMake support for most families and boards, move build file from tools/ to examples/build_system
- Add ETM trace support with JTrace for nrf52840, nrf5340, mcb1857, stm32h743eval, ra6m5
- [osal] Make it possible to override the `osal_task_delay()` in osal_none
- Add CDC+UAC2 composite device example
- Enhance Hardware-in-the-loop (HIL) testing with more boards: rp2040, stm32l412nucleo, stm32f746disco, lpcxpresso43s67
## Controller Driver (DCD & HCD)
- Add new ISO endpoint API: `dcd_edpt_iso_alloc()` and `dcd_edpt_iso_activate()`
- Remove legacy driver st/synopsys
### EHCI
- [iMXRT] Add dache clean/invalidate when memory is in cacheable memory
- Fix portsc write issue which cause problem with enumeration
- Fix an issue when doing port reset write to portsc
- Fix port change detect is not recognized when power on with attached device
- Fix xfer failed with disconnected device as stalled
- Fix error on EHCI causes xfer error in non-queued qhd which cause memory fault
- Un-roll recursive hub removal with usbh queue
- Fix issue when removing queue head
- Implement `hcd_edpt_abort_xfer()`
- use standard USB complete interrupt instead of custom chipidea async/period interrupt to be more compatible with other ehci implementation
- refactor usb complete & error isr processing, merge, update. Fix EHCI QHD reuses QTD on wrong endpoint
- Improve bus reset, fix `send_setup()` not carried out if halted previously
- Fix clear qhd halted bit if not caused by STALL protocol to allow for next transfer
### ChipIdea Highspeed
- Fix control transfer issue when previous status and new setup complete in the same isr frame
- [imxrt] Add dcache support for cache region
### ChipIdea Fullspeed
- Generalize ChipIdea Fullspeed driver for mcxn9 (port 0), kinetis
### nrf
- Fix DMA race condition with ISO OUT transfer #1946
- Add support for nRF5340 with pca10095 board
### Renesas rusb2
- Generalize rusb2 driver for ra, rx mcus
- rework both dcd and hcd for better multiple ports support
- Add support for board with HS USB port: ra6m5 port1
### rp2040
- [dcd] Make writes to SIE_CTRL aware of concurrent access
- [hcd] add `hcd_frame_number()`, `hcd_edpt_abort_xfer()` for pio-usb host
### stm32 fsdev
- Add STM32L5 support
- Implement `dcd_edpt_iso_alloc()` and `dcd_edpt_iso_activate()`
### OHCI
- Allows configurable root hub ports, handles SMM mode (Ref OHCI spec 5.1.1.3.3) and Bios mode (Ref OHCI spec 5.1.1.3.4)
- Fix FrameIntervalToggle must be toggled after we write the FrameInterval (Ref OHCI Spec 7.3.1)
- Wait PowerOnToPowerGoodTime after we enable power of the RH ports (Ref OHCI Spec 7.4.1)
- Generate port interrupts for devices already connected during init.
- Fix issue when removing queue head
- Disable MIE during IRQ processing and clear HccaDoneHead on completion as per OCHI Spec Page 80
## Device Stack
- Add optional hooks `tud_event_hook_cb()`
### Audio (UAC2)
- Fix feedback EP buffer alignment.
- Fix encoding, update example
- Improve IN transfer
### Bluetooth
- Add historical EP compatibility for Bluetooth HCI
### CDC
- Fix line_coding alignment
- Fix typo in cdc line coding enum
### MIDI
- Fix `stream_write()` always writes system messages to cable 0
- Fix incorrect NOTE_ON, NOTE_OFF definitions
### USBTMC
- Fix tmc488 bit order
### Vendor
- fix `read()`/`write()` race condition
### Video (UVC)
- Add the capability for video class to handle a bulk endpoint in the streaming interface.
## Host Stack
### USBH
- Add new APIs: `tuh_interface_set()`, `tuh_task_event_ready()`, `tuh_edpt_abort_xfer()`, `tuh_rhport_reset_bus()`, `tuh_rhport_is_active()`
- Fix issue when device generate multiple attach/detach/attach when plugging in
- Prefer application callback over built-in driver on transfer complete event
- Correct `hcd_edpt_clear_stall()` API signature
- Separate bus reset delay and contact debouncing delay in enumeration
- Support `usbh_app_driver_get_cb()` for application drivers
- Fix usbh enumeration removal race condition
- Add optional hooks `tuh_event_hook_cb()`
### CDC
- Breaking: change `tuh_cdc_itf_get_info()` to use tuh_itf_info_t instead of tuh_cdc_info_t
- Fix cdc host enumeration issue when device does not support line request
- Add support for vendor usb2uart serial: ftdi, cp210x, ch9102f
- Improve sync control API e.g `tuh_cdc_set_control_line_state()`, `tuh_cdc_set_line_coding()`
### HID
- Add new APIs `tuh_hid_send_report()`, `tuh_hid_itf_get_info()`, `tuh_hid_receive_ready()`, `tuh_hid_send_ready()`, `tuh_hid_set_default_protocol()`
- Change meaning of CFG_TUH_HID to total number of HID interfaces supported. Previously `CFG_TUH_HID` is max number of interfaces per device which is rather limited and consume more resources than needed.
### HUB
- Fix handling of empty "status change" interrupt
- Fix issue with hub status_change is not aligned
### MSC
- Fix bug in `tuh_msc_ready()`
- Fix host msc get maxlun not using aligned section memory
## Contributors
Thanks to everyone who contributed to this release: @0xCCF4, @abakosh, @ahooper, @antoniovazquezblanco, @bavison, @bencowperthwaite, @bpaddock, @branalba, @ccrome, @dauc, @dhalbert, @DRNadler, @dsugisawa-mixi, @epatstarkey, @eustas, @facchinm, @gabChouin, @georgeboc, @hathach, @HiFiPhile, @howard0su, @HubertD, @ipopov, @jbtheou, @jefftrull, @jfedor2, @jferreir, @jfm92, @jncronin, @JustAnother1, @kasjer, @kholia, @kilograham, @kkitayam, @koendv, @Krasutski, @kripton, @maidnl, @MattMills, @mikee47, @mndza, @nathaniel-brough, @NullMember, @perigoso, @projectgus, @raiden00pl, @ReimuNotMoe, @Rocky04, @rppicomidi, @Ryzee119, @sinitax, @sjanc, @slark-yuxj, @slc-tl, @Tails86, @tannewt, @tswan-quasi, @tyustli, @Yveaux.
+166
View File
@@ -0,0 +1,166 @@
# 0.17.0
*September 13, 2024*
## General
- Improved CI: build both cmake and make. Make use of CircleCI for part of build process to speed up CI
- Add CodeQL Workflow for Code Security Analysis
- Add Clang compiler support
- Add default implementation for weak callbacks functions for better Keil compatibility
- Upgrade hardware-in-the-loop (HIL) testing with more boards and examples: including dual stack example
## Controller Driver (DCD & HCD)
### Chipidea
- Support MCXA
### DWC2
- Fix tickless issue with stm32f7: disable ULPI clock during sleep when using internal phy
- Fix SOF interrupt handling
- Fix fifo level half/empty issue
- Add DWC2 Test Mode support.
- for esp32 force disconnect/connect using USB_WRAP otg pad override
### FSDEV
- Rewrite and Generalize driver to support non-stm32 mcu such as wch
- Simplify PMA, HW FIFO access and bit manipulation for different access scheme 1x16, 2x16 and 32 bit
- Add support for ch32 usbd e.g ch32v203
- Add support for STM32G4 and STM32U5 microcontrollers.
- Fix h5 (32-bit) errata 2.15.1: Buffer description table update completes after CTR interrupt triggers
- ISO EP buffer allocation improvements, implement `dcd_edpt_close_all()`
- Fix ch32v203 race condition and stability issue with
- fix ch32v203 seems to unconditionally accept ZLP on EP0 OUT.
- fix v203 race condition between rx bufsize and RX_STAT which cause PMAOVR, occurs with WRITE10
- correctly handle setup prepare at `dcd_edpt0_status_complete()`, which fixes the race condition with windows where we could miss setup packet (setup bit set, but count = 0)
### MAX3421E
- Add support for rp2040, esp32 (c3, c6, h2, etc..)
- Add `hcd_deinit()` for max3421
- Retry NAK handling next frame to reduce CPU and SPI bus usage
- add `cpuctl` and `pinctl` to `tuh_configure()` option for max3421
- Implement hcd abort transfer for Max3421
- Properly Handle NAK Response in MAX3421E driver: correctly switch and skip writing to 2 FIFOs when NAK received. Otherwise, the driver may hang in certain conditions.
### MSP430
- support non-bus-powered
### MUSB
- Add support for Analoog devices: max32650, max32666, max32690, max3278002
### nRF
- Fix `dcd_edpt_open()` for iso endpoint
- Handle ISOOUT CRC errors
- Add compile support with old nordic sdk
- Fix a few race conditions
### OHCI
- Allow more than 16 devices
### RP2040
- Correctly abort control transfer when new setup arrived. Due to RP2040-E2 only able to fix B2 or later
- Implement hcd abort transfer for rp2040
- Add support for rp2350
### RUSB2
- Support ra2a1 pipe number scheme
### WCH CH32
- Added support for USB OTG/FS and FSDev Driver. Update CH32V307 to allow manual select FS or HS driver.
- Fixed various bugs in CH32v307 usbhs driver: endpoint handling and data transfer management.
## Device Stack
- Add `tud_deinit()` and `class driver deinit()` to deinitialize TinyUSB device stack.
- Add support for generic SOF callback.
- Add set address recovery time 2ms per USB spec.
### Audio
- Add audio_test_freertos & audio_4_channel_mic_freertos
- Improved support for Audio Class 2.0 (UAC2) with various bug fixes.
- Add feedback by fifo counting.
### Bluetooth HCI
- Issue ZLP on ACL IN ep when transfer is multiple of endpoint max packet size
### CDC
- Add `tud_cdc_configure_fifo()` to make RX/TX buffer persistent (not clear when disconnected)
- Add missing capability bit for CDC ACM serial break support
- Enhanced CDC class with better handling of large data transmissions.
- Add missing capability bit for CDC ACM serial break support
### HID
- Added missing key codes for keypad
- Added HID Lighting and Illumination functionality
- Fixed issues in the HID class for more reliable device enumeration.
- Support HID Mouse with absolute positioning
- Use separate buffer for control SET_REPORT, fix conflict with interrupt endpoint out
### MSC
- Added support for SCSI_CMD_PREVENT_ALLOW_MEDIUM_REMOVAL
### Net
- Rewrite of NCM device driver to improve throughput
- removed obsolete `tud_network_link_state_cb()`
### USBTMC
- Added notification support
### Vendor
- Migrate to new endpoint stream API, support non-buffered TX/RX
- Add ZLP for `write()` when needed
### Video
- Enhance UVC descriptors and example
- Video Added support for USB Video Class (UVC) with MJPEG.
- Fix multiple interfaces, add an example of 2ch video capture.
- Fix race for `tud_video_n_streaming()` check
## Host Stack
- Added `tuh_deinit()` to de-initialize TinyUSB host stack.
- Added support for new USB mass storage class APIs.
- Improved error handling and retry mechanisms for unstable devices.
### CDC Serial
- Add support for ch34x
- Allow to overwrite `CFG_TUH_CDC_FTDI/CP210X/CH32X_VID_PID_LIST`
- Enhanced stability of CDC-ACM devices during enumeration.
### HID
- Add `tuh_hid_receive_abort()`
- Add `tuh_hid_get_report()`
### Hub
- Prevent status request to invalid ep_num
- Fix double status xfer
- unroll hub removal
## Contributors
Thanks to everyone who contributed to this release: @acscd, @andrewleech, @angmolin, @antoniovazquezblanco, @arntsonl, @b4yuan, @battlesnake, @BrentK-ADI, @camilaodsouza, @cdesjardins, @ChrisDeadman, @clhenry, @cumhuronat, @donatieng, @dp111, @dragonlock2, @duckylotl, @eightycc, @emb4fun, @Erlkoenig90, @feaser, @gschorcht, @hathach, @HiFiPhile, @hinxx, @hjalleboii, @ikskuh, @IngHK, @jerpa77, @jotonedev, @kaidegit, @kasjer, @kaspernyhus, @kilograham, @kkitayam, @Krasutski, @LarssonOliver, @leptun, @liamfraser, @lijunru-hub, @lurch, @Lurcy38, @maflcko, @mamiral, @MatiMcFly, @Okarss, @pigrew, @ra1nb0w, @Rbb666, @rgrr, @Rocky04, @rsolorzanomsft, @Ryzee119, @shuffle2, @slark-yuxj, @tannewt, @thierer, @tinic, @tlyu, @tobozo, @tommie, @trejan, @tyustli, @wjklimek1, @XelaRellum, @Xelus22, @xudongzheng, @YixingShen, @zx96.
+57
View File
@@ -0,0 +1,57 @@
# 0.18.0
*December 25, 2024*
## General
- New MCUs:
- Add esp32p4 OTG highspeed support
- Add stm32 u0, c0, h7rs
- Better support dcache, make sure all usb-transferred buffer are cache line aligned and occupy full cache line
- Build ARM IAR with CircleCI
- Improve HIL with `dual/host_info_to_device_cdc` optional for pico/pico2, enable dwc2 dma test
## API Changes
- Change signature of `tusb_init(rhport, tusb_rhport_init_t*)`, `tusb_init(void)` is now deprecated but still available for backward compatibility
- Add new `tusb_int_handler(rhport, in_isr)`
- Add time-related APIs: `tusb_time_millis_api()` and `tusb_time_delay_ms_api()` for non-RTOS, required for some ports/configuration
### New configuration macros
- `CFG_TUD/TUH_MEM_DCACHE_ENABLE` enable data cache sync for endpoint buffer
- `CFG_TUD/TUH_MEM_DCACHE_LINE_SIZE` set cache line size
- `CFG_TUD/TUH_DWC2_SLAVE_ENABLE` enable dwc2 slave mode
- `CFG_TUD/TUH_DWC2_DMA_ENABLE` enable dwc2 dma mode
## Controller Driver (DCD & HCD)
### DWC2
- Add DMA support for both device and host controller
- Add host driver support including: full/high speed, control/bulk/interrupt (CBI) transfer, split CBI i.e FS/LS attached via highspeed hub, hub support
### RP2
- implement `dcd_edpt_iso_alloc()` and `dcd_edpt_iso_activate()` for isochronous endpoint
### iMXRT1170
- support M4 core
## Device Stack
- Vendor Fix class reset
- NCM fix recursions in `tud_network_recv_renew()`
- Audio fix align issue of `_audiod_fct.alt_setting`
- UVC support format frame based
- Change `dcd_dcache_()` return type from void to bool
- HID add Usage Table for Physical Input Device Page (0x0F)
## Host Stack
- Fix an duplicated attach issue which cause USBH Defer Attach until current enumeration complete message
## Contributors
Thanks to everyone who contributed to this release: @bollenn, @chintal, @DavidEGrayson, @GuavTek, @hathach, @HiFiPhile, @lijunru-hub, @Maerdl, @pschatzmann, @rgrr, @roma-jam, @shdeb, @shuffle2, @subsonicpulse, @tannewt, @UweBonnes, @YixingShen.
+216
View File
@@ -0,0 +1,216 @@
# 0.19.0
*October 6, 2025*
## General
### New MCUs and Boards
- Add ESP32-H4, ESP32-C5, ESP32-C61 support
- Add STM32U0, STM32WBA, STM32N6
- Add AT32F405, AT32F403A, AT32F415, AT32F423 support
- Add CH32V305 support and CH32V20x USB host support
- Add MCXA156 SDK 2.16 support and FRDM-MCXA156 board
## API Changes
### Core APIs
- Add weak callbacks with new syntax for better compiler compatibility
- Add `tusb_deinit()` to cleanup stack
- Add time functions: `tusb_time_millis_api()` and `tusb_time_delay_ms_api()`
- Add `osal_critical` APIs for critical section handling
- Introduce `xfer_isr()` callback for ISO transfer optimization in device classes
### Device APIs
- CDC: Add notification support `tud_cdc_configure()`, `tud_cdc_n_notify_uart_state()`,
`tud_cdc_n_notify_conn_speed_change()`, `tud_cdc_notify_complete_cb()`
- MSC: Add `tud_msc_inquiry2_cb()` with bufsize parameter, update `tud_msc_async_io_done()`
with `in_isr` parameter
- Audio: Add `tud_audio_n_mounted()` and various FIFO access functions
- MTP: Add `tud_mtp_mounted()`, `tud_mtp_data_send()`, `tud_mtp_data_receive()`,
`tud_mtp_response_send()`, `tud_mtp_event_send()`
### Host APIs
- Core: Add `tuh_edpt_close()`, `tuh_address_set()`, `tuh_descriptor_get_device_local()`,
`tuh_descriptor_get_string_langid()`, `tuh_connected()`, `tuh_bus_info_get()`
- Add enumeration callbacks: `tuh_enum_descriptor_device_cb()`,
`tuh_enum_descriptor_configuration_cb()`
- CDC: Add `tuh_cdc_get_control_line_state_local()`, `tuh_cdc_get/set_dtr/rts()`,
`tuh_cdc_connect/disconnect()` and sync versions of all control APIs
- MIDI: Add `tuh_midi_itf_get_info()`, `tuh_midi_packet_read_n()`,
`tuh_midi_packet_write_n()`, `tuh_midi_read_available()`, `tuh_midi_write_flush()`,
`tuh_midi_descriptor_cb()`
## Controller Driver (DCD & HCD)
### DWC2
- Support DWC2 v4.30a with improved reset procedure
- Fix core reset: wait for AHB idle before reset
- Add STM32 DWC2 data cache support with proper alignment
- Host improvements:
- Fix disconnect detection and SOF flag handling
- Fix HFIR timing off-by-one error
- Retry IN token immediately for bInterval=1
- Proper attach debouncing (200ms)
- Fix all retry intervals
- Resume OUT transfer when PING ACKed
- Fix enumeration racing conditions
- Refactor bitfields for better code generation
### FSDEV (STM32)
- Fix AT32 compile issues after single-buffered endpoint changes
- Add configurable single-buffered isochronous endpoints
- Fix STM32H7 recurrent suspend ISR
- Fix STM32L4 GPIOD clock enable for variants without GPIOD
- Fix STM32 PHYC PLL stability wait
- Improve PMA size handling for STM32U0
### EHCI
- Fix removed QHD getting reused
- Fix NXP USBPHY disconnection detection
### Chipidea/NXP
- Fix race condition with spinlock
- Improve iMXRT support: fix build, disable BOARD_ConfigMPU, fix attach debouncing on port1 highspeed
- Fix iMXRT1064 and add to HIL test pool
### MAX3421E
- Use spinlock for thread safety instead of atomic flag
- Implement `hcd_edpt_close()`
### RP2040
- Fix audio ISO transfer: reset state before notifying stack
- Fix CMake RTOS cache variable
- Abort transfer if active in `iso_activate()`
### SAMD
- Add host controller driver support
## Device Stack
### USBD Core
- Introduce `xfer_isr()` callback for interrupt-time transfer handling
- Add `usbd_edpt_xfer_fifo()` stub
- Revert endpoint busy/claim status if `xfer_isr()` defers to `xfer_cb()`
### Audio
- Major simplification of UAC driver and alt settings management
- Move ISO transfers into `xfer_isr()` for better performance
- Remove FIFO mutex (single producer/consumer optimization)
- Add implicit feedback support for data IN endpoints
- Fix alignment issues
- Update buffer macros with cache line size alignment
### CDC
- Add notification support: `CFG_TUD_CDC_NOTIFY`, `tud_cdc_n_notify_conn_speed_change()`, `tud_cdc_notify_complete_cb()`
- Reduce default bInterval from 16ms to 1ms for better responsiveness
- Rename `tud_cdc_configure_fifo()` to `tud_cdc_configure()` and add `tx_overwritable_if_not_connected` option
- Fix web serial robustness with major overhaul and logic cleanup
### HID
- Add Usage Page and Table for Power Devices (0x84 - 0x85)
- Fix HID descriptor parser variable size and 4-byte item handling
- Add consumer page configurations
### MIDI
- Fix MIDI interface descriptor handling after audio streaming interface
- Skip RX data with all zeroes
### MSC
- Add async I/O support for MSC using `tud_msc_async_io_done()`
- Add `tud_msc_inquiry2_cb()` with bufsize for full inquiry response
### MTP
- Add new Media Transfer Protocol (MTP) device class driver
- Support MTP operations: GetDeviceInfo, SendObjectInfo, SendObject
- Add MTP event support with `tud_mtp_event_send()`
- Implement filesystem example with callbacks
- Add hardware-in-the-loop testing support
### NCM
- Add USB NCM link state control support
- Fix DHCP offer/ACK destination
### USBTMC
- Add vendor-specific message support
### Vendor
- Fix vendor device reset and open issues
- Fix descriptor parsing for `CFG_TUD_VENDOR > 1`
- Fix vendor FIFO argument calculation
## Host Stack
### USBH Core
- Major enumeration improvements:
- Fix enumeration racing conditions
- Add proper attach debouncing with hub/rootport handling (200ms delay)
- Reduce `ENUM_DEBOUNCING_DELAY_MS` to 200ms
- Always get language ID, manufacturer, product, and serial strings during enumeration
- Always get first 2 bytes of string descriptor to determine length (prevents buffer overflow)
- Support devices with multiple configurations
- Add `tuh_enum_descriptor_device_cb()` and `tuh_enum_descriptor_configuration_cb()` callbacks
- Add `tuh_descriptor_get_string_langid()` API
- Hub improvements:
- Check status before getting first device descriptor
- Properly handle port status and change detection
- Queue status endpoint for detach/remove events
- Fix hub status change endpoint handling
- Fix endpoint management:
- `hcd_edpt_open()` returns false if endpoint already opened
- Add `hcd_edpt_close()` implementation
- Abort pending transfers on close
- Add roothub debouncing flag to ignore attach/remove during debouncing
- Move address setting and bus info management to separate structures
- Force removed devices in same bus info before setting address
### CDC Serial Host
- Major refactor to generalize CDC serial drivers (FTDI, CP210x, CH34x, PL2303, ACM)
- Add explicit `sync()` API with `TU_API_SYNC()` returning `tusb_xfer_result_t`
- Rename `tuh_cdc_get_local_line_coding()` to `tuh_cdc_get_line_coding_local()`
- Add `tuh_cdc_get_control_line_state_local()`
- Implement `tuh_cdc_get/set_dtr/rts()` as inline functions
### MIDI Host
- Major API changes:
- Rename `tuh_midi_stream_flush()` to `tuh_midi_write_flush()`
- Add `tuh_midi_packet_read_n()` and `tuh_midi_packet_write_n()`
- Add `CFG_TUH_MIDI_STREAM_API` to opt out of stream API
- Change API to use index instead of device address (supports multiple MIDI per device)
- Rename `tuh_midi_get_num_rx/tx_cables()` to `tuh_midi_get_rx/tx_cable_count()`
- Add `tuh_midi_descriptor_cb()` and `tuh_midi_itf_get_info()`
### MSC Host
- Continue async I/O improvements
### HID Host
- Fix version string to actually show version
## Contributors
Thanks to everyone who contributed to this release: @andrewleech, @armusin, @atoktoto, @byteit101, @ceedriic, @ChrisDeadman, @Cynventria, @dauc, @Dazza0, @deshipu, @Dolphindalt, @ehughes, @elipsitz, @fenugrec, @hathach, @HiFiPhile, @ho-ho-ho, @igi540, @IngHK, @Isoheptane, @james-advatek, @JannisKonradBecker, @jay94ks, @joelpmichael, @karlp, @kasjer, @ludoux, @majbthrd, @martijnvdwoude, @maximevince, @Milek7, @ning3270455369, @ohmdelta, @peppapighs, @pschatzmann, @PwnVerse, @raldone01, @ReimuNotMoe, @rhgndf, @roundby, @rppicomidi, @s09289728096, @salkinium, @tannewt, @terjr, @tore-espressif, @verylowfreq, @YixingShen, @ZakDanger.
+88
View File
@@ -0,0 +1,88 @@
# 0.20.0
*November 19, 2025*
## General
### New MCUs and Boards
- Add STM32U3 device support (adjusted from STM32U0)
- Add nRF54H20 support with initial board configuration
- Rename board names: pca10056→nrf52840dk, pca10059→nrf52840dongle, pca10095→nrf5340dk
- Improve CMake: Move startup and linker files from board target to executable. Enhance target warning flags and fix various build warnings
### Code Quality and Static Analysis
- Add PVS-Studio static analysis to CI
- Add SonarQube scan support
- Add IAR C-Stat analysis capability
- Add `.clang-format` for consistent code formatting
- Fix numerous alerts and warnings found by static analysis tools
### Documentation
- Improve Getting Started documentation structure and flow
- Add naming conventions and buffer handling documentation
## Controller Driver (DCD & HCD)
### DWC2
- Fix incorrect handling of Zero-Length Packets (ZLP) in the DWC2 driver when receiving data (OUT transfers)
- Improve EP0 multi-packet logic
- Support EP0 with max packet size = 8
- For IN endpoint, write initial packet directly to FIFO and only use TXFE interrupt for subsequent packets
- Fix ISO with bInterval > 2 using incomplete IN interrupt handling.
- Fix compile issues when enabling both host and device
- Clear pending suspend interrupt after USB reset (enum end)
- Improve host closing endpoint and channel handling when device is unplugged
### FSDEV (STM32)
- Fix AT32 USB interrupt remapping in `dcd_int_enable()`
### OHCI
- Add initial LPC55 OHCI support
- Improve data cache support
## Device Stack
### USBD Core
- Support configurable EP0 buffer size CFG_TUD_ENDPOINT0_BUFSIZE
- Make dcd_edpt_iso_alloc/activate as default API for ISO endpoint
### Audio
- Add UAC1 support
- Implement RX FIFO threshold adjustment with `tud_audio_get/set_ep_in_fifo_threshold()`
### CDC
- Migrate to endpoint stream API
### HID
- Fix HID stylus descriptor
### MIDI
- Migrate to endpoint stream API
- Add `tud_midi_n_packet_write_n()` and `tud_midi_n_packet_read_n()`
### MTP
- Fix incorrect MTP xact_len calculation
### Video
- Add bufferless operation callback for dynamic frame generation with tud_video_prepare_payload_cb()
## Host Stack
No changes
## Contributors
Thanks to everyone who contributed to this release: @adam-embedded, @ArcaneNibble, @c1570, @embedded-ideas, @gabChouin, @hathach, @HiFiPhile, @karlp, @ldube, @peppapighs, @poornadharshan13-rgb, @RigoLigoRLC, @tangpipi, @ToonVanEyck, @tswan22.
+182
View File
@@ -0,0 +1,182 @@
# 0.21.0
*June 29, 2026*
## General
### New MCUs and Boards
- Add HPMicro HPM6xxx support with HPM6750EVK2 board
- Add NXP RW61x (RW612, ChipIdea high-speed) support
- Add Artery AT32F45x series support
- Add STM32C5 series support
- Add Espressif ESP32-S31 (high-speed) support
- Add WCH CH582/CH583 (USBFS) support
- Add CH32V103 USB device support (combined-control USBFS) with CH32V103C8T6 Bluepill board
- Add FreeRTOS support for RP2040/RP2350
- New boards: nRF54LM20-DK, WeAct STM32H743, EK-TM4C1294XL, STM32H747-DISCO, NUCLEO-H533RE
- Migrate i.MX RT to the new `mcux-devices-rt` SDK package
### Code Quality and Build
- Major refactor of dedicated hardware-FIFO (HWFIFO) handling: omit per-endpoint RAM buffers on ports with a dedicated hardware FIFO, add stride-aware FIFO access, and store raw bytes in `tusb_fifo`
- Reduce code size via control/descriptor and stream refactors, and remove `snprintf` usage
- Remove IAR toolchain support from the Make build; add IAR warning flags and resolve warnings in CMake
- Fix Zephyr build with nrfx v4, C++/`-Werror=extra` builds, and various `-Wconversion` warnings
- Update FatFS to R0.16
- Fix the fuzzing harness
- Various BSP fixes (STM32H5 UID read with ICACHE, STM32F411 Black Pill HSE, RT1011 data cache, Teensy)
### Documentation
- Add a README for every example and `build-doc` tooling
- Add Sponsors section and `FUNDING` configuration
- Various README/doc fixes (FTDI host, STM32C071 Nucleo URL, Supported CPUs table)
## API Changes
- Add `is_isr` parameter to `dcd_edpt_xfer`, `dcd_edpt_xfer_fifo`, `usbd_edpt_xfer` and `usbd_edpt_xfer_fifo`
- Remove the no-FIFO mode from the endpoint stream API
- Add `tud_vendor_write_clear()` to forcefully clear the TX buffer
- Add `tud_midi_n_demux_stream_read()` cable-aware MIDI stream read
- Add `CFG_TUH_HID_SET_PROTOCOL_ON_ENUM` host HID option
- Add `CFG_TUSB_DEBUG_BREAKPOINT` hook for `TU_BREAKPOINT`
- Add ThreadX OSAL support
- `tud_task_ext()` / `tuh_task_ext()` now limit the number of events processed per call
- Replace `CFG_TUD_NET_ENDPOINT_SIZE` with the descriptor-based endpoint size
## Device Stack
### USBD Core
- Refactor and validate device descriptor handling; move control transfer handling into `usbd.c`
- Use the EP0 buffer directly when large enough; clamp EP0 OUT data copy to the control buffer
- Fix stream write logic/racing without FIFO; fix zero `wLength` control request
- Fix ISO OUT endpoint failure on alt-setting MPS change
### Audio
- Fix `audiod_open` with MIDI interfaces
- Fix big-endian bitfield guards for audio structs and endian-safe `wValue`/`wIndex` extraction in UAC2 examples
### CDC
- Remove `tud_cdc_configure`
- Fix CDC echo test issue on i.MX RT and fast MCUs
### HID
- Bound item size to remaining length in the report-descriptor parser
- Remove host enumeration assumption; add `CFG_TUH_HID_SET_PROTOCOL_ON_ENUM`
### MIDI
- Add USB-MIDI 2.0 device and host class drivers
- Add cable-aware stream read `tud_midi_n_demux_stream_read()`
- Fix MIDI host issue
### MSC
- Skip the command stage if the OUT endpoint is stalled
- Cap `tud_msc_scsi_cb` buffer size to the endpoint buffer size
### MTP
- Fix transfer completion detection for exact-length packets; queue ZLP when needed
- Fix premature phase change after a short OUT transfer; fixes in `add_string`
### Network (NCM)
- Fix NCM state on restart
- Support `SetEthernetPacketFilter` and `SetNtbInputSize` requests
- Add a weak callback for the initial link state
### Video (UVC)
- Fix VC interface parsing when `bNumEndpoints` != 0
- Assert the `usbd_edpt_iso_activate()` result
### DFU
- Fix the DFU functional descriptor version (1.0.1 → 1.1.0)
### Printer
- Add the USB Printer device class driver
### Vendor
- Omit the endpoint buffer for ports with a dedicated hardware FIFO
## Host Stack
- Fully asynchronous host code: remove blocking delays from `tuh_task_ext()`, respect its `timeout_ms`, and avoid stalling one device while another enumerates
- Add an async control-transfer FIFO so queued control transfers are dispatched instead of dropped
- Hub enumeration reliability improvements; add MTT hub support
- Support full-speed host with a high-speed PHY (DWC2)
- Fix FTDI host multi-channel loop
- CDC host: use a local control buffer; fix `cdch_open` typo
- Big-endian host support for SETUP packet handling
- Use `TUSB_ROLE_HOST` in host stack initialization
## Controller Driver (DCD & HCD)
### DWC2
- Add `dcd_configure` for FIFO config and DWC2 deinit support
- Support full-speed host operation on a high-speed PHY
- Vbus sensing enhancement; do not modify FS PHY registers on HS PHY (ESP32-P4)
- Fix HCD TX FIFO full check, ISO IN endpoint disabled after incomplete transfer, and EP0 status completion before SETUP
- Submit SETUP on SETUP_DONE and handle v3.10a spurious RX_COMPLETE (STM32L476)
- HCD: correct HFIR for low-speed devices via internal FS PHY; fix split-IN NAK storm and UART starvation (STM32F723)
### FSDEV (STM32 / CH32)
- Add FSDEV host (HCD) driver
- Refactor FSDEV; share the PMA errata delay helper between DCD/HCD with overridable timing
- Fix single-buffered isochronous endpoint cases, STM32U0 data stride, and PMA pointer advance on ring-buffer wrap
- Fix CH32V20x enumeration by enabling the D+ pull-up; work around CH32 EP0 premature OUT ACK
- Do not enable the unused USB wakeup EXTI IRQ (F1/F3/G4/L1)
### MUSB
- Enhance driver: double packet, EP0 refactor, fix DATAEND race with EP0
- Fix ZLP IN transfer, RXRDY clearing, and defer EP0 SETUP during the DATA_IN/STATUS race
### RP2040 / RP2350
- Refactor RP2 driver
- HCD rework: EPX for non-interrupt endpoints and ping-pong double buffering
- Fix RP2350 hard fault in unaligned memcpy to USB DPRAM
- Host: fix OUT-data control transfers sending DATA0 instead of DATA1
### CH32 USBFS / USBHS (WCH)
- Fix dropped bulk OUT packets by re-arming the EP_RX_CTRL state (usbfs)
- Fix endpoint stall length index and clear-stall response (usbhs)
- Fix CH32V103 hard fault
### RUSB2 / SAMx7x
- Fix RUSB2 FIFO write
- Refresh `dcd_samx7x`
### New host controllers
- Add NXP IP3516 HCD (EHCI-like)
- Add MTT (multi-TT) hub support
### nRF5x
- Request HFCLK in `USB_EVT_READY` to fix the post-SoftDevice deadlock
## Testing
- Expand Hardware-in-the-Loop (HIL) coverage (MTP, audio, throughput; nanoch32v203, ch32v103, stm32u083nucleo, tm4c123x) and post pass/fail/skip HIL reports as PR comments
- Add MemBrowse code-size CI integration and size-difference reporting
- Add automated Claude Code PR review and bug-fix CI workflows
- Add `hil`, `code-size`, `pvs`, `usbmon` and `build-doc` developer skills
## Contributors
Thanks to everyone who contributed to this release: @Alex-Schaefer, @alt-0191, @andrewleech, @armusin, @bdolgov, @BrentK-ADI, @ceedriic, @chenzhihong007, @dangfan, @DavidKorczynski, @dinsfire64, @dxbjavid, @embedded-ideas, @felhub, @gab-k, @gabChouin, @HakanL, @hathach, @HiFiPhile, @igi540, @IntegraSources, @kira-live, @LeZerb, @michael-membrowse, @michaelajax, @mickabrig7, @Milek7, @morse-cedricvandenbergh, @nminaylov, @non-bin, @Phozer, @remiberthoz, @renjieah, @rhgndf, @RobertDaleSmith, @roma-jam, @sauloverissimo, @sgrunza-at-BadgerMeter, @sidcha, @StefanOroel, @Tails86, @thamul, @tore-espressif, @UMRnInside, @ValentiWorkLearning, @verylowfreq, @wjklimek1, @YixingShen, @zhiqiang-ch, @zjzhang-cn.
+13
View File
@@ -0,0 +1,13 @@
# 0.5.0
*July 11, 2019*
First release, device stack works great, host stack works but still need improvement.
- Special thanks to @adafruit team, especially @tannewt to help out immensely to rework device stack: simplify osal & control transfer, adding SAMD21/SAMD51 ports, writing porting docs, adding MIDI class support etc...
- Thanks to @cr1901 for adding STM32F4 port.
- Thanks to @PTS93 and @todbot for HID raw API
## Contributors
Thanks to everyone who contributed to this release: @cr1901, @gpshead, @hathach, @mithro, @tannewt, @timonsku, @zardam.
+63
View File
@@ -0,0 +1,63 @@
# 0.6.0
*March 30, 2020*
Added **CONTRIBUTORS.md** to give proper credit for contributors to the stack. Special thanks to [Nathan Conrad](https://github.com/pigrew) , [Peter Lawrence](https://github.com/majbthrd) , [William D. Jones](https://github.com/cr1901) and [Sean Cross](https://github.com/xobs) and others for spending their precious time to add lots of features and ports for this release.
## Added
### MCU
- Added support for Microchip SAMG55
- Added support for Nordic nRF52833
- Added support for Nuvoton: NUC120, NUC121/NUC125, NUC126, NUC505
- Added support for NXP LPC: 51Uxx, 54xxx, 55xx
- Added support for NXP iMXRT: RT1011, RT1015, RT1021, RT1052, RT1062, RT1064
- Added support for Sony CXD56 (Spresense)
- Added support for STM32: L0, F0, F1, F2, F3, F4, F7, H7
- Added support for TI MSP430
- Added support for ValentyUSB's eptri
### Class Driver
- Added DFU Runtime class driver
- Added Network class driver with RNDIS, CDC-ECM, CDC-EEM (work in progress)
- Added USBTMC class driver
- Added WebUSB class driver using vendor-specific class
- Added multiple instances support for CDC and MIDI
- Added a handful of unit test with Ceedling.
- Added LOG support for debugging with CFG_TUSB_DEBUG
- Added `tud_descriptor_bos_cb()` for BOS descriptor (required for USB 2.1)
- Added `dcd_edpt0_status_complete()` as optional API for DCD
### Examples
Following examples are added:
- `board_test`
- `cdc_dual_ports`
- `dfu_rt`
- `hid_composite`
- `net_lwip_webserver`
- `usbtmc`
- `webusb_serial`
## Changed
- Changed `tud_descriptor_string_cb()` to have additional Language ID argument
- Merged `hal_nrf5x.c` into `dcd_nrf5x.c`
- Merged `dcd_samd21.c` and `dcd_samd51.c` into `dcd_samd.c`
- Generalized `dcd_stm32f4.c` to `dcd_synopsys.c`
- Changed `cdc_msc_hid` to `cdc_msc` (drop hid) due to limited endpoints number of some MCUs
- Improved DCD SAMD stability, fix missing setup packet occasionally
- Improved `usbd/usbd_control` with proper handling of zero-length packet (ZLP)
- Improved STM32 DCD FSDev
- Improved STM32 DCD Synopsys
- Migrated CI from Travis to Github Action
- Updated nrfx submodule to 2.1.0
- Fixed mynewt osal queue definition
- Fixed `cdc_msc_freertos` example build for all MCUs
## Contributors
Thanks to everyone who contributed to this release: @an-dr, @arturo182, @chang196700, @cr1901, @hathach, @jepler, @jeremyherbert, @kamtom480, @kasjer, @ladyada, @majbthrd, @mateusz-holenko, @noebrun, @nxf58843, @pigrew, @samveen, @smunaut, @tannewt, @xobs.
+136
View File
@@ -0,0 +1,136 @@
# 0.7.0
*November 7, 2020*
## Device Controller Driver
- Added new support for Espressif ESP32-S2
- Added new support for Dialog DA1469x
- Enhance STM32 Synopsys
- Support bus events disconnection/suspend/resume/wakeup
- Improve transfer performance with optimizing xfer and fifo size
- Support Highspeed port (OTG_HS) with both internal and external PHY
- Support multiple usb ports with rhport=1 is highspeed on selected MCUs e.g H743, F23. It is possible to have OTG_HS to run on Fullspeed PHY (e.g lacking external PHY)
- Add ISO transfer, fix odd/even frame
- Fix FIFO flush during stall
- Implement `dcd_edpt_close()` API
- Support F105, F107
### Enhance STM32 fsdev
- Improve dcd fifo allocation
- Fix ISTR race condition
- Support remap USB IRQ on supported MCUs
- Implement `dcd_edpt_close()` API
### Enhance NUC 505
- enhance set configure behavior
### Enhance SAMD
- Fix race condition with setup packet
- Add SAMD11 option `OPT_MCU_SAMD11`
- Add SAME5x option `OPT_MCU_SAME5X`
### SAMG
- Fix SAMG control data toggle and stall race condition
### Enhance nRF
- Fix hanged when `tud_task()` is called within critical section (disabled interrupt)
- Fix disconnect bus event not submitted
- Implement ISO transfer and `dcd_edpt_close()`
## USB Device
### USBD
- Add new class driver for **Bluetooth HCI** class driver with example can be found in [mynewt-tinyusb-example](https://github.com/hathach/mynewt-tinyusb-example) since it needs mynewt OS to run with.
- Fix USBD endpoint usage racing condition with `usbd_edpt_claim()`/`usbd_edpt_release()`
- Added `tud_task_event_ready()` and `osal_queue_empty()`. This API is needed to check before enter low power mode with WFI/WFE
- Rename USB IRQ Handler to `dcd_int_handler()`. Application must define IRQ handler in which it calls this API.
- Add `dcd_connect()` and `dcd_disconnect()` to enable/disable internal pullup on D+/D- on supported MCUs.
- Add `usbd_edpt_open()`
- Remove `dcd_set_config()`
- Add `OPT_OS_CUMSTOM` as hook for application to overwrite and/or add their own OS implementation
- Support SET_INTERFACE, GET_INTERFACE request
- Add Logging for debug with optional uart/rtt/swo printf retarget or `CFG_TUSB_DEBUG_PRINTF` hook
- Add IAR compiler support
- Support multiple configuration descriptors. `TUD_CONFIG_DESCRIPTOR()` template has extra config_num as 1st argument
- Improve USB Highspeed support with actual link speed detection with `dcd_event_bus_reset()`
- Enhance class driver management
- `usbd_driver_open()` add max length argument, and return length of interface (0 for not supported). Return value is used for finding appropriate driver
- Add application implemented class driver via `usbd_app_driver_get_cb()`
- IAD is handled to assign driver id
- Added `tud_descriptor_device_qualifier_cb()` callback
- Optimize `tu_fifo` bulk write/read transfer
- Forward non-std control request to class driver
- Let application handle Microsoft OS 1.0 Descriptors (the 0xEE index string)
- Fix OSAL FreeRTOS yield from ISR
- Rename some configure macro to make it clear that those are used directly for endpoint transfer
- `CFG_TUD_HID_BUFSIZE` to `CFG_TUD_HID_EP_BUFSIZE`
- `CFG_TUD_CDC_EPSIZE` to `CFG_TUD_CDC_EP_BUFSIZE`
- `CFG_TUD_MSC_BUFSIZE` to `CFG_TUD_MSC_EP_BUFSIZE`
- `CFG_TUD_MIDI_EPSIZE` to `CFG_TUD_MIDI_EP_BUFSIZE`
### USBNET
- Remove ACM-EEM due to lack of support from host
### USBTMC
- Fix descriptors when INT EP is disabled
### CDC
- Send zero length packet for end of data when needed
- Add `tud_cdc_tx_complete_cb()` callback
- Change `tud_cdc_n_write_flush()` return number of bytes forced to transfer, and flush when writing enough data to fifo
### MIDI
- Add packet interface
- Add multiple jack descriptors
- Fix MIDI driver for sysex
### DFU Runtime
- fix response to SET_INTERFACE and DFU_GETSTATUS request
### HID
- Fix gamepad template descriptor
- Add multiple HID interface API
- Add extra comma to HID_REPORT_ID
## USB Host
- Rework USB host stack (still work in progress)
- Fix compile error with pipehandle
- Rework usbh control and enumeration as non-blocking
- Improve Hub, MSC, HID host driver
## Examples
- Add new `hid_composite_freertos`
- Add new `dynamic_configuration` to demonstrate how to switch configuration descriptors
- Add new `hid_multiple_interface`
- Enhance `net_lwip_webserver` example
- Add multiple configuration: RNDIS for Windows, CDC-ECM for macOS (Linux will work with both)
- Update lwip to STABLE-2_1_2_RELEASE for `net_lwip_webserver`
- Added new Audio example: `audio_test` `uac2_headsest`
## New Boards
- Espressif ESP32-S2: saola_1, kaluga_1
- STM32: F746 Nucleo, H743 Eval, H743 Nucleo, F723 discovery, stlink v3 mini, STM32L4r5 Nucleo
- Dialog DA1469x dk pro and dk usb
- Microchip: Great Scoot Gadgets' LUNA, samd11_xplained, D5035-01, atsamd21 xplained pro
- nRF: ItsyBitsy nRF52840
## Contributors
Thanks to everyone who contributed to this release: @chang196700, @CraigHutchinson, @czeslawmakarski, @duempel, @gh2o, @hathach, @HiFiPhile, @j4cbo, @jepler, @jgressmann, @k0d, @kasjer, @kaysievers, @ktemkin, @majbthrd, @me-no-dev, @mzero, @PanRe, @pigrew, @salkinium, @UweBonnes, @xobs, @zlittell.
+84
View File
@@ -0,0 +1,84 @@
# 0.8.0
*February 5, 2021*
## Device Controller Driver
- Added new device support for Raspberry Pi RP2040
- Added new device support for NXP Kinetis KL25ZXX
- Use `dcd_event_bus_reset()` with link speed to replace bus_signal
### ESP32-S2
- Add bus suspend and wakeup support
### SAMD21
- Fix (workaround) samd21 setup_packet overflow by USB DMA
### STM32 Synopsys
- Rework USB FIFO allocation scheme and allow RX FIFO size reduction
### Sony CXD56
- Update Spresense SDK to 2.0.2
- Fix dcd issues with setup packets
- Correct EP number for cdc_msc example
## USB Device
### USBD
- Rework usbd control transfer to have additional stage parameter for setup, data, status
- Fix `tusb_init()` return true instead of `TUSB_ERROR_NONE`
- Added new API `tud_connected()` that return true after device got out of bus reset and received the very first setup packet
### CDC
- Allow to transmit data, even if the host does not support control line states i.e set DTR
### HID
- change default `CFG_TUD_HID_EP_BUFSIZE` from 16 to 64
### MIDI
- Fix midi sysex sending bug
### MSC
- Invoke only scsi complete callback after status transaction is complete.
- Fix `scsi_mode_sense6_t` padding, which cause IAR compiler internal error.
### USBTMC
- Change interrupt endpoint example size to 8 instead of 2 for better compatibility with mcu
### Example
- Support make from windows `cmd.exe`
- Add HID Consumer Control (media keys) to `hid_composite` & `hid_composite_freertos` examples
## USB Host
No noticeable changes to host stack
## New Boards
- NXP/Freescale Freedom FRDM-KL25Z
- Feather Double M33 express
- Raspberry Pi Pico
- Adafruit Feather RP2040
- Adafruit Itsy Bitsy RP2040
- Adafruit QT RP2040
- Adfruit Feather ESP32-S2
- Adafruit Magtag 29" Eink
- Adafruit Metro ESP32-S2
- Adafruit PyBadge
- Adafruit PyPortal
- Great Scott Gadgets' LUNA D11 & D21
## Contributors
Thanks to everyone who contributed to this release: @aslampr07, @charkster, @dobairoland, @duempel, @gsteiert, @hathach, @HiFiPhile, @kamtom480, @kkitayam, @ktemkin, @majbthrd, @PanRe, @prplz.
+108
View File
@@ -0,0 +1,108 @@
# 0.9.0
*March 12, 2021*
## Device Controller Driver (DCD)
### RP2040
- Fix endpoint buffer reallocation overrun problem
- Fix osal_pico queue overflow in initialization
- Fix Isochronous endpoint buffer size in transfer
- Optimize hardware endpoint struct to reduce RAM usage
- Fix enum workaround forever check for SE0 when pull up is disabled
### Sony CXD56
- Pass the correct speed on Spresense
- Fix setup processed flag
### NXP Transdimention
- Update dcd_init() to reset controller to device mode
## USB Device Driver (USBD)
- Fix issue with status zlp (`tud_control_status()`) is returned by class driver with SET/CLEAR_FEATURE for endpoint.
- Correct endpoint size check for fullspeed bulk, can be 8, 16, 32, 64
- Ack SET_INTERFACE even if it is not implemented by class driver.
## Device Class Driver
### DFU Runtime
- rename `dfu_rt()` to `dfu_runtime()` for easy reading
### CDC
- Add `tud_cdc_send_break_cb()` to support break request
- Improve CDC receive, minor behavior changes: when `tud_cdc_rx_wanted_cb()` is invoked wanted_char may not be the last byte in the fifo
### HID
- [Breaking] Add itf argument to hid API to support multiple instances, follow API has signature changes
- `tud_hid_descriptor_report_cb()`
- `tud_hid_get_report_cb()`
- `tud_hid_set_report_cb()`
- `tud_hid_boot_mode_cb()`
- `tud_hid_set_idle_cb()`
- Add report complete callback `tud_hid_report_complete_cb()` API
- Add DPad/Hat support for HID Gamepad
- `TUD_HID_REPORT_DESC_GAMEPAD()` now support 16 buttons, 2 joysticks, 1 hat/dpad
- Add `hid_gamepad_report_t` along with `GAMEPAD_BUTTON_` and `GAMEPAD_HAT_` enum
- Add Gamepad to `hid_composite` / `hid_composite_freertos` example
### MIDI
- Fix dropping MIDI sysex message when fifo is full
- Fix typo in `tud_midi_write24()`, make example less ambiguous for cable and channel
- Fix incorrect endpoint descriptor length, MIDI v1 use Audio v1 which has 9-byte endpoint descriptor (instead of 7)
## Host Controller Driver (HCD)
- Add rhport to `hcd_init()`
- Improve EHCI/OHCI driver abstraction
- Move echi/ohci files to portable/
- Rename `hcd_lpc18_43` to `hcd_transdimension`
- Sub hcd API with `hcd_ehci_init()`, `hcd_ehci_register_addr()`
- Update NXP transdimension `hcd_init()` to reset controller to host mode
- Ported hcd to rt10xx
## USB Host Driver (USBH)
- No noticeable changes to usbh
## Host Class Driver
### MSC
- Rename `tuh_msc_scsi_inquiry()` to `tuh_msc_inquiry()`
- Rename `tuh_msc_mounted_cb()`/`tuh_msc_unmounted_cb()` to `tuh_msc_mount_cb()`/`tuh_msc_unmount_cb()` to match device stack naming
- Change `tuh_msc_is_busy()` to `tuh_msc_ready()`
- Add read10 and write10 function: `tuh_msc_read10()`, `tuh_msc_write10()`
- Read_Capacity is invoked as part of enumeration process
- Add `tuh_msc_get_block_count()`, `tuh_msc_get_block_size()`
- Add `CFG_TUH_MSC_MAXLUN` (default to 4) to hold lun capacities
## Others
- Add basic support for rt-thread OS
- Change zero bitfield length to more explicit padding
- Build example now fetch required submodules on the fly while running `make` without prior submodule init for mcu drivers
- Update pico-sdk to v1.1.0
### New Boards
- Microchip SAM E54 Xplained Pro
- LPCXpresso 55s28
- LPCXpresso 18s37
## Contributors
Thanks to everyone who contributed to this release: @amitv87, @duddie, @hathach, @HiFiPhile, @homeodor, @ipopov, @jgressmann, @kamtom480, @liamfraser, @lurch, @majbthrd, @ndinsmore, @tfx2001, @xmos-jmccarthy.
+27
View File
@@ -0,0 +1,27 @@
*********
Changelog
*********
Release notes for each TinyUSB version, newest first.
.. toctree::
:maxdepth: 1
0.21.0
0.20.0
0.19.0
0.18.0
0.17.0
0.16.0
0.15.0
0.14.0
0.13.0
0.12.0
0.11.0
0.10.1
0.10.0
0.9.0
0.8.0
0.7.0
0.6.0
0.5.0
+162
View File
@@ -0,0 +1,162 @@
#!/usr/bin/env python3
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
import re
import shutil
from pathlib import Path
# -- Path setup --------------------------------------------------------------
# -- Project information -----------------------------------------------------
project = 'TinyUSB'
copyright = '2025, Ha Thach'
author = 'Ha Thach'
# -- General configuration ---------------------------------------------------
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.intersphinx',
'sphinx.ext.todo',
'sphinx_autodoc_typehints',
'myst_parser', # Markdown (.md) support alongside reStructuredText
]
templates_path = ['_templates']
exclude_patterns = ['_build']
# -- Options for HTML output -------------------------------------------------
html_theme = 'furo'
html_title = 'TinyUSB'
html_logo = 'assets/logo.svg'
html_favicon = 'assets/logo.svg'
html_theme_options = {
'sidebar_hide_name': True,
}
html_static_path = ['_static']
html_css_files = ['custom.css']
todo_include_todos = True
# pre-process path in README.rst
def preprocess_readme():
"""Modify figure paths in README.rst for Sphinx builds."""
src = Path(__file__).parent.parent / "README.rst"
tgt = Path(__file__).parent.parent / "README_processed.rst"
if src.exists():
content = src.read_text(encoding='utf-8')
# if the matching is inside a table, keep the table cell width by adding the same number of spaces in the end of the line
# match pattern: | ... `... <docs/...>`_ ... |
# change into: | ... `... <...>`_ ... |
def _rewrite_table_line(line):
if not (line.startswith('|') and line.rstrip().endswith('|')):
return line
rewritten = re.sub(r"<docs/([^>]+)>", r"<\1>", line)
delta = len(line) - len(rewritten) - 1 # -1 for rst->html
if delta > 0:
last_pipe = rewritten.rfind('|')
if last_pipe >= 0:
rewritten = rewritten[:last_pipe] + (' ' * delta) + rewritten[last_pipe:]
return rewritten
content = ''.join(_rewrite_table_line(line) for line in content.splitlines(keepends=True))
content = re.sub(r"docs/", r"", content)
content = re.sub(r"\.rst\b", r".html", content)
if not content.endswith("\n"):
content += "\n"
tgt.write_text(content, encoding='utf-8')
preprocess_readme()
# scan example READMEs into docs/examples/ and generate a per-group index page
EXAMPLE_GROUPS = ('device', 'host', 'dual')
_HEADING_RE = re.compile(r'^(#{1,6})(\s.*)$')
_FENCE_RE = re.compile(r'^\s*(```|~~~)')
def _normalize_headings(text):
"""Make each page a single Sphinx section: promote so the first heading is
H1 and demote any later same-or-higher heading to at least H2. Without this,
a README that uses flat #### headings (no H1) becomes several top-level
sections and each leaks into the sidebar as a separate entry."""
lines = text.splitlines(keepends=True)
headings, in_fence = [], False
for i, line in enumerate(lines):
if _FENCE_RE.match(line):
in_fence = not in_fence
elif not in_fence and _HEADING_RE.match(line):
headings.append(i)
if not headings:
return text
delta = 1 - len(_HEADING_RE.match(lines[headings[0]]).group(1))
for n, i in enumerate(headings):
m = _HEADING_RE.match(lines[i])
level = max(1, min(6, len(m.group(1)) + delta))
if n > 0:
level = max(level, 2)
lines[i] = '#' * level + m.group(2) + ('\n' if lines[i].endswith('\n') else '')
return ''.join(lines)
def _with_location(text, rel):
"""Insert a source-location note right after the first H1 so each rendered
example page shows which example directory it came from."""
note = f"> **Example source:** `{rel}`\n"
lines = text.splitlines(keepends=True)
for i, line in enumerate(lines):
if line.lstrip().startswith("# "):
return "".join(lines[:i + 1]) + "\n" + note + "\n" + "".join(lines[i + 1:])
return note + "\n" + text # no H1: prepend
def generate_examples_docs():
"""Copy every examples/{device,host,dual}/*/README.md into
docs/examples/<group>/<name>.md (noting its source location) and write a
docs/examples/<group>/index.rst landing page per group. index.rst points at
those group pages, giving a 3-level sidebar: Examples > Device/Host/Dual >
example. Output is rebuilt each run (git-ignored)."""
docs_dir = Path(__file__).parent
examples_root = docs_dir.parent / "examples"
out_dir = docs_dir / "examples"
# start clean so deleted/renamed examples don't leave stale pages
if out_dir.exists():
shutil.rmtree(out_dir)
(docs_dir / "examples.rst").unlink(missing_ok=True) # remove legacy single-file output
for group in EXAMPLE_GROUPS:
group_out = out_dir / group
group_out.mkdir(parents=True, exist_ok=True)
names = []
for readme in sorted((examples_root / group).glob("*/README.md")):
name = readme.parent.name
rel = f"examples/{group}/{name}"
content = _normalize_headings(readme.read_text(encoding='utf-8'))
(group_out / f"{name}.md").write_text(_with_location(content, rel), encoding='utf-8')
names.append(name)
# group landing page (Device / Host / Dual) with a toctree of its examples
heading = group.capitalize()
page = [f"{'*' * len(heading)}\n{heading}\n{'*' * len(heading)}\n"]
if names:
page.append(".. toctree::\n :maxdepth: 1\n")
page.extend(f" {name}" for name in names)
else:
page.append("No documented examples yet.")
(group_out / "index.rst").write_text("\n".join(page) + "\n", encoding='utf-8')
generate_examples_docs()
+180
View File
@@ -0,0 +1,180 @@
****
FAQs
****
General Questions
=================
**Q: What microcontrollers does TinyUSB support?**
TinyUSB supports 50+ MCU families including STM32, RP2040, NXP (iMXRT, Kinetis, LPC), Microchip SAM, Nordic nRF5x, ESP32, and many others. See :doc:`reference/boards` for the complete list.
**Q: Can I use TinyUSB in commercial projects?**
Yes, TinyUSB is released under the MIT license, allowing commercial use with minimal restrictions.
**Q: Does TinyUSB require an RTOS?**
No, TinyUSB works in bare metal environments. It also supports FreeRTOS, RT-Thread, ThreadX, and Mynewt.
**Q: How much memory does TinyUSB use?**
Typical usage: 8-20KB flash, 1-4KB RAM depending on enabled classes and configuration. The stack uses static allocation only.
Build and Setup
================
**Q: Why do I get "arm-none-eabi-gcc: command not found"?**
Install the ARM GCC toolchain: ``sudo apt-get install gcc-arm-none-eabi`` on Ubuntu/Debian, or download from ARM's website for other platforms.
**Q: Build fails with "Board 'X' not found"**
Check available boards: ``ls hw/bsp/FAMILY/boards/`` or run ``python tools/build.py -l`` to list all supported boards.
**Q: What are the dependencies and how do I get them?**
Run ``python tools/get_deps.py FAMILY`` where FAMILY is your MCU family (e.g., stm32f4, rp2040). This downloads MCU-specific drivers and libraries.
**Q: Can I use my own build system instead of Make/CMake?**
Yes, just add all ``.c`` files from ``src/`` to your project and configure include paths. See :doc:`getting_started` for details.
**Q: Error: "tusb_config.h: No such file or directory"**
This is a very common issue. You need to create ``tusb_config.h`` in your project and ensure it's in your include path. The file must define ``CFG_TUSB_MCU`` and ``CFG_TUSB_OS`` at minimum. Copy from ``examples/device/*/tusb_config.h`` as a starting point.
**Q: RP2040 + pico-sdk ignores my tusb_config.h settings**
The pico-sdk build system can override ``tusb_config.h`` settings. The ``CFG_TUSB_OS`` setting is often ignored because pico-sdk sets it to ``OPT_OS_PICO`` internally. Use pico-sdk specific configuration methods or modify the CMake configuration.
**Q: "multiple definition of dcd_..." errors with STM32**
This happens when multiple USB drivers are included. Ensure you're only including the correct portable driver for your STM32 family. Check that ``CFG_TUSB_MCU`` is set correctly and you don't have conflicting source files.
Device Development
==================
**Q: My USB device isn't recognized by the host**
Common causes:
- Invalid USB descriptors - validate with ``LOG=2`` build
- ``tud_task()`` not called regularly in main loop
- Incorrect ``tusb_config.h`` settings
- USB cable doesn't support data (charging-only cable)
**Q: Windows shows "Device Descriptor Request Failed"**
This typically indicates:
- Malformed device descriptor
- USB timing issues (check crystal/clock configuration)
- Power supply problems during enumeration
- Conflicting devices on the same USB hub
**Q: How do I implement a custom USB class?**
Use the vendor class interface (``CFG_TUD_VENDOR``) or implement a custom class driver. See ``src/class/vendor/`` for examples.
**Q: Can I have multiple configurations or interfaces?**
Yes, TinyUSB supports multiple configurations and composite devices. Modify the descriptors in ``usb_descriptors.c`` accordingly.
**Q: How do I change Vendor ID/Product ID?**
Edit the device descriptor in ``usb_descriptors.c``. For production, obtain your own VID from USB-IF or use one from your silicon vendor.
**Q: Device works alone but fails when connected through USB hub**
This is a known issue where some devices interfere with each other when connected to the same hub. Try:
- Using different USB hubs
- Connecting devices to separate USB ports
- Checking for power supply issues with the hub
Host Development
================
**Q: Why doesn't my host application detect any devices?**
Check:
- Power supply - host mode requires more power than device mode
- USB connector type - use USB-A for host applications
- Board supports host mode on the selected port
- Enable logging with ``LOG=2`` to see enumeration details
**Q: Can I connect multiple devices simultaneously?**
Yes, through a USB hub. TinyUSB supports multi-level hubs and multiple device connections.
**Q: Does TinyUSB support USB 3.0?**
No, TinyUSB currently supports USB 2.0 and earlier. USB 3.0 devices typically work in USB 2.0 compatibility mode.
Configuration and Features
==========================
**Q: How do I enable/disable specific USB classes?**
Edit ``tusb_config.h`` and set the corresponding ``CFG_TUD_*`` or ``CFG_TUH_*`` macros to 1 (enable) or 0 (disable).
**Q: Can I use both device and host modes simultaneously?**
Yes, with dual-role/OTG capable hardware. See ``examples/dual/`` for implementation examples.
**Q: How do I optimize for code size?**
- Disable unused classes in ``tusb_config.h``
- Use ``CFG_TUSB_DEBUG = 0`` for release builds
- Compile with ``-Os`` optimization
- Consider using only required endpoints/interfaces
**Q: Does TinyUSB support low power/suspend modes?**
Yes, TinyUSB handles USB suspend/resume. Implement ``tud_suspend_cb()`` and ``tud_resume_cb()`` for custom power management.
**Q: What CFG_TUSB_MCU should I use for x86/PC platforms?**
For PC/motherboard applications, there's no standard MCU option. You may need to use a generic option or modify TinyUSB for your specific use case. Consider using libusb or other PC-specific USB libraries instead.
**Q: RP2040 FreeRTOS configuration issues**
The RP2040 pico-sdk has specific requirements for FreeRTOS integration. The ``CFG_TUSB_OS`` setting may be overridden by the SDK. Use pico-sdk specific configuration methods and ensure proper task stack sizes for the USB task.
Debugging and Troubleshooting
=============================
**Q: How do I debug USB communication issues?**
1. Enable logging: build with ``LOG=2``
2. Use ``LOGGER=rtt`` or ``LOGGER=swo`` for high-speed logging
3. Use USB protocol analyzers for detailed traffic analysis
4. Check with different host systems (Windows/Linux/macOS)
**Q: My application crashes or hard faults**
Common causes:
- Stack overflow - increase stack size in linker script
- Incorrect interrupt configuration
- Buffer overruns in USB callbacks
- Build with ``DEBUG=1`` and use a debugger
**Q: Performance is poor or USB transfers are slow**
- Ensure ``tud_task()``/``tuh_task()`` called frequently (< 1ms intervals)
- Use DMA for USB transfers if supported by your MCU
- Optimize endpoint buffer sizes
- Consider using high-speed USB if available
**Q: Some USB devices don't work with my host application**
- Not all devices follow USB standards perfectly
- Some may need device-specific handling
- Composite devices may have partial support
- Check device descriptors and implement custom drivers if needed
**Q: ESP32-S3 USB host/device issues**
ESP32-S3 has specific USB implementation challenges:
- Ensure proper USB pin configuration
- Check power supply requirements for host mode
- Some features may be limited compared to other MCUs
- Use ESP32-S3 specific examples and documentation
+193
View File
@@ -0,0 +1,193 @@
***************
Getting Started
***************
This guide will get you up and running with TinyUSB quickly with working examples.
Project Structure
====================
TinyUSB separates example applications from board-specific hardware configurations:
* **Example applications**: Located in `examples/ <https://github.com/hathach/tinyusb/tree/master/examples/>`_ directories
* **Board Support Packages (BSP)**: Located in ``hw/bsp/FAMILY/boards/BOARD_NAME/`` with hardware abstraction including pin mappings, clock settings, and linker scripts
* **Build system**: Located in `examples/build_system/ <https://github.com/hathach/tinyusb/tree/master/examples/build_system>`_ which supports both Make and CMake. Though some MCU families such as espressif or rp2040 only support cmake
For example, stm32h743eval is located in `hw/bsp/stm32h7/boards/stm32h743eval <https://github.com/hathach/tinyusb/tree/master/hw/bsp/stm32h7/boards/stm32h743eval>`_ where ``FAMILY=stm32h7`` and ``BOARD=stm32h743eval``. When you build with ``BOARD=stm32h743eval``, the build system automatically finds the corresponding BSP using the FAMILY.
For guidance on integrating TinyUSB into your own firmware (configuration, descriptors, initialization, and callback workflow), see :doc:`integration`.
Quick Start Examples
====================
The fastest way to understand TinyUSB is to see it working. These examples demonstrate core functionality and can be built immediately.
We'll assume you are using the **STM32H743 Eval board** (BOARD=stm32h743eval) under the **stm32h7** family. For other boards, see ``Board Support Packages`` below.
Get the Code
------------
.. code-block:: bash
$ git clone https://github.com/hathach/tinyusb tinyusb
$ cd tinyusb
$ python tools/get_deps.py -b stm32h743eval # or python tools/get_deps.py stm32h7
.. note::
Some MCU families require additional SDKs, please follow their instructions to install and set it up
* **rp2040**: Requires `pico-sdk <https://github.com/raspberrypi/pico-sdk>`_
* **Espressif (esp32)**: Requires `esp-idf <https://github.com/espressif/esp-idf>`_. Only a few examples support the ESP-IDF build system. Look for ones with `src/CMakeLists.txt` that contain `idf_component_register()`, such as `cdc_msc_freertos`.
.. note::
For MacOS native build with arm-none-eabi-gcc toolchain it's better to install it via brew install --cask gcc-arm-embedded
Simple Device Example
---------------------
The `cdc_msc <https://github.com/hathach/tinyusb/tree/master/examples/device/cdc_msc>`_ example creates a USB device with both a virtual serial port (CDC) and mass storage (MSC).
**What it does:**
* Appears as a serial port that echoes back any text you send
* Appears as a small USB drive with a README.TXT file
* Blinks an LED to show activity
**Build and run with CMake:**
.. code-block:: bash
$ cd examples/device/cdc_msc
$ cmake -DBOARD=stm32h743eval -B build # add "-G Ninja" to use Ninja build
$ cmake --build build
# cmake --build build --target cdc_msc-jlink
.. tip::
Flashed/Debugger can be selected with --target ``-jlink``, ``-stlink`` or ``-openocd`` depending on your board. Use ``--target help`` to list all supported targets.
**Build and run with Make:**
.. code-block:: bash
$ cd examples/device/cdc_msc
$ make BOARD=stm32h743eval all
$ make BOARD=stm32h743eval flash-jlink
.. tip::
Flashed/Debugger can be selected with target ``flash-jlink``, ``flash-stlink`` or ``flash-openocd`` depending on your board.
Connect the device to your computer and you'll see both a new serial port and a small USB drive appear.
Simple Host Example
-------------------
The `cdc_msc_hid <https://github.com/hathach/tinyusb/tree/master/examples/host/cdc_msc_hid>`_ example creates a USB host that can connect to USB devices with CDC, MSC, or HID interfaces.
**What it does:**
* Detects and enumerates connected USB devices
* Communicates with CDC devices (like USB-to-serial adapters)
* Reads from MSC devices (like USB drives)
* Receives input from HID devices (like keyboards and mice)
**Build and run with CMake:**
.. code-block:: bash
$ cd examples/host/cdc_msc_hid
$ cmake -DBOARD=stm32h743eval -B build
$ cmake --build build
**Build and run with Make:**
.. code-block:: bash
$ cd examples/host/cdc_msc_hid
$ make BOARD=stm32h743eval all
$ make BOARD=stm32h743eval flash-jlink
Connect USB devices to see enumeration messages and device-specific interactions in the serial output.
Additional Build Options
------------------------
Debug and Logging
^^^^^^^^^^^^^^^^^
TinyUSB built-in logging can be enabled by setting `CFG_TUSB_DEBUG` which is done by passing ``LOG=level``. The higher the level, the more verbose the logging.
In addition to traditional hw uart as default, logging with debugger such as `Segger RTT <https://www.segger.com/products/debug-probes/j-link/technology/about-real-time-transfer/>`_ (10x faster) is also supported with `LOGGER=rtt` option.
.. code-block:: bash
$ cmake -B build -DBOARD=stm32h743eval -DLOG=2 # logging level 2 with uart
$ cmake -B build -DBOARD=stm32h743eval -DLOG=2 -DLOGGER=rtt # logging level 2 with RTT
.. code-block:: bash
$ make BOARD=stm32h743eval LOG=2 all # logging level 2 with uart
$ make BOARD=stm32h743eval LOG=2 LOGGER=rtt all # logging level 2 with RTT
RootHub Port Selection
^^^^^^^^^^^^^^^^^^^^^^
Some boards support multiple usb controllers (roothub ports), by default one rh port is used as device, another as host in ``board.mk/board.cmake``. This can be overridden with option ``RHPORT_DEVICE=n`` or ``RHPORT_HOST=n`` To choose another port. For example to select the HS port of a STM32F746Disco board, use:
.. code-block:: bash
$ cmake -B build -DBOARD=stm32h743eval -DRHPORT_DEVICE=1 # select roothub port 1 as device
.. code-block:: bash
$ make BOARD=stm32h743eval RHPORT_DEVICE=1 all # select roothub port 1 as device
RootHub Port Speed
^^^^^^^^^^^^^^^^^^
A MCU can support multiple operational speed. By default, the example build system will use the fastest supported on the board. Use option ``RHPORT_DEVICE_SPEED=OPT_MODE_FULL/HIGH_SPEED/`` or ``RHPORT_HOST_SPEED=OPT_MODE_FULL/HIGH_SPEED/`` e.g To force operating speed
.. code-block:: bash
$ cmake -B build -DBOARD=stm32h743eval -DRHPORT_DEVICE_SPEED=OPT_MODE_FULL_SPEED
.. code-block:: bash
$ make BOARD=stm32h743eval RHPORT_DEVICE_SPEED=OPT_MODE_FULL_SPEED all
IAR Embedded Workbench
----------------------
For IAR users, project connection files are available. Import `tools/iar_template.ipcf <https://github.com/hathach/tinyusb/tree/master/tools/iar_template.ipcf>`_ or use native CMake support (IAR 9.50.1+). See `tools/iar_gen.py <https://github.com/hathach/tinyusb/tree/master/tools/iar_gen.py>`_ for automated project generation.
Common Issues and Solutions
---------------------------
**Build Errors**
* **"arm-none-eabi-gcc: command not found"**: Install ARM GCC toolchain: ``sudo apt-get install gcc-arm-none-eabi``
* **"Board 'X' not found"**: Check the available boards in ``hw/bsp/FAMILY/boards/`` or run ``python tools/build.py -l``
* **Missing dependencies**: Run ``python tools/get_deps.py FAMILY`` where FAMILY matches your board or ``python tools/get_deps.py -b BOARD``
**Runtime Issues**
* **Device not recognized**: Check USB descriptors implementation and ``tusb_config.h`` settings
* **Enumeration failure**: Enable logging with ``LOG=2`` and check for USB protocol errors
* **Hard faults/crashes**: Verify interrupt handler setup and stack size allocation
**Linux Permissions**
Some examples require udev permissions to access USB devices:
.. code-block:: bash
$ cp `examples/device/99-tinyusb.rules <https://github.com/hathach/tinyusb/tree/master/examples/device/99-tinyusb.rules>`_ /etc/udev/rules.d/
$ sudo udevadm control --reload-rules && sudo udevadm trigger
Next Steps
==========
* Check :doc:`integration` for integrating TinyUSB into your own firmware
* Check :doc:`reference/boards` for board-specific information
* Explore more examples in `examples/device/ <https://github.com/hathach/tinyusb/tree/master/examples/device>`_ and `examples/host/ <https://github.com/hathach/tinyusb/tree/master/examples/host>`_ directories
* Read :doc:`reference/usb_concepts` to understand USB fundamentals
+37
View File
@@ -0,0 +1,37 @@
.. include:: ../README_processed.rst
.. toctree::
:maxdepth: 1
:hidden:
self
.. toctree::
:maxdepth: 2
:caption: Documentation
:hidden:
getting_started
integration
porting
reference/index
troubleshooting
faq
maintainers
changelog/index
.. toctree::
:maxdepth: 2
:caption: Examples
:hidden:
examples/device/index
examples/host/index
examples/dual/index
.. toctree::
:caption: External Links
:hidden:
GitHub <https://github.com/hathach/tinyusb>
Discussions <https://github.com/hathach/tinyusb/discussions>
+93
View File
@@ -0,0 +1,93 @@
*******************
Integrating TinyUSB
*******************
Once you've seen TinyUSB working in the examples, use this guide to wire the stack into your own firmware.
Integration Steps
=================
1. **Get TinyUSB**: Copy this repository or add it as a git submodule to your project at ``your_project/tinyusb``.
2. **Add source files**: Add every ``.c`` file from ``tinyusb/src/`` to your project build system.
.. note::
Only supported dcd/hcd drivers for your CPU sources under ``tinyusb/src/portable/vendor/usbip/`` are needed. Add
3. **Configure TinyUSB**: Create ``tusb_config.h`` with macros such as ``CFG_TUSB_MCU``, ``CFG_TUSB_OS``, and class enable flags. Start from any example's ``tusb_config.h`` and tweak.
4. **Configure include paths**: Add ``your_project/tinyusb/src`` (and the folder holding ``tusb_config.h``) to your include paths.
5. **Implement USB descriptors**: For device stack, implement the ``tud_descriptor_*_cb()`` callbacks (device) or host descriptor helpers that match your product.
6. **Initialize TinyUSB**: Call ``tusb_init()`` once the clocks/peripherals are ready. Pass ``tusb_rhport_init_t`` if you need per-port settings.
7. **Handle interrupts**: From the USB ISR call ``tusb_int_handler(rhport, true)`` so the stack can process events.
8. **Run USB tasks**: Call ``tud_task()`` (device) or ``tuh_task()`` (host) regularly from the main loop, RTOS task.
9. **Implement class callbacks**: Provide the callbacks for the classes you enabled (e.g., ``tud_cdc_rx_cb()``, ``tuh_msc_mount_cb()``).
Minimal Example
===============
.. code-block:: c
#include "tusb.h"
int main(void) {
board_init(); // Your board initialization
// Init device stack on roothub port 0 for highspeed device
tusb_rhport_init_t dev_init = {
.role = TUSB_ROLE_DEVICE,
.speed = TUSB_SPEED_HIGH
};
tusb_init(0, &dev_init);
// init host stack on roothub port 1 for fullspeed host
tusb_rhport_init_t host_init = {
.role = TUSB_ROLE_HOST,
.speed = TUSB_SPEED_FULL
};
tusb_init(1, &host_init);
while (1) {
tud_task(); // device task
tuh_task(); // host task
app_task(); // Your application logic
}
}
void USB0_IRQHandler(void) {
// forward interrupt port 0 to TinyUSB stack
tusb_int_handler(0, true);
}
void USB1_IRQHandler(void) {
// forward interrupt port 1 to TinyUSB stack
tusb_int_handler(1, true);
}
.. note::
Unlike many libraries, TinyUSB callbacks don't need to be registered. Implement functions with the prescribed names (for example ``tud_cdc_rx_cb()``) and the stack will invoke them automatically.
.. note::
Naming follows ``tud_*`` for device APIs and ``tuh_*`` for host APIs. Refer to :doc:`reference/glossary` for a summary of the prefixes and callback naming rules.
STM32CubeIDE Integration
========================
To integrate TinyUSB device stack with STM32CubeIDE
1. In STM32CubeMX, enable USB_OTG_FS/HS under Connectivity, set to "Device_Only" mode
2. Enable the USB global interrupt in NVIC Settings
3. Add ``tusb.h`` include and call ``tusb_init()`` in main.c
4. Call ``tud_task()`` in your main loop
5. In the generated ``stm32xxx_it.c``, modify the USB IRQ handler to call ``tud_int_handler(0)``
.. code-block:: c
void OTG_FS_IRQHandler(void) {
tud_int_handler(0);
}
6. Create ``tusb_config.h`` and ``usb_descriptors.c`` files
.. tip::
STM32CubeIDE generated code conflicts with TinyUSB. Don't use STM32's built-in USB middleware (USB Device Library) when using TinyUSB. Disable USB code generation in STM32CubeMX and let TinyUSB handle all USB functionality.
+1
View File
@@ -0,0 +1 @@
.. include:: ../MAINTAINERS.rst
+253
View File
@@ -0,0 +1,253 @@
*******
Porting
*******
TinyUSB is designed to be a universal USB protocol stack for microcontrollers. It
handles most of the high level USB protocol and relies on the microcontroller's USB peripheral for
data transactions on different endpoints. Porting is the process of adding low-level support for
the rest of the common stack. Once the low-level is implemented, it is very easy to add USB support
for the microcontroller to other projects, especially those already using TinyUSB such as CircuitPython.
Below are instructions on how to get the cdc_msc device example running on a new microcontroller. Doing so includes adding the common code necessary for other uses while minimizing other extra code. Whenever you see a phrase or word in ``<>`` it should be replaced.
Register defs
-------------
The first step to adding support is including the register definitions and startup code for the
microcontroller in TinyUSB. We write the TinyUSB implementation against these structs instead of higher level functions to keep the code small and to prevent function name collisions in linking of larger projects. For ARM microcontrollers this is the CMSIS definitions. They should be
placed in the ``hw/mcu/<vendor>/<chip_family>`` directory.
Once this is done, create a directory in ``hw/bsp/<your board name>`` for the specific board you are using to test the code (duplicating an existing board's directory is the best way to get started). The board should be a readily available development board so that others can also test.
Build
-----
Now that those directories are in place, we can start our iteration process to get the example building successfully. To build, run from the root of TinyUSB:
.. code-block:: bash
make -C examples/device/cdc_msc BOARD=<board>
Unless you've read ahead, this will fail miserably. Now, lets get it to fail less by updating the files in the board directory. The code in the board's directory is responsible for setting up the microcontroller's clocks and pins so that USB works. TinyUSB itself only operates on the USB peripheral. The board directory also includes information what files are needed to build the example.
One of the first things to change is the ``-DCFG_TUSB_MCU`` C flag in the ``board.mk`` file. This is used to tell TinyUSB what platform is being built. So, add an entry to ``src/tusb_option.h`` and update the ``CFLAGS`` to match.
Update ``board.mk``'s VENDOR and CHIP_FAMILY values when creating the directory for the struct files. Duplicate one of the other sources from ``src/portable`` into ``src/portable/<vendor>/<chip_family>`` and delete all of the implementation internals. We'll cover what everything there does later. For now, get it compiling.
Implementation
--------------
At this point you should get an error due to an implementation issue and hopefully the build is setup for the new MCU. You will still need to modify the ``board.mk`` to include specific ``CFLAGS``, the linker script, linker flags, source files, include directories. All file paths are relative to the top of the TinyUSB repo.
Board Support (BSP)
^^^^^^^^^^^^^^^^^^^
The board support code is only used for self-contained examples and testing. It is not used when TinyUSB is part of a larger project. Its responsible for getting the MCU started and the USB peripheral clocked. It also optionally provides LED definitions that are used to blink an LED to show that the code is running.
It is located in ``hw/bsp/<board name>/board_<board name>.c``.
``board_init()``
~~~~~~~~~~~~~~~~
``board_init()`` is responsible for starting the MCU, setting up the USB clock and USB pins. It is also responsible for initializing LED pins.
One useful clock debugging technique is to set up a PWM output at a known value such as 500hz based on the USB clock so that you can verify it is correct with a logic probe or oscilloscope.
Setup your USB in a crystal-less mode when available. That makes the code easier to port across boards.
``board_led_write()``
~~~~~~~~~~~~~~~~~~~~~
Feel free to skip this until you want to verify your demo code is running. To implement, set the pin corresponding to the led to output a value that lights the LED when ``state`` is true.
OS Abstraction Layer (OSAL)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
The OS Abstraction Layer is responsible for providing basic data structures for TinyUSB that may allow for concurrency when used with an RTOS. Without an RTOS it simply handles concurrency issues between the main code and interrupts. The code is almost entirely agnostic of MCU and lives in ``src/osal``.
In RTOS configurations, ``tud_task()``/``tuh_task()`` blocks behind a synchronization structure when the event queue is empty, so that the scheduler may give the CPU to a different task. To take advantage of the library's capability to yield the CPU when there are no actionable USB device events, ensure that the ``CFG_TUSB_OS`` symbol is defined, e.g ``OPT_OS_FREERTOS`` enables the FreeRTOS scheduler to schedule other threads than that which calls ``tud_task()``/``tuh_task()``.
Device API
^^^^^^^^^^
After the USB device is setup, the USB device code works by processing events on the main thread (by calling ``tud_task()``). These events are queued by the USB interrupt handler. So, there are three parts to the device low-level API: device setup, endpoint setup and interrupt processing.
All of the code for the low-level device API is in ``src/portable/<vendor>/<chip family>/dcd_<chip family>.c``.
Device Setup
~~~~~~~~~~~~
``dcd_init()``
""""""""""""""
Initializes the USB peripheral for device mode and enables it.
This function should enable internal D+/D- pull-up for enumeration.
``dcd_int_enable()`` / ``dcd_int_disable()``
""""""""""""""""""""""""""""""""""""""""""""
Enables or disables the USB device interrupt(s). May be used to prevent concurrency issues when mutating data structures shared between main code and the interrupt handler.
``dcd_int_handler()``
"""""""""""""""""""""
Processes all the hardware generated events e.g Bus reset, new data packet from host etc ... It will be called by application in the MCU USB interrupt handler.
``dcd_set_address()``
"""""""""""""""""""""
Called when the device is given a new bus address.
If your peripheral automatically changes address during enumeration (like the nrf52) you may leave this empty and also no queue an event for the corresponding SETUP packet.
``dcd_remote_wakeup()``
"""""""""""""""""""""""
Called to remote wake up host when suspended (e.g hid keyboard)
``dcd_connect()`` / ``dcd_disconnect()``
""""""""""""""""""""""""""""""""""""""""
Connect or disconnect the data-line pull-up resistor. Define only if MCU has an internal pull-up. (BSP may define for MCU without internal pull-up.)
Special events
~~~~~~~~~~~~~~
You must let TinyUSB know when certain events occur so that it can continue its work. There are a few methods you can call to queue events for TinyUSB to process.
``dcd_event_bus_signal()``
""""""""""""""""""""""""""
There are a number of events that your peripheral may communicate about the state of the bus. Here is an overview of what they are. Events in **BOLD** must be provided for TinyUSB to work.
* **DCD_EVENT_RESET** - Triggered when the host resets the bus causing the peripheral to reset. Do any other internal reset you need from the interrupt handler such as resetting the control endpoint.
* DCD_EVENT_SOF - Signals the start of a new USB frame.
Calls to this look like:
.. code-block:: c
dcd_event_bus_signal(0, DCD_EVENT_BUS_RESET, true);
The first ``0`` is the USB peripheral number. Statically saying ``0`` is common for single USB device MCUs.
The ``true`` indicates the call is from an interrupt handler and will always be the case when porting in this way.
``dcd_setup_received()``
""""""""""""""""""""""""
SETUP packets are a special type of transaction that can occur at any time on the control endpoint, numbered ``0``. Since they are unique, most peripherals have special handling for them. Their data is always 8 bytes in length as well.
Calls to this look like:
.. code-block:: c
dcd_event_setup_received(0, setup, true);
As before with ``dcd_event_bus_signal()`` the first argument is the USB peripheral number and the third is true to signal its being called from an interrupt handler. The middle argument is byte array of length 8 with the contents of the SETUP packet. It can be stack allocated because it is copied into the queue.
Endpoints
~~~~~~~~~
Endpoints are the core of the USB data transfer process. They come in a few forms such as control, isochronous, bulk, and interrupt. We won't cover the details here except with some caveats in open below. In general, data is transferred by setting up a buffer of a given length to be transferred on a given endpoint address and then waiting for an interrupt to signal that the transfer is finished. Further details below.
Endpoints within USB have an address which encodes both the number and direction of an endpoint. TinyUSB provides ``tu_edpt_number()`` and ``tu_edpt_dir()`` to unpack this data from the address. Here is a snippet that does it.
.. code-block:: c
uint8_t epnum = tu_edpt_number(ep_addr);
uint8_t dir = tu_edpt_dir(ep_addr);
``dcd_edpt_open()``
"""""""""""""""""""
Opening an endpoint is done for all non-control endpoints once the host picks a configuration that the device should use. At this point, the endpoint should be enabled in the peripheral and configured to match the endpoint descriptor. Pay special attention to the direction of the endpoint you can get from the helper methods above. It will likely change what registers you are setting.
Also make sure to enable endpoint specific interrupts.
``dcd_edpt_close()``
""""""""""""""""""""
.. warning::
This function is deprecated, ISO transfer should implement dcd_edpt_iso_alloc() and dcd_edpt_iso_activate() instead.
Close an endpoint. his function is used for implementing alternate settings.
After calling this, the device should not respond to any packets directed towards this endpoint. When called, this function must abort any transfers in progress through this endpoint, before returning.
Implementation is optional. Must be called from the USB task. Interrupts could be disabled or enabled during the call.
``dcd_edpt_iso_alloc() / dcd_edpt_iso_activate()``
""""""""""""""""""""""""""""""""""""""""""""""""""
dcd_edpt_iso_alloc() is used to allocate largest buffer (for all alternative interfaces) for ISO endpoints when device is enumerated. This allows DCD to allocate necessary resources for ISO endpoints in the future.
dcd_edpt_iso_activate() is used to activate or deactivate ISO endpoint when alternate setting is set with active max packet size.
``dcd_edpt_xfer()``
"""""""""""""""""""
``dcd_edpt_xfer()`` is responsible for configuring the peripheral to send or receive data from the host. "xfer" is short for "transfer". **This is one of the core methods you must implement for TinyUSB to work (one other is the interrupt handler).** Data from the host is the OUT direction and data to the host is IN. It is used for all endpoints including the control endpoint 0. Make sure to handle the zero-length packet STATUS packet on endpoint 0 correctly. It may be a special transaction to the peripheral.
Besides that, all other transactions are relatively straight-forward. The endpoint address provides the endpoint
number and direction which usually determines where to write the buffer info. The buffer and its length are usually
written to a specific location in memory and the peripheral is told the data is valid. (Maybe by writing a 1 to a
register or setting a counter register to 0 for OUT or length for IN.)
The transmit buffer alignment is determined by ``CFG_TUSB_MEM_ALIGN``.
One potential pitfall is that the buffer may be longer than the maximum endpoint size of one USB
packet. Some peripherals can handle transmitting multiple USB packets for a provided buffer (like the SAMD21).
Others (like the nRF52) may need each USB packet queued individually. To make this work you'll need to track
some state for yourself and queue up an intermediate USB packet from the interrupt handler.
Once the transaction is going, the interrupt handler will notify TinyUSB of transfer completion.
During transmission, the IN data buffer is guaranteed to remain unchanged in memory until the ``dcd_xfer_complete()`` function is called.
The ``dcd_edpt_xfer()`` function must never add zero-length-packets (ZLP) on its own to a transfer. If a ZLP is required,
then it must be explicitly sent by the stack calling ``dcd_edpt_xfer()``, by calling ``dcd_edpt_xfer()`` a second time with len=0.
For control transfers, this is automatically done in ``usbd_control.c``.
At the moment, only a single buffer can be transmitted at once. There is no provision for double-buffering. new ``dcd_edpt_xfer()`` will not
be called again on the same endpoint address until the driver calls ``dcd_xfer_complete()`` (except in cases of USB resets).
``dcd_xfer_complete()``
"""""""""""""""""""""""
Once a transfer completes you must call ``dcd_xfer_complete()`` from the USB interrupt handler to let TinyUSB know that a transaction has completed. Here is a sample call:
.. code-block:: c
dcd_event_xfer_complete(0, ep_addr, xfer->actual_len, XFER_RESULT_SUCCESS, true);
The arguments are:
* the USB peripheral number
* the endpoint address
* the actual length of the transfer. (OUT transfers may be smaller than the buffer given in ``dcd_edpt_xfer()``)
* the result of the transfer. Failure isn't handled yet.
* ``true`` to note the call is from an interrupt handler.
``dcd_edpt_stall()`` / ``dcd_edpt_clear_stall()``
"""""""""""""""""""""""""""""""""""""""""""""""""
Stalling is one way an endpoint can indicate failure such as when an unsupported command is transmitted. The pair of ``dcd_edpt_stall()``, ``dcd_edpt_clear_stall()`` help manage the stall state of all endpoints.
Woohoo!
-------
At this point you should have everything working! 🙂 Of course, you may not write perfect code. Here are some tips and tricks for debugging.
Use `WireShark <https://www.wireshark.org/>`_ or `a Beagle <https://www.totalphase.com/protocols/usb/>`_ to sniff the USB traffic. When things aren't working its likely very early in the USB enumeration process. Figuring out where can help clue in where the issue is. For example:
* If the host sends a SETUP packet and its not ACKed then your USB peripheral probably isn't started correctly.
* If the peripheral is started correctly but it still didn't work, then verify your usb clock is correct. (You did output a PWM based on it right? 🙂)
* If the SETUP packet is ACKed but nothing is sent back then you interrupt handler isn't queueing the setup packet correctly. (Also, if you are using your own code instead of an example ``tud_task()`` may not be called.) If that's OK, the ``dcd_xfer_complete()`` may not be setting up the next transaction correctly.
+282
View File
@@ -0,0 +1,282 @@
************
Architecture
************
This document explains TinyUSB's internal architecture, design principles, and how different components work together.
Design Principles
=================
Memory Safety
-------------
TinyUSB is designed for resource-constrained embedded systems with strict memory requirements:
TinyUSB uses **no dynamic allocation** - all memory is statically allocated at compile time for predictability. All buffers have bounded, compile-time defined sizes to prevent overflow issues. The TinyUSB core avoids heap allocation, resulting in **predictable memory usage** where consumption is fully deterministic.
Thread Safety
-------------
TinyUSB achieves thread safety through a deferred interrupt model:
- **ISR deferral**: USB interrupts are captured and deferred to task context
- **Single-threaded processing**: All USB protocol handling occurs in task context
- **Queue-based design**: Events are queued from ISR and processed in ``tud_task()``
- **RTOS integration**: Proper semaphore/mutex usage for shared resources
Portability
-----------
The stack is designed to work across diverse microcontroller families:
- **Hardware abstraction**: MCU-specific code isolated in portable drivers
- **OS abstraction**: RTOS dependencies isolated in OSAL layer
- **Modular design**: Features can be enabled/disabled at compile time
- **Standard compliance**: Strict adherence to USB specifications
Core Architecture
=================
Layer Structure
---------------
TinyUSB follows a layered architecture from hardware to application:
.. figure:: ../assets/stack.svg
:width: 500px
:align: left
:alt: stackup
.. raw:: html
<div class="clear-both"></div>
Component Overview
------------------
- **Application Layer**: Your main application code that uses TinyUSB APIs.
- **Class Drivers**: Implement specific USB device classes (CDC, HID, MSC, etc.) and handle class-specific requests.
- **Device/Host Core**: Implements USB protocol state machines, endpoint management, and core USB functionality.
- **OS Abstraction**: Provides threading primitives and synchronization for different RTOS environments.
- **Device/Host Controller Driver**: drivers that interface with MCU USB peripherals. Several MCUs may share a common driver.
Device Stack Architecture
=========================
This section is concerned with the **Device Stack**, i.e., the component of TinyUSB used in USB devices (that talk to a USB host).
Core Components
---------------
**Device Controller Driver (DCD)**:
- MCU-specific USB device peripheral driver
- Handles endpoint configuration and data transfers
- Abstracts hardware differences between MCU families
- Located in ``src/portable/VENDOR/USBIP/``
**USB Device Core (USBD)**:
- Implements USB device state machine
- Handles standard USB requests (Chapter 9)
- Manages device configuration and enumeration
- Located in ``src/device/``
**Class Drivers**:
- Implement USB class specifications
- Handle class-specific requests and data transfer
- Provide application APIs
- Located in ``src/class/*/``
Data Flow
---------
**Control Transfers (Setup Requests)**:
.. code-block:: none
USB Bus → DCD → USBD Core → Class Driver → Application
↓
Standard requests handled in core
↓
Class-specific requests → Class Driver
**Data Transfers**:
.. code-block:: none
Application → Class Driver → USBD Core → DCD → USB Bus
USB Bus → DCD → USBD Core → Class Driver → Application
Event Processing
----------------
TinyUSB uses a deferred interrupt model for thread safety:
1. **Interrupt Occurs**: USB hardware generates interrupt
2. **ISR Handler**: ``dcd_int_handler()`` captures event, minimal processing
3. **Event Queuing**: Events queued for later processing
4. **Task Processing**: ``tud_task()`` (called by application code) processes queued events
5. **Callback Execution**: Application callbacks executed in task context
.. code-block:: none
USB IRQ → ISR → Event Queue → tud_task() → Class Callbacks → Application
Host Stack Architecture
=======================
This section is concerned with the **Host Stack**, i.e., the component of TinyUSB used in USB hosts, managing connected USB devices.
Core Components
---------------
**Host Controller Driver (HCD)**:
- MCU-specific USB host peripheral driver
- Manages USB pipes and data transfers
- Handles host controller hardware
- Located in ``src/portable/VENDOR/FAMILY/``
**USB Host Core (USBH)**:
- Implements USB host functionality
- Manages device enumeration and configuration
- Handles pipe management and scheduling
- Located in ``src/host/``
**Hub Driver**:
- Manages USB hub devices
- Handles port management and device detection
- Supports multi-level hub topologies
- Located in ``src/host/``
Device Enumeration
------------------
The host stack follows USB enumeration process:
1. **Device Detection**: Hub or root hub detects device connection
2. **Reset and Address**: Reset device, assign unique address
3. **Descriptor Retrieval**: Get device, configuration, and class descriptors
4. **Driver Matching**: Find appropriate class driver for device
5. **Configuration**: Configure device and start communication
6. **Class Operation**: Normal class-specific communication
.. code-block:: none
Device Connect → Reset → Get Descriptors → Load Driver → Configure → Operate
Class Architecture
==================
Common Class Structure
----------------------
All USB classes follow a similar architecture:
**Device Classes**:
- ``*_device.c``: Device-side implementation
- ``*_device.h``: Device API definitions
- Implement class-specific descriptors
- Handle class requests and data transfer
**Host Classes**:
- ``*_host.c``: Host-side implementation
- ``*_host.h``: Host API definitions
- Manage connected devices of this class
- Provide application interface
Class Driver Interface
----------------------
See ``usbd.c``.
**Required Functions**:
- ``init()``: Initialize class driver
- ``reset()``: Reset class state
- ``open()``: Configure class endpoints
- ``control_xfer_cb()``: Handle control requests
- ``xfer_cb()``: Handle data transfer completion
**Optional Functions**:
- ``close()``: Clean up class resources
- ``deinit()``: Deinitialize class driver
- ``sof()``: Start-of-frame processing
- ``xfer_isr()``: Called from USB ISR context on transfer completion. Data will get queued for ``xfer_cb()`` only if this returns ``false``.
Descriptor Management
---------------------
Each class is responsible for:
- **Interface Descriptors**: Define class type and endpoints
- **Class-Specific Descriptors**: Additional class requirements
- **Endpoint Descriptors**: Define data transfer characteristics
Memory Management
=================
Static Allocation Model
-----------------------
TinyUSB uses only static memory allocation; it allocates fixed-size endpoint buffers for each configured endpoint, static buffers for class-specific data handling, a fixed buffer dedicated to control transfers, and static event queues for deferred interrupt processing.
Buffer Management
-----------------
**Endpoint Buffers**:
- Allocated per endpoint at compile time
- Size defined by ``CFG_TUD_*_EP_BUFSIZE`` macros
- Used for USB data transfers
**FIFO Buffers**:
- Ring buffers for streaming data
- Size defined by ``CFG_TUD_*_RX/TX_BUFSIZE`` macros
- Separate read/write pointers
Threading Model
===============
Task-Based Design
-----------------
TinyUSB uses a cooperative task model; it provides main tasks - ``tud_task()`` for device and ``tuh_task()`` for host operation. These tasks must be called regularly (typically less than 1ms intervals) to ensure all USB events are processed in task context, where application callbacks also execute.
RTOS Integration
----------------
**Bare Metal**:
- Application calls ``tud_task()`` in main loop
- No threading primitives needed
- Simplest integration method
**FreeRTOS**:
- USB task runs at high priority
- Semaphores used for synchronization
- Queue for inter-task communication
**Other RTOS**:
- Similar patterns with RTOS-specific primitives
- OSAL layer abstracts RTOS differences
Interrupt Handling
------------------
**Interrupt Service Routine**:
- Minimal processing in ISR
- Event capture and queuing only
- Quick return to avoid blocking
**Deferred Processing**:
- All complex processing in task context
- Thread-safe access to data structures
- Application callbacks in known context
Memory Usage Patterns
---------------------
**Flash Memory**:
- Core stack: 8-15KB depending on features
- Each class: 1-4KB additional
- Portable driver: 2-8KB depending on MCU
**RAM Usage**:
- Core stack: 1-2KB
- Endpoint buffers: User configurable
- Class buffers: Depends on configuration
+379
View File
@@ -0,0 +1,379 @@
****************
Supported Boards
****************
The board support code is only used for self-contained examples and testing. It is not used when TinyUSB is part of a larger project.
It is responsible for getting the MCU started and the USB peripheral clocked with minimal of on-board devices
- One LED : for status
- One Button : to get input from user
- One UART : needed for logging with LOGGER=uart, maybe required for host/dual examples
Following boards are supported
Analog Devices
--------------
============= ================ ======== ================================================================================================================= ======
Board Name Family URL Note
============= ================ ======== ================================================================================================================= ======
apard32690 APARD32690-SL maxim https://www.analog.com/en/resources/evaluation-hardware-and-software/evaluation-boards-kits/ad-apard32690-sl.html
max32650evkit MAX32650 EVKIT maxim https://www.analog.com/en/resources/evaluation-hardware-and-software/evaluation-boards-kits/max32650-evkit.html
max32650fthr MAX32650 Feather maxim https://www.analog.com/en/resources/evaluation-hardware-and-software/evaluation-boards-kits/max32650fthr.html
max32651evkit MAX32651 EVKIT maxim https://www.analog.com/en/resources/evaluation-hardware-and-software/evaluation-boards-kits/max32651-evkit.html
max32666evkit MAX32666 EVKIT maxim https://www.analog.com/en/resources/evaluation-hardware-and-software/evaluation-boards-kits/max32666evkit.html
max32666fthr MAX32666 Feather maxim https://www.analog.com/en/resources/evaluation-hardware-and-software/evaluation-boards-kits/max32666fthr.html
max32690evkit MAX32690 EVKIT maxim https://www.analog.com/en/resources/evaluation-hardware-and-software/evaluation-boards-kits/max32690evkit.html
max78002evkit MAX78002 EVKIT maxim https://www.analog.com/en/resources/evaluation-hardware-and-software/evaluation-boards-kits/max78002evkit.html
============= ================ ======== ================================================================================================================= ======
Artery
------
========================= ============================= ============= ==================================================== ======
Board Name Family URL Note
========================= ============================= ============= ==================================================== ======
at_start_f402 AT-START-F402 at32f402_405 https://www.arterychip.com/en/product/AT32F402.jsp
at_start_f405 AT-START-F405 at32f402_405 https://www.arterychip.com/en/product/AT32F405.jsp
at32f403a_weact_blackpill WeAct BlackPill AT32F403ACGU7 at32f403a_407 https://github.com/WeActStudio/WeActStudio.BlackPill
at_start_f403a AT-START-F403a at32f403a_407 https://www.arterychip.com/en/product/AT32F403.jsp
at_start_f407 AT-START-F407 at32f403a_407 https://www.arterychip.com/en/product/AT32F407.jsp
at_start_f413 AT-START-F413 at32f413 https://www.arterychip.com/en/product/AT32F413.jsp
at_start_f415 AT-START-F415 at32f415 https://www.arterychip.com/en/product/AT32F415.jsp
at_start_f423 AT-START-F423 at32f423 https://www.arterychip.com/en/product/AT32F423.jsp
at_start_f425 AT-START-F425 at32f425 https://www.arterychip.com/en/product/AT32F425.jsp
at_start_f435 AT-START-F435 at32f435_437 https://www.arterychip.com/en/product/AT32F435.jsp
at_start_f437 AT-START-F437 at32f435_437 https://www.arterychip.com/en/product/AT32F437.jsp
at_start_f455 AT-START-F455 at32f45x https://www.arterychip.com/en/product/AT32F455.jsp
at_start_f456 AT-START-F456 at32f45x https://www.arterychip.com/en/product/AT32F456.jsp
at_start_f457 AT-START-F457 at32f45x https://www.arterychip.com/en/product/AT32F457.jsp
========================= ============================= ============= ==================================================== ======
Bridgetek
---------
========= ========= ======== ===================================== ======
Board Name Family URL Note
========= ========= ======== ===================================== ======
mm900evxb MM900EVxB ft9xx https://brtchip.com/product/mm900ev1b
========= ========= ======== ===================================== ======
Espressif
---------
========================= ============================== ========= ======================================================================================================== ======
Board Name Family URL Note
========================= ============================== ========= ======================================================================================================== ======
adafruit_feather_esp32_v2 Adafruit Feather ESP32 v2 espressif https://www.adafruit.com/product/5400
adafruit_feather_esp32c6 Adafruit Feather EPS32-C6 espressif https://www.adafruit.com/product/5933
adafruit_feather_esp32s2 Adafruit Feather ESP32S2 espressif https://www.adafruit.com/product/5000
adafruit_feather_esp32s3 Adafruit Feather ESP32S3 espressif https://www.adafruit.com/product/5323
adafruit_magtag_29gray Adafruit MagTag 2.9" Grayscale espressif https://www.adafruit.com/product/4800
adafruit_metro_esp32s2 Adafruit Metro ESP32-S2 espressif https://www.adafruit.com/product/4775
espressif_addax_1 Espresif Addax-1 espressif n/a
espressif_c3_devkitc Espresif C3 DevKitC espressif https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32c3/esp32-c3-devkitc-02/index.html
espressif_c6_devkitc Espresif C6 DevKitC espressif https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32c6/esp32-c6-devkitc-1/index.html
espressif_kaluga_1 Espresif Kaluga 1 espressif https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32s2/esp32-s2-kaluga-1/index.html
espressif_p4_function_ev Espresif P4 Function EV espressif https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32p4/esp32-p4-function-ev-board/index.html
espressif_s2_devkitc Espresif S2 DevKitC espressif https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32s2/esp32-s2-devkitc-1/index.html
espressif_s3_devkitc Espresif S3 DevKitC espressif https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32s3/esp32-s3-devkitc-1/index.html
espressif_s3_devkitm Espresif S3 DevKitM espressif https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32s3/esp32-s3-devkitm-1/index.html
espressif_saola_1 Espresif S2 Saola 1 espressif https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32s2/esp32-s2-saola-1/index.html
========================= ============================== ========= ======================================================================================================== ======
GigaDevice
----------
================== ================== ========= ============================= ======
Board Name Family URL Note
================== ================== ========= ============================= ======
sipeed_longan_nano Sipeed Longan Nano gd32vf103 https://longan.sipeed.com/en/
================== ================== ========= ============================= ======
HPMicro
-------
=========== =========== ======== ========================================================================== ======
Board Name Family URL Note
=========== =========== ======== ========================================================================== ======
hpm6750evk2 HPM6750EVK2 hpmicro https://hpm-sdk.readthedocs.io/en/v1.6.0/boards/hpm6750evk2/README_en.html
=========== =========== ======== ========================================================================== ======
Infineon
--------
============= ================= ======== ============================================================================= ======
Board Name Family URL Note
============= ================= ======== ============================================================================= ======
xmc4500_relax XMC4500 relax kit xmc4000 https://www.infineon.com/cms/en/product/evaluation-boards/kit_xmc45_relax_v1/
xmc4700_relax XMC4700 relax kit xmc4000 https://www.infineon.com/cms/en/product/evaluation-boards/kit_xmc47_relax_v1/
============= ================= ======== ============================================================================= ======
Microchip
---------
========================= =================================== ========== ================================================================================= ======
Board Name Family URL Note
========================= =================================== ========== ================================================================================= ======
olimex_emz64 Olimex PIC32-EMZ64 pic32mz https://www.olimex.com/Products/PIC/Development/PIC32-EMZ64/open-source-hardware
olimex_hmz144 Olimex PIC32-HMZ144 pic32mz https://www.olimex.com/Products/PIC/Development/PIC32-HMZ144/open-source-hardware
cynthion_d11 Great Scott Gadgets Cynthion samd11 https://greatscottgadgets.com/cynthion/
samd11_xplained SAMD11 Xplained Pro samd11 https://www.microchip.com/en-us/development-tool/ATSAMD11-XPRO
atsamd21_xpro SAMD21 Xplained Pro samd2x_l2x https://www.microchip.com/DevelopmentTools/ProductDetails/ATSAMD21-XPRO
atsaml21_xpro SAML21 Xplained Pro samd2x_l2x https://www.microchip.com/en-us/development-tool/atsaml21-xpro-b
circuitplayground_express Adafruit Circuit Playground Express samd2x_l2x https://www.adafruit.com/product/3333
curiosity_nano SAMD21 Curiosty Nano samd2x_l2x https://www.microchip.com/en-us/development-tool/dm320119
cynthion_d21 Great Scott Gadgets Cynthion samd2x_l2x https://greatscottgadgets.com/cynthion/
feather_m0_express Adafruit Feather M0 Express samd2x_l2x https://www.adafruit.com/product/3403
itsybitsy_m0 Adafruit ItsyBitsy M0 samd2x_l2x https://www.adafruit.com/product/3727
metro_m0_express Adafruit Metro M0 Express samd2x_l2x https://www.adafruit.com/product/3505
qtpy Adafruit QT Py samd2x_l2x https://www.adafruit.com/product/4600
saml22_feather SAML22 Feather samd2x_l2x https://github.com/joeycastillo/Feather-Projects/tree/main/SAML22%20Feather
seeeduino_xiao Seeeduino XIAO samd2x_l2x https://wiki.seeedstudio.com/Seeeduino-XIAO/
sensorwatch_m0 SensorWatch samd2x_l2x https://github.com/joeycastillo/Sensor-Watch
sparkfun_samd21_mini_usb SparkFun SAMD21 Mini samd2x_l2x https://www.sparkfun.com/products/13664
trinket_m0 Adafruit Trinket M0 samd2x_l2x https://www.adafruit.com/product/3500
d5035_01 D5035-01 samd5x_e5x https://github.com/RudolphRiedel/USB_CAN-FD
feather_m4_express Adafruit Feather M4 Express samd5x_e5x https://www.adafruit.com/product/3857
itsybitsy_m4 Adafruit ItsyBitsy M4 samd5x_e5x https://www.adafruit.com/product/3800
metro_m4_express Adafruit Metro M4 Express samd5x_e5x https://www.adafruit.com/product/3382
pybadge Adafruit PyBadge samd5x_e5x https://www.adafruit.com/product/4200
pyportal Adafruit PyPortal samd5x_e5x https://www.adafruit.com/product/4116
same54_xplained SAME54 Xplained Pro samd5x_e5x https://www.microchip.com/DevelopmentTools/ProductDetails/ATSAME54-XPRO
same70_qmtech SAME70 QMTech same7x https://www.aliexpress.com/item/1005003173783268.html
same70_xplained SAME70 Xplained same7x https://www.microchip.com/en-us/development-tool/atsame70-xpld
samg55_xplained SAMG55 Xplained Pro samg https://www.microchip.com/DevelopmentTools/ProductDetails/ATSAMG55-XPRO
========================= =================================== ========== ================================================================================= ======
MindMotion
----------
===================== ====================================== ======== =============================================================================================== ======
Board Name Family URL Note
===================== ====================================== ======== =============================================================================================== ======
mm32f327x_mb39 MM32F3273G9P MB-039 mm32 https://www.mindmotion.com.cn/support/development_tools/evaluation_boards/evboard/mm32f3273g9p/
mm32f327x_pitaya_lite DshanMCU Pitaya Lite with MM32F3273G8P mm32 https://gitee.com/weidongshan/DshanMCU-Pitaya-c
===================== ====================================== ======== =============================================================================================== ======
NXP
---
================== ========================================= ============ ========================================================================================================================================================================= ======
Board Name Family URL Note
================== ========================================= ============ ========================================================================================================================================================================= ======
metro_m7_1011 Adafruit Metro M7 1011 imxrt https://www.adafruit.com/product/5600
mimxrt1010_evk i.MX RT1010 Evaluation Kit imxrt https://www.nxp.com/design/design-center/development-boards-and-designs/i-mx-evaluation-and-development-boards/i-mx-rt1010-evaluation-kit:MIMXRT1010-EVK
mimxrt1015_evk i.MX RT1015 Evaluation Kit imxrt https://www.nxp.com/design/design-center/development-boards-and-designs/MIMXRT1015-EVK
mimxrt1020_evk i.MX RT1020 Evaluation Kit imxrt https://www.nxp.com/design/design-center/development-boards-and-designs/MIMXRT1020-EVK
mimxrt1024_evk i.MX RT1024 Evaluation Kit imxrt https://www.nxp.com/design/design-center/development-boards-and-designs/i-mx-evaluation-and-development-boards/i-mx-rt1024-evaluation-kit:MIMXRT1024-EVK
mimxrt1050_evkb i.MX RT1050 Evaluation Kit revB imxrt https://www.nxp.com/part/IMXRT1050-EVKB
mimxrt1060_evk i.MX RT1060 Evaluation Kit revB imxrt https://www.nxp.com/design/design-center/development-boards-and-designs/MIMXRT1060-EVKB
mimxrt1064_evk i.MX RT1064 Evaluation Kit imxrt https://www.nxp.com/design/design-center/development-boards-and-designs/MIMXRT1064-EVK
mimxrt1170_evkb i.MX RT1070 Evaluation Kit imxrt https://www.nxp.com/design/design-center/development-boards-and-designs/i-mx-evaluation-and-development-boards/i-mx-rt1170-evaluation-kit:MIMXRT1170-EVKB
teensy_40 Teensy 4.0 imxrt https://www.pjrc.com/store/teensy40.html
teensy_41 Teensy 4.1 imxrt https://www.pjrc.com/store/teensy41.html
frdm_k64f Freedom K64F kinetis_k https://www.nxp.com/design/design-center/development-boards-and-designs/general-purpose-mcus/freedom-development-platform-for-kinetis-k64-k63-and-k24-mcus:FRDM-K64F
teensy_35 Teensy 3.5 kinetis_k https://www.pjrc.com/store/teensy35.html
frdm_k32l2a4s Freedom K32L2A4S kinetis_k32l https://www.nxp.com/design/design-center/development-boards-and-designs/FRDM-K32L2A4S
frdm_k32l2b Freedom K32L2B3 kinetis_k32l https://www.nxp.com/design/design-center/development-boards-and-designs/general-purpose-mcus/nxp-freedom-development-platform-for-k32-l2b-mcus:FRDM-K32L2B3
kuiic Kuiic kinetis_k32l https://github.com/nxf58843/kuiic
frdm_kl25z fomu kinetis_kl https://www.nxp.com/design/design-center/development-boards-and-designs/general-purpose-mcus/freedom-development-platform-for-kinetis-kl14-kl15-kl24-kl25-mcus:FRDM-KL25Z
lpcxpresso11u37 LPCXpresso11U37 lpc11 https://www.nxp.com/design/design-center/development-boards-and-designs/OM13074
lpcxpresso11u68 LPCXpresso11U68 lpc11 https://www.nxp.com/design/design-center/development-boards-and-designs/OM13058
lpcxpresso1347 LPCXpresso1347 lpc13 https://www.nxp.com/products/no-longer-manufactured/lpcxpresso-board-for-lpc1347:OM13045
lpcxpresso1549 LPCXpresso1549 lpc15 https://www.nxp.com/design/design-center/development-boards-and-designs/OM13056
lpcxpresso1769 LPCXpresso1769 lpc17 https://www.nxp.com/design/design-center/development-boards-and-designs/OM13000
mbed1768 mbed 1768 lpc17 https://www.nxp.com/products/processors-and-microcontrollers/arm-microcontrollers/general-purpose-mcus/lpc1700-arm-cortex-m3/arm-mbed-lpc1768-board:OM11043
lpcxpresso18s37 LPCXpresso18s37 lpc18 https://www.nxp.com/design/design-center/software/development-software/mcuxpresso-software-and-tools-/lpcxpresso-boards/lpcxpresso18s37-development-board:OM13076
mcb1800 Keil MCB1800 lpc18 https://www.keil.com/arm/mcb1800/
ea4088_quickstart Embedded Artists LPC4088 QuickStart Board lpc40 https://www.embeddedartists.com/products/lpc4088-quickstart-board/
ea4357 Embedded Artists LPC4357 Development Kit lpc43 https://www.embeddedartists.com/products/lpc4357-developers-kit/
lpcxpresso43s67 LPCXpresso43S67 lpc43 https://www.nxp.com/design/design-center/software/development-software/mcuxpresso-software-and-tools-/lpcxpresso-boards/lpcxpresso43s67-development-board:OM13084
lpcxpresso51u68 LPCXpresso51u68 lpc51 https://www.nxp.com/products/processors-and-microcontrollers/arm-microcontrollers/general-purpose-mcus/lpcxpresso51u68-for-the-lpc51u68-mcus:OM40005
lpcxpresso54114 LPCXpresso54114 lpc54 https://www.nxp.com/design/design-center/software/development-software/mcuxpresso-software-and-tools-/lpcxpresso-boards/lpcxpresso54114-board:OM13089
lpcxpresso54608 LPCXpresso54608 lpc54 https://www.nxp.com/design/design-center/software/development-software/mcuxpresso-software-and-tools-/lpcxpresso-development-board-for-lpc5460x-mcus:OM13092
lpcxpresso54628 LPCXpresso54628 lpc54 https://www.nxp.com/design/design-center/software/development-software/mcuxpresso-software-and-tools-/lpcxpresso-boards/lpcxpresso54628-development-board:OM13098
double_m33_express Double M33 Express lpc55 https://www.crowdsupply.com/steiert-solutions/double-m33-express
lpcxpresso55s28 LPCXpresso55s28 lpc55 https://www.nxp.com/design/design-center/software/development-software/mcuxpresso-software-and-tools-/lpcxpresso-boards/lpcxpresso55s28-development-board:LPC55S28-EVK
lpcxpresso55s69 LPCXpresso55s69 lpc55 https://www.nxp.com/design/design-center/software/development-software/mcuxpresso-software-and-tools-/lpcxpresso-boards/lpcxpresso55s69-development-board:LPC55S69-EVK
mcu_link MCU Link lpc55 https://www.nxp.com/design/design-center/software/development-software/mcuxpresso-software-and-tools-/mcu-link-debug-probe:MCU-LINK
frdm_mcxa153 Freedom MCXA153 mcx https://www.nxp.com/design/design-center/development-boards-and-designs/FRDM-MCXA153
frdm_mcxa156 Freedom MCXA156 mcx https://www.nxp.com/design/design-center/development-boards-and-designs/FRDM-MCXA156
frdm_mcxn947 Freedom MCXN947 mcx https://www.nxp.com/design/design-center/development-boards-and-designs/FRDM-MCXN947
mcxn947brk MCXN947 Breakout mcx n/a
frdm_rw612 FRDM-RW612 rw61x https://www.nxp.com/design/design-center/development-boards-and-designs/FRDM-RW612
================== ========================================= ============ ========================================================================================================================================================================= ======
Nordic Semiconductor
--------------------
=========================== ===================================== ======== ============================================================================== ======
Board Name Family URL Note
=========================== ===================================== ======== ============================================================================== ======
adafruit_clue Adafruit CLUE nrf https://www.adafruit.com/product/4500
arduino_nano33_ble Arduino Nano 33 BLE nrf https://store.arduino.cc/arduino-nano-33-ble
circuitplayground_bluefruit Adafruit Circuit Playground Bluefruit nrf https://www.adafruit.com/product/4333
feather_nrf52840_express Adafruit Feather nRF52840 Express nrf https://www.adafruit.com/product/4062
feather_nrf52840_sense Adafruit Feather nRF52840 Sense nrf https://www.adafruit.com/product/4516
itsybitsy_nrf52840 Adafruit ItsyBitsy nRF52840 Express nrf https://www.adafruit.com/product/4481
nrf52833dk Nordic nRF52833 DK nrf https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF52833-DK
nrf52840dk Nordic nRF52840DK nrf https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF52840-DK
nrf52840dongle Nordic nRF52840 Dongle nrf https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF52840-Dongle
nrf5340dk Nordic nRF5340 DK nrf https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF5340-DK
nrf54h20dk Nordic nRF54H20 DK nrf https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF5340-DK
nrf54lm20dk Nordic nRF54LM20 DK nrf https://www.nordicsemi.com/Products/Development-hardware/nRF54LM20-DK
=========================== ===================================== ======== ============================================================================== ======
Raspberry Pi
------------
================================ ============================================ ============== ========================================================== ======
Board Name Family URL Note
================================ ============================================ ============== ========================================================== ======
raspberrypi_zero Raspberry Pi Zero broadcom_32bit https://www.raspberrypi.org/products/raspberry-pi-zero/
raspberrypi_cm4 Raspberry CM4 broadcom_64bit https://www.raspberrypi.org/products/compute-module-4
raspberrypi_zero2 Raspberry Zero2 broadcom_64bit https://www.raspberrypi.org/products/raspberry-pi-zero-2-w
adafruit_feather_rp2040_usb_host Adafruit Feather RP2040 with USB Type A Host rp2040 https://www.adafruit.com/product/5723
adafruit_fruit_jam Adafruit Fruit Jam - Mini RP2350 rp2040 https://www.adafruit.com/product/6200
adafruit_metro_rp2350 Adafruit Metro RP2350 rp2040 https://www.adafruit.com/product/6003
raspberry_pi_pico Pico rp2040 https://www.raspberrypi.com/products/raspberry-pi-pico/
raspberry_pi_pico2 Pico2 rp2040 https://www.raspberrypi.com/products/raspberry-pi-pico-2/
raspberry_pi_pico_w Pico rp2040 https://www.raspberrypi.com/products/raspberry-pi-pico/
================================ ============================================ ============== ========================================================== ======
Renesas
-------
============== =========================== ======== ================================================================================================================================================================ ======
Board Name Family URL Note
============== =========================== ======== ================================================================================================================================================================ ======
da14695_dk_usb DA14695-00HQDEVKT-U da1469x https://www.renesas.com/en/products/wireless-connectivity/bluetooth-low-energy/da14695-00hqdevkt-u-smartbond-da14695-bluetooth-low-energy-52-usb-development-kit
da1469x_dk_pro DA1469x Development Kit Pro da1469x https://lpccs-docs.renesas.com/um-b-090-da1469x_getting_started/DA1469x_The_hardware/DA1469x_The_hardware.html
portenta_c33 Arduino Portenta C33 ra https://www.arduino.cc/pro/hardware-product-portenta-c33/
ra2a1_ek RA2A1 EK ra https://www.renesas.com/en/products/microcontrollers-microprocessors/ra-cortex-m-mcus/ek-ra2a1-evaluation-kit-ra2a1-mcu-group
ra4m1_ek RA4M1 EK ra https://www.renesas.com/en/products/microcontrollers-microprocessors/ra-cortex-m-mcus/ek-ra4m1-evaluation-kit-ra4m1-mcu-group
ra4m3_ek RA4M3 EK ra https://www.renesas.com/en/products/microcontrollers-microprocessors/ra-cortex-m-mcus/ek-ra4m3-evaluation-kit-ra4m3-mcu-group
ra6m1_ek RA6M1 EK ra https://www.renesas.com/en/products/microcontrollers-microprocessors/ra-cortex-m-mcus/ek-ra6m1-evaluation-kit-ra6m1-mcu-group
ra6m5_ek RA6M5 EK ra https://www.renesas.com/en/products/microcontrollers-microprocessors/ra-cortex-m-mcus/ek-ra6m5-evaluation-kit-ra6m5-mcu-group
ra8m1_ek RA8M1 EK ra https://www.renesas.com/en/products/microcontrollers-microprocessors/ra-cortex-m-mcus/ek-ra8m1-evaluation-kit-ra8m1-mcu-group
uno_r4 Arduino UNO R4 ra https://store-usa.arduino.cc/pages/uno-r4
============== =========================== ======== ================================================================================================================================================================ ======
STMicroelectronics
------------------
=================== ================================= ========= ================================================================= ======
Board Name Family URL Note
=================== ================================= ========= ================================================================= ======
stm32c071nucleo STM32C071 Nucleo stm32c0 https://www.st.com/en/evaluation-tools/nucleo-c071rb.html
stm32c542nucleo STM32C542 Nucleo stm32c5 https://www.st.com/en/evaluation-tools/nucleo-c542rc.html
stm32f070rbnucleo STM32 F070 Nucleo stm32f0 https://www.st.com/en/evaluation-tools/nucleo-f070rb.html
stm32f072disco STM32 F072 Discovery stm32f0 https://www.st.com/en/evaluation-tools/32f072bdiscovery.html
stm32f072eval STM32 F072 Eval stm32f0 https://www.st.com/en/evaluation-tools/stm32072b-eval.html
stm32f103_bluepill STM32 F103 Bluepill stm32f1 https://stm32-base.org/boards/STM32F103C8T6-Blue-Pill
stm32f103_mini_2 STM32 F103 Mini v2 stm32f1 https://stm32-base.org/boards/STM32F103RCT6-STM32-Mini-V2.0
stm32f103ze_iar IAR STM32 F103ze starter kit stm32f1 n/a
stm32f207nucleo STM32 F207 Nucleo stm32f2 https://www.st.com/en/evaluation-tools/nucleo-f207zg.html
stm32f303disco STM32 F303 Discovery stm32f3 https://www.st.com/en/evaluation-tools/stm32f3discovery.html
feather_stm32f405 Adafruit Feather STM32F405 stm32f4 https://www.adafruit.com/product/4382
pyboardv11 Pyboard v1.1 stm32f4 https://www.adafruit.com/product/2390
stm32f401blackpill STM32 F401 Blackpill stm32f4 https://stm32-base.org/boards/STM32F401CCU6-WeAct-Black-Pill-V1.2
stm32f407blackvet STM32 F407 Blackvet stm32f4 https://stm32-base.org/boards/STM32F407VET6-STM32-F4VE-V2.0
stm32f407disco STM32 F407 Discovery stm32f4 https://www.st.com/en/evaluation-tools/stm32f4discovery.html
stm32f411blackpill STM32 F411 Blackpill stm32f4 https://stm32-base.org/boards/STM32F411CEU6-WeAct-Black-Pill-V2.0
stm32f411disco STM32 F411 Discovery stm32f4 https://www.st.com/en/evaluation-tools/32f411ediscovery.html
stm32f412disco STM32 F412 Discovery stm32f4 https://www.st.com/en/evaluation-tools/32f412gdiscovery.html
stm32f412nucleo STM32 F412 Nucleo stm32f4 https://www.st.com/en/evaluation-tools/nucleo-f412zg.html
stm32f439nucleo STM32 F439 Nucleo stm32f4 https://www.st.com/en/evaluation-tools/nucleo-f439zi.html
stlinkv3mini Stlink-v3 mini stm32f7 https://www.st.com/en/development-tools/stlink-v3mini.html
stm32f723disco STM32 F723 Discovery stm32f7 https://www.st.com/en/evaluation-tools/32f723ediscovery.html
stm32f746disco STM32 F746 Discovery stm32f7 https://www.st.com/en/evaluation-tools/32f746gdiscovery.html
stm32f746nucleo STM32 F746 Nucleo stm32f7 https://www.st.com/en/evaluation-tools/nucleo-f746zg.html
stm32f767nucleo STM32 F767 Nucleo stm32f7 https://www.st.com/en/evaluation-tools/nucleo-f767zi.html
stm32f769disco STM32 F769 Discovery stm32f7 https://www.st.com/en/evaluation-tools/32f769idiscovery.html
stm32g0b1nucleo STM32 G0B1 Nucleo stm32g0 https://www.st.com/en/evaluation-tools/nucleo-g0b1re.html
b_g474e_dpow1 STM32 B-G474E-DPOW1 Discovery kit stm32g4 https://www.st.com/en/evaluation-tools/b-g474e-dpow1.html
stm32g474nucleo STM32 G474 Nucleo stm32g4 https://www.st.com/en/evaluation-tools/nucleo-g474re.html
stm32g491nucleo STM32 G491 Nucleo stm32g4 https://www.st.com/en/evaluation-tools/nucleo-g491re.html
stm32h503nucleo STM32 H503 Nucleo stm32h5 https://www.st.com/en/evaluation-tools/nucleo-h503rb.html
stm32h533nucleo STM32 H533 Nucleo stm32h5 https://www.st.com/en/evaluation-tools/nucleo-h533re.html
stm32h563nucleo STM32 H563 Nucleo stm32h5 https://www.st.com/en/evaluation-tools/nucleo-h563zi.html
stm32h573i_dk STM32 H573i Discovery stm32h5 https://www.st.com/en/evaluation-tools/stm32h573i-dk.html
daisyseed Daisy Seed stm32h7 https://electro-smith.com/products/daisy-seed
stm32h723nucleo STM32 H723 Nucleo stm32h7 https://www.st.com/en/evaluation-tools/nucleo-h723zg.html
stm32h743_weact STM32 H743 WeAct board stm32h7 https://github.com/WeActStudio/MiniSTM32H7xx
stm32h743eval STM32 H743 Eval stm32h7 https://www.st.com/en/evaluation-tools/stm32h743i-eval.html
stm32h743nucleo STM32 H743 Nucleo stm32h7 https://www.st.com/en/evaluation-tools/nucleo-h743zi.html
stm32h745disco STM32 H745 Discovery stm32h7 https://www.st.com/en/evaluation-tools/stm32h745i-disco.html
stm32h747disco STM32 H747 Discovery stm32h7 https://www.st.com/en/evaluation-tools/stm32h747i-disco.html
stm32h750_weact STM32 H750 WeAct stm32h7 https://www.adafruit.com/product/5032
stm32h750bdk STM32 H750b Discovery Kit stm32h7 https://www.st.com/en/evaluation-tools/stm32h750b-dk.html
waveshare_openh743i Waveshare Open H743i stm32h7 https://www.waveshare.com/openh743i-c-standard.htm
stm32h7s3nucleo STM32 H7S3L8 Nucleo stm32h7rs https://www.st.com/en/evaluation-tools/nucleo-h7s3l8.html
stm32l052dap52 STM32 L052 DAP stm32l0 n/a
stm32l0538disco STM32 L0538 Discovery stm32l0 https://www.st.com/en/evaluation-tools/32l0538discovery.html
stm32l412nucleo STM32 L412 Nucleo stm32l4 https://www.st.com/en/evaluation-tools/nucleo-l412kb.html
stm32l476disco STM32 L476 Disco stm32l4 https://www.st.com/en/evaluation-tools/32l476gdiscovery.html
stm32l496nucleo STM32 L496 Nucleo stm32l4 https://www.st.com/en/evaluation-tools/nucleo-l496ZG-P.html
stm32l4p5nucleo STM32 L4P5 Nucleo stm32l4 https://www.st.com/en/evaluation-tools/nucleo-l4p5zg.html
stm32l4r5nucleo STM32 L4R5 Nucleo stm32l4 https://www.st.com/en/evaluation-tools/nucleo-l4r5zi.html
stm32n6570dk STM32 N6570-DK stm32n6 https://www.st.com/en/evaluation-tools/stm32n6570-dk.html
stm32n657nucleo STM32 N657X0-Q Nucleo stm32n6 https://www.st.com/en/evaluation-tools/nucleo-n657x0-q.html
stm32u083cdk STM32U083C-DK Discovery Kit stm32u0 https://www.st.com/en/evaluation-tools/stm32u083c-dk.html
stm32u083nucleo NUCLEO-U083RC stm32u0 https://www.st.com/en/evaluation-tools/nucleo-u083rc.html
b_u585i_iot2a STM32 B-U585i IOT2A Discovery kit stm32u5 https://www.st.com/en/evaluation-tools/b-u585i-iot02a.html
stm32u545nucleo STM32 U545 Nucleo stm32u5 https://www.st.com/en/evaluation-tools/nucleo-u545re-q.html
stm32u575eval STM32 U575 Eval stm32u5 https://www.st.com/en/evaluation-tools/stm32u575i-ev.html
stm32u575nucleo STM32 U575 Nucleo stm32u5 https://www.st.com/en/evaluation-tools/nucleo-u575zi-q.html
stm32u5a5nucleo STM32 U5a5 Nucleo stm32u5 https://www.st.com/en/evaluation-tools/nucleo-u5a5zj-q.html
stm32wb55nucleo STM32 P-NUCLEO-WB55 stm32wb https://www.st.com/en/evaluation-tools/p-nucleo-wb55.html
stm32wba_nucleo STM32 NUCLEO-WBA65RI stm32wba https://www.st.com/en/evaluation-tools/nucleo-wba65ri.html
=================== ================================= ========= ================================================================= ======
Sunxi
-----
======= ================= ======== ========================================= ======
Board Name Family URL Note
======= ================= ======== ========================================= ======
f1c100s Lctech Pi F1C200s f1c100s https://linux-sunxi.org/Lctech_Pi_F1C200s
======= ================= ======== ========================================= ======
Texas Instruments
-----------------
================= ===================== ======== ========================================= ======
Board Name Family URL Note
================= ===================== ======== ========================================= ======
msp_exp430f5529lp MSP430F5529 LaunchPad msp430 https://www.ti.com/tool/MSP-EXP430F5529LP
msp_exp432e401y MSP432E401Y LaunchPad msp432e4 https://www.ti.com/tool/MSP-EXP432E401Y
ek_tm4c123gxl TM4C123G LaunchPad tm4c https://www.ti.com/tool/EK-TM4C123GXL
ek_tm4c1294xl TM4C1294 LaunchPad tm4c https://www.ti.com/tool/EK-TM4C1294XL
================= ===================== ======== ========================================= ======
Tomu
----
======= ====== ======== ========================= ======
Board Name Family URL Note
======= ====== ======== ========================= ======
fomu fomu fomu https://tomu.im/fomu.html
======= ====== ======== ========================= ======
WCH
---
================== ============================= ======== ===================================================================== ======
Board Name Family URL Note
================== ============================= ======== ===================================================================== ======
ch32f205r-r0 CH32F205r-r0 ch32f20x https://github.com/openwch/ch32f20x
ch32v103c_bluepill CH32V103C8T6-Bluepill ch32v10x https://stm32-base.org/boards/STM32F103C8T6-Blue-Pill
ch32v103r_r1_1v0 CH32V103R-R1-1v1 ch32v10x https://github.com/openwch/ch32v103/tree/main/SCHPCB/CH32V103R-R1-1v1
ch32v203c_r0_1v0 CH32V203C-R0-1v0 ch32v20x https://github.com/openwch/ch32v20x/tree/main/SCHPCB/CH32V203C-R0
ch32v203g_r0_1v0 CH32V203G-R0-1v0 ch32v20x https://github.com/openwch/ch32v20x/tree/main/SCHPCB/CH32V203C-R0
nanoch32v203 nanoCH32V203 ch32v20x https://github.com/wuxx/nanoCH32V203
ch32v307v_r1_1v0 CH32V307V-R1-1v0 ch32v30x https://github.com/openwch/ch32v307/tree/main/SCHPCB/CH32V307V-R1-1v0
nanoch32v305 nanoCH32V305 ch32v30x https://github.com/wuxx/nanoCH32V305
ch582m_evt CH582M-EVT evaluation board ch583 https://www.wch-ic.com/products/CH582.html
yd-ch582m yd-ch582m from vcc-gnd studio ch583 http://vcc-gnd.com/
================== ============================= ======== ===================================================================== ======
+316
View File
@@ -0,0 +1,316 @@
***************
Class Drivers
***************
USB Class Drivers implement specific USB device classes (CDC, HID, MSC, MIDI, Audio, etc.) and are the main interface between the USB core and application code.
MIDI 2.0 Device Driver
=======================
Overview
--------
The MIDI 2.0 Device driver enables TinyUSB to act as a USB MIDI 2.0 device. It implements both Alt Setting 0 (MIDI 1.0 fallback) and Alt Setting 1 (native UMP) as required by the USB-MIDI 2.0 specification.
**Key Features:**
- **Dual Alt Settings**: Alt 0 (MIDI 1.0) and Alt 1 (UMP native) per USB-MIDI 2.0 spec
- **Protocol Negotiation**: Endpoint Discovery, Config Request/Notify, Function Block Discovery
- **Group Terminal Block**: Served via GET_DESCRIPTOR automatically
- **Atomic UMP Framing**: Read/write with correct message boundaries
- **Memory Safe**: No dynamic allocation, static instances
Configuration
-------------
Enable MIDI 2.0 Device support in ``tusb_config.h``:
.. code-block:: c
#define CFG_TUD_ENABLED 1
#define CFG_TUD_MIDI2 1
Optional configuration:
.. code-block:: c
#define CFG_TUD_MIDI2_TX_BUFSIZE 256
#define CFG_TUD_MIDI2_RX_BUFSIZE 256
#define CFG_TUD_MIDI2_TX_EPSIZE 64
#define CFG_TUD_MIDI2_RX_EPSIZE 64
#define CFG_TUD_MIDI2_NUM_GROUPS 1 // 1..16
#define CFG_TUD_MIDI2_NUM_FUNCTION_BLOCKS 1 // 1..32
#define CFG_TUD_MIDI2_EP_NAME "TinyUSB MIDI 2.0"
#define CFG_TUD_MIDI2_PRODUCT_ID "TinyUSB-MIDI2"
Public API
----------
Query Functions
^^^^^^^^^^^^^^^
.. code-block:: c
bool tud_midi2_mounted(void);
uint32_t tud_midi2_available(void);
uint8_t tud_midi2_alt_setting(void);
bool tud_midi2_negotiated(void);
uint8_t tud_midi2_protocol(void);
I/O Functions
^^^^^^^^^^^^^
.. code-block:: c
uint32_t tud_midi2_ump_read(uint32_t* words, uint32_t max_words);
uint32_t tud_midi2_ump_write(const uint32_t* words, uint32_t count);
uint32_t tud_midi2_packet_read(uint8_t packets[], uint32_t max_packets);
uint32_t tud_midi2_packet_write(const uint8_t packets[], uint32_t count);
Callbacks
^^^^^^^^^
.. code-block:: c
void tud_midi2_rx_cb(uint8_t itf);
void tud_midi2_set_itf_cb(uint8_t itf, uint8_t alt);
bool tud_midi2_get_req_itf_cb(uint8_t rhport, const tusb_control_request_t* request);
MIDI 2.0 Host Driver
=====================
Overview
--------
The MIDI 2.0 Host driver enables TinyUSB to enumerate and communicate with USB MIDI 2.0 devices. It implements the USB MIDI 2.0 specification, supporting both MIDI 1.0 legacy devices and modern MIDI 2.0 devices with UMP (Universal MIDI Packet) protocol.
**Key Features:**
- **Reactive Architecture**: Auto-detects Alt Setting 1 (MIDI 2.0) capability during enumeration
- **Auto-Selection**: Automatically selects the highest available protocol and issues SET_INTERFACE to activate Alt Setting 1 when MIDI 2.0 is detected
- **Transparent Stream Messages**: All data (UMP packets + Stream Messages) flow through callbacks
- **Memory Safe**: No dynamic allocation, fixed-size instances per device
Configuration
-------------
Enable MIDI 2.0 Host support in ``tusb_config.h``:
.. code-block:: c
#define CFG_TUH_ENABLED 1
#define CFG_TUH_MIDI2 4 // Number of MIDI 2.0 devices to support
Optional buffer configuration:
.. code-block:: c
#define CFG_TUH_MIDI2_RX_BUFSIZE (4 * TUH_EPSIZE_BULK_MAX)
#define CFG_TUH_MIDI2_TX_BUFSIZE (4 * TUH_EPSIZE_BULK_MAX)
Enumeration Lifecycle
---------------------
When a MIDI 2.0 device is connected, the host stack invokes callbacks in this order:
.. code-block:: none
Device Connected
|
[Host detects Alt 0 and Alt 1 descriptors]
|
tuh_midi2_descriptor_cb() <- Device detected, NOT yet ready
|
[Auto-select highest protocol]
|
tuh_midi2_mount_cb() <- Device ready to use
|
[Application can read/write data]
|
tuh_midi2_rx_cb() <- Data arrived
tuh_midi2_tx_cb() <- TX buffer space available
|
[Device disconnects]
|
tuh_midi2_umount_cb() <- Device removed
Public API
----------
Query Functions
^^^^^^^^^^^^^^^
.. code-block:: c
bool tuh_midi2_mounted(uint8_t idx);
uint8_t tuh_midi2_get_protocol_version(uint8_t idx); // 0=MIDI 1.0, 1=MIDI 2.0
uint8_t tuh_midi2_get_alt_setting_active(uint8_t idx); // 0 or 1
uint8_t tuh_midi2_get_cable_count(uint8_t idx);
I/O Functions
^^^^^^^^^^^^^
Read and write UMP (Universal MIDI Packet) data:
.. code-block:: c
uint32_t tuh_midi2_ump_read(uint8_t idx, uint32_t* words, uint32_t max_words);
uint32_t tuh_midi2_ump_write(uint8_t idx, const uint32_t* words, uint32_t count);
uint32_t tuh_midi2_write_flush(uint8_t idx);
Callbacks
---------
Application can define weak callback implementations to respond to device events.
Descriptor Callback
^^^^^^^^^^^^^^^^^^^
Invoked when device is detected but not yet ready for I/O:
.. code-block:: c
void tuh_midi2_descriptor_cb(uint8_t idx, const tuh_midi2_descriptor_cb_t *desc_cb_data) {
printf("MIDI %s device detected\r\n",
desc_cb_data->protocol_version == 0 ? "1.0" : "2.0");
}
Mount Callback
^^^^^^^^^^^^^^
Invoked when device is ready for I/O:
.. code-block:: c
void tuh_midi2_mount_cb(uint8_t idx, const tuh_midi2_mount_cb_t *mount_cb_data) {
printf("Device mounted at idx=%u, protocol=%u, alt_setting=%u\r\n",
idx, mount_cb_data->protocol_version, mount_cb_data->alt_setting_active);
}
RX Callback
^^^^^^^^^^^
Invoked when data arrives from device (both UMP packets and Stream Messages):
.. code-block:: c
void tuh_midi2_rx_cb(uint8_t idx, uint32_t xferred_bytes) {
uint32_t words[4];
uint32_t n = tuh_midi2_ump_read(idx, words, 4);
for (uint32_t i = 0; i < n; i++) {
uint8_t mt = (words[i] >> 28) & 0x0F;
if (mt == 0x0F) {
// Stream Message - app handles discovery, negotiation, etc.
} else {
// Regular MIDI UMP packet
}
}
}
TX Callback
^^^^^^^^^^^
Invoked when TX buffer space becomes available:
.. code-block:: c
void tuh_midi2_tx_cb(uint8_t idx, uint32_t xferred_bytes) {
// Buffer space available for writing
}
Unmount Callback
^^^^^^^^^^^^^^^^
Invoked when device is disconnected:
.. code-block:: c
void tuh_midi2_umount_cb(uint8_t idx) {
printf("Device at idx=%u disconnected\r\n", idx);
}
Complete Example
----------------
.. code-block:: c
#include "tusb.h"
void tuh_midi2_mount_cb(uint8_t idx, const tuh_midi2_mount_cb_t *mount_cb_data) {
printf("MIDI 2.0 device mounted\r\n");
}
void tuh_midi2_rx_cb(uint8_t idx, uint32_t xferred_bytes) {
uint32_t words[4];
uint32_t n = tuh_midi2_ump_read(idx, words, 4);
for (uint32_t i = 0; i < n; i++) {
printf("RX: 0x%08lx\r\n", words[i]);
}
}
void tuh_midi2_umount_cb(uint8_t idx) {
printf("MIDI 2.0 device disconnected\r\n");
}
int main(void) {
board_init();
tusb_rhport_init_t host_init = {.role = TUSB_ROLE_HOST, .speed = TUSB_SPEED_AUTO};
tusb_init(BOARD_TUH_RHPORT, &host_init);
while (1) {
tuh_task();
}
}
Architecture
------------
The MIDI 2.0 Host driver uses a **reactive, callback-driven architecture** that mirrors the proven patterns in TinyUSB's existing device drivers (CDC, HID, etc.):
- **Auto-Detection**: Host automatically detects Alt Setting 1 capability
- **Auto-Selection**: Selects highest protocol available and issues SET_INTERFACE
- **Transparent I/O**: Stream Messages and UMP packets flow through callbacks
- **Callback-Driven**: App receives events via callbacks (descriptor, mount, rx, tx, unmount)
Differences from MIDI 1.0 Host
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. list-table::
:header-rows: 1
* - Aspect
- MIDI 1.0 Host
- MIDI 2.0 Host
* - Alt Settings
- Parses only Alt 0
- Parses Alt 0 + Alt 1
* - Data Format
- 4-byte MIDI packets
- UMP (32/64/128-bit)
* - Version Detection
- None
- bcdMSC from descriptor
* - GTB
- N/A
- Presence detection
* - Stream Messages
- N/A
- Transparent passthrough
* - Callbacks
- descriptor_cb, mount_cb, rx_cb, umount_cb
- descriptor_cb, mount_cb, rx_cb, tx_cb, umount_cb
* - Public API
- tuh_midi_*
- tuh_midi2_*
Implementation Notes
--------------------
- All internal state is statically allocated (no dynamic allocation)
- Endpoint streams use TinyUSB's tu_edpt_stream_t for buffered I/O
- Protocol version detection via bcdMSC field
- Alt Setting is automatically selected during mount
- Compatible with all TinyUSB-supported MCU families
+42
View File
@@ -0,0 +1,42 @@
***********
Concurrency
***********
The TinyUSB library is designed to operate on single-core MCUs with multi-threaded applications in mind. Interaction with interrupts is especially important to pay attention to.
It is compatible with optionally using an RTOS.
General
-------
When writing code, keep in mind that the OS (if using an RTOS) may swap out your code at any time. Also, your code can be preempted by an interrupt at any time.
Application Code
----------------
The USB core does not execute application callbacks while in an interrupt context. Calls to application code are from within the USB core task context. Note that the application core will call class drivers from within its own task.
Class Drivers
-------------
Class driver code should never be called from an interrupt context by the USB core, though the application is allowed to call class driver functions from interrupts. USB core functions may be called simultaneously by multiple tasks. Use care that proper locking is used to guard the USBD core functions from this case.
Class drivers are allowed to call ``usbd_*`` functions, but not ``dcd_*`` functions.
USB Core
--------
All functions that may be called from an (USB core) interrupt context have a ``bool in_isr`` parameter to remind the implementer that special care must be taken.
Interrupt handlers must not directly call class driver code, they must pass a message to the USB core's task.
``usbd_*`` functions may be called from interrupts without any notice. They may also be called simultaneously by multiple tasks.
Device Drivers
--------------
Much of the processing of the USB stack is done in an interrupt context, and care must be taken in order to ensure variables are handled in the appropriate ways by the compiler and optimizer.
In particular:
* Ensure that all memory-mapped registers (including packet memory) are marked as volatile. GCC's optimizer will even combine memory accesses (like two 16-bit to be a 32-bit) if you don't mark the pointers as volatile. On some architectures, this can use macros like _I , _O , or _IO.
* All defined global variables are marked as ``static``.
+103
View File
@@ -0,0 +1,103 @@
************
Dependencies
************
MCU low-level peripheral drivers and external libraries for building TinyUSB examples
======================================== ================================================================ ======================================== ===================================================================================================================================================================================================================================================================================================================================================
Local Path Repo Commit Required by
======================================== ================================================================ ======================================== ===================================================================================================================================================================================================================================================================================================================================================
hw/mcu/allwinner https://github.com/hathach/allwinner_driver.git 8e5e89e8e132c0fd90e72d5422e5d3d68232b756 fc100s
hw/mcu/analog/msdk https://github.com/analogdevicesinc/msdk.git b20b398d3e5e2007594e54a74ba3d2a2e50ddd75 maxim
hw/mcu/artery/at32f402_405 https://github.com/ArteryTek/AT32F402_405_Firmware_Library.git 4424515c2663e82438654e0947695295df2abdfe at32f402_405
hw/mcu/artery/at32f403a_407 https://github.com/ArteryTek/AT32F403A_407_Firmware_Library.git f2cb360c3d28fada76b374308b8c4c61d37a090b at32f403a_407
hw/mcu/artery/at32f413 https://github.com/ArteryTek/AT32F413_Firmware_Library.git f6fe62dfec9fd40c5b63d92fc5ef2c2b5e77a450 at32f413
hw/mcu/artery/at32f415 https://github.com/ArteryTek/AT32F415_Firmware_Library.git 716f545aa1290ff144ccf023a8e797b951e1bc8e at32f415
hw/mcu/artery/at32f423 https://github.com/ArteryTek/AT32F423_Firmware_Library.git 2afa7f12852e57a9e8aab3a892c641e1a8635a18 at32f423
hw/mcu/artery/at32f425 https://github.com/ArteryTek/AT32F425_Firmware_Library.git 620233e1357d5c1b7e2bde6b9dd5196822b91817 at32f425
hw/mcu/artery/at32f435_437 https://github.com/ArteryTek/AT32F435_437_Firmware_Library.git 25439cc6650a8ae0345934e8707a5f38c7ae41f8 at32f435_437
hw/mcu/artery/at32f45x https://github.com/ArteryTek/AT32F45x_Firmware_Library.git 3d4a1b38be8ebac292e2350ca53bc4bfa4430233 at32f45x
hw/mcu/bridgetek/ft9xx/ft90x-sdk https://github.com/BRTSG-FOSS/ft90x-sdk.git 03f74eac84645178fdde7f2e5ca9acdcb7bd9dcd ft9xx
hw/mcu/broadcom https://github.com/adafruit/broadcom-peripherals.git 08370086080759ed54ac1136d62d2ad24c6fa267 broadcom_32bit broadcom_64bit
hw/mcu/gd/nuclei-sdk https://github.com/Nuclei-Software/nuclei-sdk.git 7eb7bfa9ea4fbeacfafe1d5f77d5a0e6ed3922e7 gd32vf103
hw/mcu/hpmicro/hpm_sdk https://github.com/hpmicro/hpm_sdk 8d2af741ecc4aaa82d7ee395dc1ce25d7070c3ff hpmicro
hw/mcu/infineon/mtb-xmclib-cat3 https://github.com/Infineon/mtb-xmclib-cat3.git daf5500d03cba23e68c2f241c30af79cd9d63880 xmc4000
hw/mcu/microchip https://github.com/hathach/microchip_driver.git 9e8b37e307d8404033bb881623a113931e1edf27 sam3x samd11 samd21 samd51 samd5x_e5x same5x same7x samd2x_l2x samg
hw/mcu/mindmotion/mm32sdk https://github.com/hathach/mm32sdk.git b93e856211060ae825216c6a1d6aa347ec758843 mm32
hw/mcu/nordic/nrfx https://github.com/NordicSemiconductor/nrfx.git 11f57e578c7feea13f21c79ea0efab2630ac68c7 nrf
hw/mcu/nuvoton https://github.com/majbthrd/nuc_driver.git 2204191ec76283371419fbcec207da02e1bc22fa nuc100_120 nuc121_125 nuc126 nuc505
hw/mcu/nxp/lpcopen https://github.com/hathach/nxp_lpcopen.git b41cf930e65c734d8ec6de04f1d57d46787c76ae lpc11 lpc13 lpc15 lpc17 lpc18 lpc40 lpc43
hw/mcu/nxp/mcux-devices-kinetis https://github.com/nxp-mcuxpresso/mcux-devices-kinetis 98a155e666c54f396e528ec3131f27a5d5b71f76 kinetis_k32l
hw/mcu/nxp/mcux-devices-lpc https://github.com/nxp-mcuxpresso/mcux-devices-lpc 8096b783ec09d0d1c8629025a5f9d8e7df26e520 lpc51 lpc55
hw/mcu/nxp/mcux-devices-mcx https://github.com/nxp-mcuxpresso/mcux-devices-mcx ada1c97c761123ec0c179bb9bb9f744bf9a11475 mcx
hw/mcu/nxp/mcux-devices-rt https://github.com/nxp-mcuxpresso/mcux-devices-rt dba2b523c9df61f3330bd186242f8210a8e47c45 imxrt
hw/mcu/nxp/mcux-sdk https://github.com/nxp-mcuxpresso/mcux-sdk a1bdae309a14ec95a4f64a96d3315a4f89c397c6 kinetis_k kinetis_kl lpc54 rw61x
hw/mcu/nxp/mcuxsdk-core https://github.com/nxp-mcuxpresso/mcuxsdk-core 0c5c6b16deb211110e06bde896cdff59ab213e16 imxrt kinetis_k32l lpc51 lpc55 mcx
hw/mcu/raspberry_pi/FreeRTOS-Kernel https://github.com/raspberrypi/FreeRTOS-Kernel.git 4f7299d6ea746b27a9dd19e87af568e34bd65b15 rp2040
hw/mcu/raspberry_pi/Pico-PIO-USB https://github.com/sekigon-gonnoc/Pico-PIO-USB.git 675543bcc9baa8170f868ab7ba316d418dbcf41f rp2040
hw/mcu/renesas/fsp https://github.com/renesas/fsp.git edcc97d684b6f716728a60d7a6fea049d9870bd6 ra
hw/mcu/renesas/rx https://github.com/kkitayam/rx_device.git 706b4e0cf485605c32351e2f90f5698267996023 rx
hw/mcu/silabs/cmsis-dfp-efm32gg12b https://github.com/cmsis-packs/cmsis-dfp-efm32gg12b.git f1c31b7887669cb230b3ea63f9b56769078960bc efm32
hw/mcu/sony/cxd56/spresense-exported-sdk https://github.com/sonydevworld/spresense-exported-sdk.git 2ec2a1538362696118dc3fdf56f33dacaf8f4067 spresense
hw/mcu/st/cmsis-device-u0 https://github.com/STMicroelectronics/cmsis-device-u0.git e3a627c6a5bc4eb2388e1885a95cc155e1672253 stm32u0
hw/mcu/st/cmsis-device-wba https://github.com/STMicroelectronics/cmsis-device-wba.git 647d8522e5fd15049e9a1cc30ed19d85e5911eaf stm32wba
hw/mcu/st/cmsis_device_c0 https://github.com/STMicroelectronics/cmsis_device_c0.git 517611273f835ffe95318947647bc1408f69120d stm32c0
hw/mcu/st/cmsis_device_f0 https://github.com/STMicroelectronics/cmsis_device_f0.git cbb5da5d48b4b5f2efacdc2f033be30f9d29889f stm32f0
hw/mcu/st/cmsis_device_f1 https://github.com/STMicroelectronics/cmsis_device_f1.git c8e9a4a4f16b6d2cb2a2083cbe5161025280fb22 stm32f1
hw/mcu/st/cmsis_device_f2 https://github.com/STMicroelectronics/cmsis_device_f2.git 49321f1e4d2bd3e65687b37f2652a28ea7983674 stm32f2
hw/mcu/st/cmsis_device_f3 https://github.com/STMicroelectronics/cmsis_device_f3.git 5558e64e3675a1e1fcb1c71f468c7c407c1b1134 stm32f3
hw/mcu/st/cmsis_device_f4 https://github.com/STMicroelectronics/cmsis_device_f4.git 3c77349ce04c8af401454cc51f85ea9a50e34fc1 stm32f4
hw/mcu/st/cmsis_device_f7 https://github.com/STMicroelectronics/cmsis_device_f7.git 2352e888e821aa0f4fe549bd5ea81d29c67a3222 stm32f7
hw/mcu/st/cmsis_device_g0 https://github.com/STMicroelectronics/cmsis_device_g0.git f484fe852535f913a02ee79787eafa74dd7f9488 stm32g0
hw/mcu/st/cmsis_device_g4 https://github.com/STMicroelectronics/cmsis_device_g4.git 7c39c32593b03764aaa57531588b8bf7cdd443a5 stm32g4
hw/mcu/st/cmsis_device_h5 https://github.com/STMicroelectronics/cmsis_device_h5.git 884b8dc78e41cbfca008363342b17f4a9e8641f7 stm32h5
hw/mcu/st/cmsis_device_h7 https://github.com/STMicroelectronics/cmsis_device_h7.git 45b818cab6ee2806e3a27c80e330957223424392 stm32h7
hw/mcu/st/cmsis_device_h7rs https://github.com/STMicroelectronics/cmsis_device_h7rs.git 57ea11f70ebf1850e1048989d665c9070f0bb863 stm32h7rs
hw/mcu/st/cmsis_device_l0 https://github.com/STMicroelectronics/cmsis_device_l0.git 7b7ae8cd71437331e1d7824f157d00c7bb4a5044 stm32l0
hw/mcu/st/cmsis_device_l1 https://github.com/STMicroelectronics/cmsis_device_l1.git a23ade4ccf14012085fedf862e33a536ab7ed8be stm32l1
hw/mcu/st/cmsis_device_l4 https://github.com/STMicroelectronics/cmsis_device_l4.git a2530753e86dd326a75467d28feb92e2ba7d0df2 stm32l4
hw/mcu/st/cmsis_device_l5 https://github.com/STMicroelectronics/cmsis_device_l5.git 7d9a51481f0e6c376e62c3c849e6caf652c66482 stm32l5
hw/mcu/st/cmsis_device_n6 https://github.com/STMicroelectronics/cmsis-device-n6.git 7bcdc944fbf7cf5928d3c1d14054ca13261d33ec stm32n6
hw/mcu/st/cmsis_device_u5 https://github.com/STMicroelectronics/cmsis_device_u5.git 6e67187dec98035893692ab2923914cb5f4e0117 stm32u5
hw/mcu/st/cmsis_device_wb https://github.com/STMicroelectronics/cmsis_device_wb.git cda2cb9fc4a5232ab18efece0bb06b0b60910083 stm32wb
hw/mcu/st/stm32-mfxstm32l152 https://github.com/STMicroelectronics/stm32-mfxstm32l152.git 7f4389efee9c6a655b55e5df3fceef5586b35f9b stm32h7
hw/mcu/st/stm32-tcpp0203 https://github.com/STMicroelectronics/stm32-tcpp0203.git 9918655bff176ac3046ccf378b5c7bbbc6a38d15 stm32h5 stm32h7rs stm32n6
hw/mcu/st/stm32c0xx_hal_driver https://github.com/STMicroelectronics/stm32c0xx_hal_driver.git c283b143bef6bdaacf64240ee6f15eb61dad6125 stm32c0
hw/mcu/st/stm32c5xx-dfp https://github.com/STMicroelectronics/stm32c5xx-dfp.git 6d0940882511d9430f83af9bd3da6bcb77f79239 stm32c5
hw/mcu/st/stm32c5xx-drivers https://github.com/STMicroelectronics/stm32c5xx-drivers.git 79b901285a7efeaf87c4c25db81d24cb5d8c9465 stm32c5
hw/mcu/st/stm32f0xx_hal_driver https://github.com/STMicroelectronics/stm32f0xx_hal_driver.git 94399697cb5eeaf8511b81b7f50dc62f0a5a3f6c stm32f0
hw/mcu/st/stm32f1xx_hal_driver https://github.com/STMicroelectronics/stm32f1xx_hal_driver.git 18074e3e5ecad0b380a5cf5a9131fe4b5ed1b2b7 stm32f1
hw/mcu/st/stm32f2xx_hal_driver https://github.com/STMicroelectronics/stm32f2xx_hal_driver.git ae7b47fe41cf75ccaf65cbf8ee8749b18ba0e0f3 stm32f2
hw/mcu/st/stm32f3xx_hal_driver https://github.com/STMicroelectronics/stm32f3xx_hal_driver.git e098c8c8ce6f426bcee7db3a37c0932ea881eb0b stm32f3
hw/mcu/st/stm32f4xx_hal_driver https://github.com/STMicroelectronics/stm32f4xx_hal_driver.git b6f0ed3829f3829eb358a2e7417d80bba1a42db7 stm32f4
hw/mcu/st/stm32f7xx_hal_driver https://github.com/STMicroelectronics/stm32f7xx_hal_driver.git e1446fa12ffda80ea1016faf349e45b2047fff12 stm32f7
hw/mcu/st/stm32g0xx_hal_driver https://github.com/STMicroelectronics/stm32g0xx_hal_driver.git a248a9e484d58943b46c68f6c49b4b276778bd59 stm32g0
hw/mcu/st/stm32g4xx_hal_driver https://github.com/STMicroelectronics/stm32g4xx_hal_driver.git 10138a41749ea62d53ecab65b2bc2a950acc04d2 stm32g4
hw/mcu/st/stm32h5xx_hal_driver https://github.com/STMicroelectronics/stm32h5xx_hal_driver.git 3c84eaa6000ab620be01afbcfba2735389afe09b stm32h5
hw/mcu/st/stm32h7rsxx_hal_driver https://github.com/STMicroelectronics/stm32h7rsxx-hal-driver.git 9e83b95ae0f70faa067eddce2da617d180937f9b stm32h7rs
hw/mcu/st/stm32h7xx_hal_driver https://github.com/STMicroelectronics/stm32h7xx_hal_driver.git dbfb749f229e1aa89e50b54229ca87766e180d2d stm32h7
hw/mcu/st/stm32l0xx_hal_driver https://github.com/STMicroelectronics/stm32l0xx_hal_driver.git 65da4cd8a10ad859ec8d9cd71f3f6c50735bd473 stm32l0
hw/mcu/st/stm32l1xx_hal_driver https://github.com/STMicroelectronics/stm32l1xx_hal_driver.git 54f0b7568ce2acb33d090c70c897ee32229c1d32 stm32l1
hw/mcu/st/stm32l4xx_hal_driver https://github.com/STMicroelectronics/stm32l4xx_hal_driver.git 3e039bbf62f54bbd834d578185521cff80596efe stm32l4
hw/mcu/st/stm32l5xx_hal_driver https://github.com/STMicroelectronics/stm32l5xx_hal_driver.git 3340b9a597bcf75cc173345a90a74aa2a4a37510 stm32l5
hw/mcu/st/stm32n6xx_hal_driver https://github.com/STMicroelectronics/stm32n6xx-hal-driver.git bc6c41f8f67d61b47af26695d0bf67762a000666 stm32n6
hw/mcu/st/stm32u0xx_hal_driver https://github.com/STMicroelectronics/stm32u0xx-hal-driver.git cbfb5ac654256445237fd32b3587ac6a238d24f1 stm32u0
hw/mcu/st/stm32u5xx_hal_driver https://github.com/STMicroelectronics/stm32u5xx_hal_driver.git 2c5e2568fbdb1900a13ca3b2901fdd302cac3444 stm32u5
hw/mcu/st/stm32wbaxx_hal_driver https://github.com/STMicroelectronics/stm32wbaxx_hal_driver.git 9442fbb71f855ff2e64fbf662b7726beba511a24 stm32wba
hw/mcu/st/stm32wbxx_hal_driver https://github.com/STMicroelectronics/stm32wbxx_hal_driver.git d60dd46996876506f1d2e9abd6b1cc110c8004cd stm32wb
hw/mcu/ti https://github.com/hathach/ti_driver.git 083944907e7d08fcb1f614b47598ce45935b8da1 msp430 msp432e4 tm4c
hw/mcu/wch/ch32f20x https://github.com/openwch/ch32f20x.git 77c4095087e5ed2c548ec9058e655d0b8757663b ch32f20x
hw/mcu/wch/ch32v103 https://github.com/openwch/ch32v103.git 7578cae0b21f86dd053a1f781b2fc6ab99d0ec17 ch32v10x
hw/mcu/wch/ch32v20x https://github.com/openwch/ch32v20x.git c4c38f507e258a4e69b059ccc2dc27dde33cea1b ch32v20x
hw/mcu/wch/ch32v307 https://github.com/openwch/ch32v307.git 184f21b852cb95eed58e86e901837bc9fff68775 ch32v30x
hw/mcu/wch/ch583 https://github.com/openwch/ch583.git bd508ad7ceed48377619837051412a651952857f ch583
lib/CMSIS_5 https://github.com/ARM-software/CMSIS_5.git 2b7495b8535bdcb306dac29b9ded4cfb679d7e5c kinetis_k kinetis_kl lpc54 rw61x mm32 msp432e4 nrf samd2x_l2x lpc11 lpc13 lpc15 lpc17 lpc18 lpc40 lpc43 stm32c0 stm32f0 stm32f1 stm32f2 stm32f3 stm32f4 stm32f7 stm32g0 stm32g4 stm32h5 stm32h7 stm32h7rs stm32l0 stm32l1 stm32l4 stm32l5 stm32u0 stm32u5 stm32wb stm32wba sam3x samd11 samd21 samd2x_l2x samd51 samd5x_e5x same5x same7x samg tm4c
lib/CMSIS_6 https://github.com/ARM-software/CMSIS_6.git 6f0a58d01aa9bd2feba212097f9afe7acd991d52 imxrt kinetis_k32l ra stm32n6 lpc51 lpc55 mcx stm32c5
lib/FreeRTOS-Kernel https://github.com/FreeRTOS/FreeRTOS-Kernel.git 9b777ae5c5b8e9e456065a00294d1e5f5f9facf5 all
lib/fatfs https://github.com/abbrev/fatfs.git 30ca13c62615df0d2e9104ab41256985b96590c1 all
lib/lwip https://github.com/lwip-tcpip/lwip.git 159e31b689577dbf69cf0683bbaffbd71fa5ee10 all
lib/sct_neopixel https://github.com/gsteiert/sct_neopixel.git e73e04ca63495672d955f9268e003cffe168fcd8 lpc55
lib/threadx https://github.com/eclipse-threadx/threadx.git 4b6e8100d932a3a67b34c6eb17f84f3bffb9e2ae all
tools/linkermap https://github.com/hathach/linkermap.git 8e1f440fa15c567aceb5aa0d14f6d18c329cc67f all
tools/uf2 https://github.com/microsoft/uf2.git c594542b2faa01cc33a2b97c9fbebc38549df80a all
======================================== ================================================================ ======================================== ===================================================================================================================================================================================================================================================================================================================================================
+35
View File
@@ -0,0 +1,35 @@
Device specific known issues and workarounds
===============================================
This page lists known issues and workarounds for specific devices.
NXP LPC54600
----------------
**Severity: High**
**Not recommended for USB device applications (except high-speed host controller)**
Reference: `LPC54600 Errata Sheet`_
.. _LPC54600 Errata Sheet: https://www.nxp.com/docs/en/errata/ES_LPC546XX.pdf
The LPC54600 series have a very buggy USB controller, with 17 issues listed in the errata which is more than half of the total issues.
Most severe issues are:
- USB.2: In USB high-speed device mode, the NBytes field is not correct after BULK IN transfer
- USB.5: In USB full-speed host mode, linked list on done queue is broken.
- USB.15: USB high-speed device in endpoint TX data corruption
WCH CH32F20x/CH32V20x/CH32V30x
---------------------------------
**Severity: Medium**
**Not recommended for USB audio applications**
Reference: `CH32V30X Reference Manual`_ USBFS/USBHS controller chapter
.. _CH32V30X Reference Manual: https://www.wch-ic.com/downloads/CH32FV2x_V3xRM_PDF.html
Data corruption may occur on isochronous endpoints. Due to the lacking of FIFO for interrupt status registers, later completed transfer will overwrite `INT_ST` and `RX_LEN` register if previous transfer processing is not completed.
Other types of transfers are not affected.
+98
View File
@@ -0,0 +1,98 @@
********
Glossary
********
.. glossary::
BSP
Board Support Package. A collection of board-specific code that provides hardware abstraction for a particular development board, including pin mappings, clock settings, linker scripts, and hardware initialization routines. Located in ``hw/bsp/FAMILY/boards/BOARD_NAME``.
Bulk Transfer
USB transfer type used for large amounts of data that doesn't require guaranteed timing. Used by mass storage devices and CDC class.
CDC
Communications Device Class. USB class for devices that communicate serial data, creating virtual serial ports.
Control Transfer
USB transfer type used for device configuration and control. All USB devices must support control transfers on endpoint 0.
DCD
Device Controller Driver. The hardware abstraction layer for USB device controllers in TinyUSB. See also HCD.
Descriptor
Data structures that describe USB device capabilities, configuration, and interfaces to the host.
Device Class
USB specification defining how devices of a particular type (e.g., storage, audio, HID) communicate with hosts.
DFU
Device Firmware Update. USB class that allows firmware updates over USB.
Endpoint
Communication channel between host and device. Each endpoint has a direction (IN/OUT) and transfer type.
Enumeration
Process where USB host discovers and configures a newly connected device.
HCD
Host Controller Driver. The hardware abstraction layer for USB host controllers in TinyUSB. See also DCD.
HID
Human Interface Device. USB class for input devices like keyboards, mice, and game controllers.
High Speed
USB 2.0 speed mode operating at 480 Mbps.
Full Speed
USB speed mode operating at 12 Mbps, supported by USB 1.1 and 2.0.
Low Speed
USB speed mode operating at 1.5 Mbps, typically used by simple input devices.
Interrupt Transfer
USB transfer type for small, time-sensitive data with guaranteed maximum latency.
Isochronous Transfer
USB transfer type for time-critical data like audio/video with guaranteed bandwidth but no error correction.
MSC
Mass Storage Class. USB class for storage devices like USB drives.
OSAL
Operating System Abstraction Layer. TinyUSB component that abstracts RTOS differences.
OTG
On-The-Go. USB specification allowing devices to act as both host and device.
Pipe
Host-side communication channel to a device endpoint.
Root Hub
The USB hub built into the host controller, where devices connect directly.
Stall
USB protocol mechanism where an endpoint responds with a STALL handshake to indicate an error condition or unsupported request. Used for error handling, not flow control.
Super Speed
USB 3.0 speed mode operating at 5 Gbps. Not supported by TinyUSB.
tud
TinyUSB Device. Function prefix for all device stack APIs (e.g., ``tud_task()``, ``tud_cdc_write()``).
tuh
TinyUSB Host. Function prefix for all host stack APIs (e.g., ``tuh_task()``, ``tuh_cdc_receive()``).
UAC
USB Audio Class. USB class for audio devices.
UVC
USB Video Class. USB class for video devices like cameras.
VID
Vendor Identifier. 16-bit number assigned by USB-IF to identify device manufacturers.
PID
Product Identifier. 16-bit number assigned by vendor to identify specific products.
USB-IF
USB Implementers Forum. Organization that maintains USB specifications and assigns VIDs.
+17
View File
@@ -0,0 +1,17 @@
*********
Reference
*********
Complete reference documentation for TinyUSB APIs, configuration, and supported hardware.
.. toctree::
:maxdepth: 2
architecture
usb_concepts
class_drivers
boards
dependencies
concurrency
device_issues
glossary
+428
View File
@@ -0,0 +1,428 @@
************
USB Concepts
************
This document provides a brief introduction to USB protocol fundamentals that are essential for understanding TinyUSB development.
TinyUSB API Naming Conventions
===============================
TinyUSB uses consistent function prefixes to organize its API:
* **tusb_**: Core stack functions (initialization, interrupt handling)
* **tud_**: Device stack functions (e.g., ``tud_task()``, ``tud_cdc_write()``)
* **tuh_**: Host stack functions (e.g., ``tuh_task()``, ``tuh_cdc_receive()``)
* **tu_**: Internal utility functions (generally not used by applications)
This naming makes it easy to identify which part of the stack a function belongs to and ensures there are no naming conflicts when using both device and host stacks together.
USB Protocol Basics
====================
Universal Serial Bus (USB) is a standardized communication protocol designed for connecting devices to hosts (typically computers). Understanding these core concepts is essential for effective TinyUSB development.
Host and Device Roles
----------------------
**USB Host**: The controlling side of a USB connection (typically a computer). The host:
- Initiates all communication
- Provides power to devices
- Manages the USB bus
- Enumerates and configures devices
**TinyUSB Host Stack**: Enable with ``CFG_TUH_ENABLED=1`` in ``tusb_config.h``. Call ``tuh_task()`` regularly in your main loop. See the :doc:`../getting_started` Quick Start Examples for implementation details.
**USB Device**: The peripheral side (keyboard, mouse, storage device, etc.). Devices:
- Respond to host requests
- Cannot initiate communication
- Receive power from the host
- Must be enumerated by the host before use
**TinyUSB Device Stack**: Enable with ``CFG_TUD_ENABLED=1`` in ``tusb_config.h``. Call ``tud_task()`` regularly in your main loop. See the :doc:`../getting_started` Quick Start Examples for implementation details.
**OTG (On-The-Go)**: Some devices can switch between host and device roles dynamically. **TinyUSB Support**: Both stacks can be enabled simultaneously on OTG-capable hardware. See ``examples/dual/`` for dual-role implementations.
USB Transfers
=============
Every USB transfer consists of the host issuing a request, and the device replying to that request. The host is the bus master and initiates all communication.
Devices cannot initiate sending data; for unsolicited incoming data, polling is used by the host.
USB defines four transfer types, each intended for different use cases:
Control Transfers
-----------------
Used for device configuration and control commands.
**Characteristics**:
- Bidirectional (uses both IN and OUT)
- Guaranteed delivery with error detection
- Limited data size (8-64 bytes per packet)
- All devices must support control transfers on endpoint 0
**Usage**: Device enumeration, configuration changes, class-specific commands
**TinyUSB Context**: Handled automatically by the core stack for standard requests; class drivers handle class-specific requests. Endpoint 0 is managed by ``src/device/usbd.c`` and ``src/host/usbh.c``. Configure buffer size with ``CFG_TUD_ENDPOINT0_SIZE`` (typically 64 bytes).
Bulk Transfers
--------------
Used for large amounts of data that don't require guaranteed timing.
**Characteristics**:
- Unidirectional (separate IN and OUT endpoints)
- Guaranteed delivery with error detection
- Large packet sizes (up to 512 bytes for High Speed)
- Uses available bandwidth when no other transfers are active
**Usage**: File transfers, large data communication, CDC serial data
**TinyUSB Context**: Used by MSC (mass storage) and CDC classes for data transfer. Configure endpoint buffer sizes with ``CFG_TUD_MSC_EP_BUFSIZE`` and ``CFG_TUD_CDC_EP_BUFSIZE``. See ``src/class/msc/`` and ``src/class/cdc/`` for implementation details.
Interrupt Transfers
-------------------
Used for small, time-sensitive data with guaranteed maximum latency.
**Characteristics**:
- Unidirectional (separate IN and OUT endpoints)
- Guaranteed delivery with error detection
- Small packet sizes (up to 64 bytes for Full Speed)
- Regular polling interval (1ms to 255ms)
**Usage**: Keyboard/mouse input, sensor data, status updates
**TinyUSB Context**: Used by HID class for input reports. Configure with ``CFG_TUD_HID`` and ``CFG_TUD_HID_EP_BUFSIZE``. Send reports using ``tud_hid_report()`` or ``tud_hid_keyboard_report()``. See ``src/class/hid/`` and HID examples in ``examples/device/hid_*/``.
Isochronous Transfers
---------------------
Used for time-critical streaming data.
**Characteristics**:
- Unidirectional (separate IN and OUT endpoints)
- No error correction (speed over reliability)
- Guaranteed bandwidth
- Real-time delivery
**Usage**: Audio, video streaming
**TinyUSB Context**: Used by Audio class for streaming audio data. Configure with ``CFG_TUD_AUDIO`` and related audio configuration macros. See ``src/class/audio/`` and audio examples in ``examples/device/audio_*/`` for UAC2 implementation.
Endpoints and Addressing
=========================
Endpoint Basics
---------------
**Endpoint**: A communication channel between host and device.
- Each endpoint has a number (0-15) and direction
- Endpoint 0 is reserved for control transfers
- Other endpoints are assigned by device class requirements
**TinyUSB Endpoint Management**: Configure maximum endpoints with ``CFG_TUD_ENDPOINT_MAX``. Endpoints are automatically allocated by enabled classes. See your board's ``usb_descriptors.c`` for endpoint assignments.
**Direction**:
- **OUT**: Host to device (host sends data out)
- **IN**: Device to host (host reads data in)
- Note that in TinyUSB code, for ``tx``/``rx``, the device perspective is used typically: E.g., ``tud_cdc_tx_complete_cb()`` designates the callback executed once the device has completed sending data to the host (in device mode).
**Addressing**: Endpoints are addressed as EPx IN/OUT (e.g., EP1 IN, EP2 OUT)
Endpoint Configuration
----------------------
Each endpoint is configured with a specific **transfer type** (control, bulk, interrupt, or isochronous), a **direction** (IN, OUT, or bidirectional for control only), a **maximum packet size** that depends on USB speed and transfer type, and an **interval** for interrupt and isochronous endpoints.
**TinyUSB Configuration**: Endpoint characteristics are defined in descriptors (``usb_descriptors.c``) and automatically configured by the stack. Buffer sizes are set via ``CFG_TUD_*_EP_BUFSIZE`` macros.
Error Handling and Flow Control
-------------------------------
**Transfer Results**: USB transfers can complete with different results. An **ACK** indicates a successful transfer, while a **NAK** signals that the device is not ready (commonly used for flow control). A **STALL** response indicates an error condition or unsupported request, and **Timeout** occurs when a transfer fails to complete within the expected time frame.
**Flow Control in USB**: Unlike network protocols, USB doesn't use traditional congestion control. Instead, devices use NAK responses when not ready to receive data, applications implement buffering and proper timing strategies, and some classes (like CDC) support hardware flow control mechanisms such as RTS/CTS.
**TinyUSB Handling**: Transfer results are represented as ``xfer_result_t`` enum values. The stack automatically handles NAK responses and timing. STALL conditions indicate application-level errors that should be addressed in class drivers.
USB Device States
=================
A USB device progresses through several states:
1. **Attached**: Device is physically connected
2. **Powered**: Device receives power from host
3. **Default**: Device responds to address 0
4. **Address**: Device has been assigned a unique address
5. **Configured**: Device is ready for normal operation
6. **Suspended**: Device is in low-power state
**TinyUSB State Management**: State transitions are handled automatically by ``src/device/usbd.c``. You can implement ``tud_mount_cb()`` and ``tud_umount_cb()`` to respond to configuration changes, and ``tud_suspend_cb()``/``tud_resume_cb()`` for power management.
Device Enumeration Process
==========================
When a device is connected, the host follows this process:
1. **Detection**: Host detects device connection
2. **Reset**: Host resets the device
3. **Descriptor Requests**: Host requests device descriptors
4. **Address Assignment**: Host assigns unique address to device
5. **Configuration**: Host selects and configures device
6. **Class Loading**: Host loads appropriate drivers
7. **Normal Operation**: Device is ready for use
**TinyUSB Role**: The device stack handles steps 1-6 automatically; your application handles step 7.
USB Descriptors
===============
Descriptors are data structures that describe device capabilities:
Device Descriptor
-----------------
Describes the device (VID, PID, USB version, etc.)
Configuration Descriptor
------------------------
Describes device configuration (power requirements, interfaces, etc.)
Interface Descriptor
--------------------
Describes a functional interface (class, endpoints, etc.)
Endpoint Descriptor
-------------------
Describes endpoint characteristics (type, direction, size, etc.)
String Descriptors
------------------
Human-readable strings (manufacturer, product name, etc.)
**TinyUSB Implementation**: You provide descriptors in ``usb_descriptors.c`` via callback functions:
- ``tud_descriptor_device_cb()`` - Device descriptor
- ``tud_descriptor_configuration_cb()`` - Configuration descriptor
- ``tud_descriptor_string_cb()`` - String descriptors
The stack automatically handles descriptor requests during enumeration. See examples in ``examples/device/*/usb_descriptors.c`` for reference implementations.
USB Classes
===========
USB classes define standardized protocols for device types:
**Class Code**: Identifies the device type in descriptors
**Class Driver**: Software that implements the class protocol
**Class Requests**: Standardized commands for the class
**Common TinyUSB-Supported Classes**:
- **CDC (02h)**: Communication devices (virtual serial ports) - Enable with ``CFG_TUD_CDC``
- **HID (03h)**: Human interface devices (keyboards, mice) - Enable with ``CFG_TUD_HID``
- **MSC (08h)**: Mass storage devices (USB drives) - Enable with ``CFG_TUD_MSC``
- **Audio (01h)**: Audio devices (speakers, microphones) - Enable with ``CFG_TUD_AUDIO``
- **MIDI**: MIDI devices - Enable with ``CFG_TUD_MIDI``
- **DFU**: Device Firmware Update - Enable with ``CFG_TUD_DFU``
- **Vendor**: Custom vendor classes - Enable with ``CFG_TUD_VENDOR``
.. note::
**Vendor Class Buffer Configuration**: Unlike other USB classes, the vendor class supports setting buffer sizes to 0 in ``tusb_config.h`` (``CFG_TUD_VENDOR_RX_BUFSIZE = 0``) to disable internal buffering. When disabled, data goes directly to ``tud_vendor_rx_cb()`` and the ``tud_vendor_read()``/``tud_vendor_write()`` functions are not available - applications must handle data directly in callbacks.
See ``examples/device/*/tusb_config.h`` for configuration examples.
USB Speeds
==========
USB supports multiple speed modes:
**Low Speed (1.5 Mbps)**:
- Simple devices (mice, keyboards)
- Limited endpoint types and sizes
**Full Speed (12 Mbps)**:
- Most common for embedded devices
- All transfer types supported
- Maximum packet sizes: Control (64), Bulk (64), Interrupt (64)
**High Speed (480 Mbps)**:
- High-performance devices
- Larger packet sizes: Control (64), Bulk (512), Interrupt (1024)
- Requires more complex hardware
**Super Speed (5 Gbps)**:
- USB 3.0 and later
- Not supported by TinyUSB
**TinyUSB Speed Support**: Most TinyUSB ports support Full Speed and High Speed. Speed is typically auto-detected by hardware. Configure speed requirements in board configuration (``hw/bsp/FAMILY/boards/BOARD/board.mk``) and ensure your MCU supports the desired speed.
USB Controller Abstraction
===========================
USB controllers are hardware peripherals that handle the low-level USB protocol implementation. Understanding how they work helps explain TinyUSB's architecture and portability.
Controller Fundamentals
-----------------------
**What Controllers Do**:
- Handle USB signaling and protocol timing
- Manage endpoint buffers and data transfers
- Generate interrupts for USB events
- Implement USB electrical specifications
**Key Components**: USB controllers consist of several key components working together. The **Physical Layer** provides USB signal drivers and receivers for electrical interfacing. The **Protocol Engine** handles USB packets and ACK/NAK responses according to the USB specification. **Endpoint Buffers** provide hardware FIFOs or RAM for data storage during transfers. Finally, the **Interrupt Controller** generates events for software processing when USB activities occur.
Controller Architecture Types
-----------------------------
Different MCU vendors implement USB controllers with varying architectures.
To list a few common patterns:
**FIFO-Based Controllers** (e.g., STM32 OTG, NXP LPC):
- Shared or dedicated FIFOs for endpoint data
- Software manages FIFO allocation and data flow
- Common in higher-end MCUs with flexible configurations
**Buffer-Based Controllers** (e.g., STM32 FSDEV, Microchip SAMD, RP2040):
- Fixed packet memory areas for each endpoint
- Hardware automatically handles packet placement
- Simpler programming model, common in smaller MCUs
**Descriptor-Based Controllers** (e.g., NXP EHCI-style):
- Use descriptor chains to describe transfers
- Hardware processes transfer descriptors independently
- More complex but can handle larger transfers autonomously
TinyUSB Controller Abstraction
------------------------------
TinyUSB abstracts controller differences through the TinyUSB **Device Controller Driver (DCD)** layer.
These internal details don't matter to users of TinyUSB typically; however, when debugging, knowledge about internal details helps sometimes.
**Portable Interface** (``src/device/usbd.h``):
- Standardized function signatures for all controllers
- Common endpoint and transfer management APIs
- Unified interrupt and event handling
**Controller-Specific Drivers** (``src/portable/VENDOR/FAMILY/``):
- Implement the DCD interface for specific hardware
- Handle vendor-specific register layouts and behaviors
- Manage controller-specific quirks and workarounds
**Common DCD Functions**:
- ``dcd_init()`` - Initialize controller hardware
- ``dcd_edpt_open()`` - Configure endpoint with type and size
- ``dcd_edpt_xfer()`` - Start data transfer on endpoint
- ``dcd_int_handler()`` - Process USB interrupts
- ``dcd_connect()/dcd_disconnect()`` - Control USB bus connection
Host Controller Driver (HCD)
-----------------------------
TinyUSB also abstracts USB host controllers through the **Host Controller Driver (HCD)** layer for host mode applications.
**Portable Interface** (``src/host/usbh.h``):
- Standardized interface for all host controllers
- Common device enumeration and pipe management
- Unified transfer scheduling and completion handling
**Common HCD Functions**:
- ``hcd_init()`` - Initialize host controller hardware
- ``hcd_port_connect_status()`` - Check device connection status
- ``hcd_port_reset()`` - Reset connected device
- ``hcd_edpt_open()`` - Open communication pipe to device endpoint
- ``hcd_edpt_xfer()`` - Transfer data to/from connected device
**Host vs Device Architecture**: While DCD is reactive (responds to host requests), HCD is active (initiates all communication). Host controllers manage device enumeration, driver loading, and transfer scheduling to multiple connected devices.
TinyUSB Event System & Thread Safety
====================================
Deferred Interrupt Processing
-----------------------------
**Core Architectural Principle**: TinyUSB uses a deferred interrupt processing model where all USB hardware events are captured in interrupt service routines (ISRs) but processed later in non-interrupt context.
**Event Flow**:
1. **Hardware Event**: USB controller generates interrupt (e.g., data received, transfer complete)
2. **ISR Handling**: TinyUSB ISR captures the event and pushes it to a central event queue
3. **Deferred Processing**: Application calls ``tud_task()`` or ``tuh_task()`` to process queued events
4. **Class Driver Callbacks**: Events trigger appropriate class driver functions and user callbacks
**Buffer Integration**: The deferred processing model works seamlessly with TinyUSB's buffer/FIFO design. Since callbacks run in task context (not ISR), it's safe and straightforward to enqueue TX data directly in RX callbacks - for example, processing incoming CDC data and immediately sending a response.
Controller Event Flow
---------------------
**Typical USB Event Processing**:
1. **Hardware Event**: USB controller detects bus activity (setup packet, data transfer, etc.)
2. **Interrupt Generation**: Controller generates interrupt to CPU
3. **ISR Processing**: ``dcd_int_handler()`` reads controller status
4. **Event Queuing**: Events are queued for later processing (thread safety)
5. **Task Processing**: ``tud_task()`` processes queued events
6. **Class Notification**: Appropriate class drivers handle the event
7. **Application Callback**: User code responds to the event
USB Class Driver Architecture
==============================
TinyUSB implements USB classes through a standardized driver pattern that provides consistent integration with the core stack while allowing class-specific functionality.
Class Driver Pattern
---------------------
**Standardized Entry Points**: Each class driver implements these core functions:
- ``*_init()`` - Initialize class driver state and buffers
- ``*_reset()`` - Reset to initial state on USB bus reset
- ``*_open()`` - Parse and configure interfaces during enumeration
- ``*_control_xfer_cb()`` - Handle class-specific control requests
- ``*_xfer_cb()`` - Handle transfer completion callbacks
**Multi-Instance Support**: Classes support multiple instances using ``_n`` suffixed APIs:
.. code-block:: c
// Single instance (default instance 0)
tud_cdc_write(data, len);
// Multiple instances
tud_cdc_n_write(0, data, len); // Instance 0
tud_cdc_n_write(1, data, len); // Instance 1
**Integration with Core Stack**: Class drivers are automatically discovered and integrated through function pointers in driver tables. The core stack calls class drivers during enumeration, control requests, and data transfers without requiring explicit registration.
Class Driver Types
-------------------
TinyUSB classes have different architectural patterns based on their buffering capabilities and callback designs.
Most classes like CDC, MIDI, and HID always use internal buffers for data management. These classes provide notification-only callbacks such as ``tud_cdc_rx_cb(uint8_t itf)`` that signal when data is available, requiring applications to use class-specific APIs like ``tud_cdc_read()`` and ``tud_cdc_write()`` to access the data. HID is slightly different in that it provides direct buffer access in some callbacks (``tud_hid_set_report_cb()`` receives buffer and size parameters), but it still maintains internal endpoint buffering that cannot be disabled.
The **Vendor Class** is unique in that it supports both buffered and direct modes. When buffered, vendor class behaves like other classes with ``tud_vendor_read()`` and ``tud_vendor_write()`` APIs. However, when buffering is disabled by setting buffer size to 0, the vendor class provides direct buffer access through ``tud_vendor_rx_cb(itf, buffer, bufsize)`` callbacks, eliminating internal FIFO overhead and providing direct endpoint control.
**Block-Oriented Classes** like MSC operate differently by handling large data blocks through callback interfaces. The application implements storage access functions such as ``tud_msc_read10_cb()`` and ``tud_msc_write10_cb()``, while the TinyUSB stack manages the USB protocol aspects and the application manages the underlying storage.
Power Management
================
USB provides power to devices:
**Bus-Powered**: Device draws power from USB bus (up to 500mA)
**Self-Powered**: Device has its own power source
**Suspend/Resume**: Devices must enter low-power mode when bus is idle
**TinyUSB Power Management**:
- Implement ``tud_suspend_cb()`` and ``tud_resume_cb()`` for power management
- Configure power requirements in device descriptor (``bMaxPower`` field)
- Use ``tud_remote_wakeup()`` to wake the host from suspend (if supported)
- Enable remote wakeup with ``CFG_TUD_USBD_ENABLE_REMOTE_WAKEUP``
Next Steps
==========
- Start with :doc:`../getting_started` for basic setup
- Review ``examples/device/*/tusb_config.h`` for configuration examples
- Explore examples in ``examples/device/`` and ``examples/host/`` directories
+5
View File
@@ -0,0 +1,5 @@
sphinx>=5.0
furo>=2025.12.19
sphinx-autodoc-typehints>=1.10
myst-parser>=4.0
jinja2>=3.0.3
+306
View File
@@ -0,0 +1,306 @@
***************
Troubleshooting
***************
This guide helps you diagnose and fix common issues when developing with TinyUSB.
Build Issues
============
Toolchain Problems
------------------
**"arm-none-eabi-gcc: command not found"**
The ARM GCC toolchain is not installed or not in PATH.
*Solution*:
.. code-block:: bash
# Ubuntu/Debian
$ sudo apt-get update && sudo apt-get install gcc-arm-none-eabi
# macOS with Homebrew
$ brew install --cask gcc-arm-embedded
# Windows: Download from ARM website and add to PATH
**"make: command not found" or CMake errors**
Build tools are missing.
*Solution*:
.. code-block:: bash
# Ubuntu/Debian
$ sudo apt-get install build-essential cmake
# macOS
$ xcode-select --install
$ brew install cmake
Dependency Issues
-----------------
**"No rule to make target" or missing header files**
Dependencies for your MCU family are not downloaded.
*Solution*:
.. code-block:: bash
# Download dependencies for specific board or family
$ python tools/get_deps.py -b stm32h743eval # Replace with your board
$ python tools/get_deps.py stm32f4 # Replace with your family
# Or from example directory
cd examples/device/cdc_msc
make BOARD=your_board get-deps
**Board Not Found**
Invalid board name in build command.
*Diagnosis*:
.. code-block:: bash
# List available boards for a family
ls hw/bsp/stm32f4/boards/
*Solution*: Use exact board name from the listing.
Runtime Issues
==============
Check :doc:`reference/device_issues` for known hardware-specific issues that may affect USB functionality on your device.
Device Mode Problems
--------------------
**Device not recognized by host**
The most common issue - host doesn't see your USB device.
*Diagnosis steps*:
1. Check USB cable (must support data, not just power)
2. Enable logging: build with ``LOG=2``
3. Use different USB ports/hosts
4. Check device manager (Windows) or ``dmesg`` (Linux)
*Common causes and solutions*:
- **Invalid descriptors**: Review ``usb_descriptors.c`` carefully
- **``tud_task()`` not called**: Ensure regular calls in main loop (< 1ms interval)
- **Wrong USB configuration**: Check ``tusb_config.h`` settings
- **Hardware issues**: Verify USB pins, crystal/clock configuration
**Enumeration starts but fails**
Device is detected but configuration fails.
*Diagnosis*:
.. code-block:: bash
# Build with logging enabled
make BOARD=your_board LOG=2 all
*Look for*:
- Setup request handling errors
- Endpoint configuration problems
- String descriptor issues
*Solutions*:
- Implement all required descriptors
- Check endpoint sizes match descriptors
- Ensure control endpoint (EP0) handling is correct
**Data transfer issues**
Device enumerates but data doesn't transfer correctly.
*Common causes*:
- Buffer overruns in class callbacks
- Incorrect endpoint usage (IN vs OUT)
- Flow control issues in CDC class
*Solutions*:
- Check buffer sizes in callbacks
- Verify endpoint directions in descriptors
- Implement proper flow control
Host Mode Problems
------------------
**No devices detected**
Host application doesn't see connected devices.
*Hardware checks*:
- Power supply adequate for host mode
- USB-A connector for host (not micro-USB)
- Board supports host mode on selected port
*Software checks*:
- ``tuh_task()`` called regularly
- Host stack enabled in ``tusb_config.h``
- Correct root hub port configuration
**Device enumeration fails**
Devices connect but enumeration fails.
*Diagnosis*:
.. code-block:: bash
# Enable host logging
make BOARD=your_board LOG=2 RHPORT_HOST=1 all
*Common issues*:
- Power supply insufficient during enumeration
- Timing issues with slow devices
- USB hub compatibility problems
**Class driver issues**
Device enumerates but class-specific communication fails.
*Troubleshooting*:
- Check device descriptors match expected class
- Verify interface/endpoint assignments
- Some devices need device-specific handling
Performance Issues
==================
Slow Transfer Speeds
--------------------
**Symptoms**: Lower than expected USB transfer rates
*Causes and solutions*: Improve **task scheduling** by calling ``tud_task()``/``tuh_task()`` more frequently to ensure timely USB event processing. Consider increasing **endpoint buffer sizes** for bulk transfers to reduce the frequency of small transfers. Enable **DMA usage** for USB transfers if your hardware supports it to offload CPU processing. Finally, use **High Speed** (480 Mbps) instead of Full Speed (12 Mbps) when possible to achieve better throughput.
High CPU Usage
--------------
**Symptoms**: MCU spending too much time in USB handling
*Solutions*:
- Use efficient logging (RTT/SWO instead of UART)
- Reduce log level in production builds
- Optimize descriptor parsing
- Use DMA for data transfers
Hardware-Specific Issues
========================
STM32 Issues
------------
**Clock configuration problems**:
- USB requires precise 48MHz clock
- HSE crystal must be configured correctly
- PLL settings affect USB timing
**Pin configuration**:
- USB pins need specific alternate function settings
- VBUS sensing configuration
- ID pin for OTG applications
RP2040 Issues
-------------
**PIO-USB for host mode**:
- Requires specific pin assignments
- CPU overclocking may be needed for reliable operation
- Timing-sensitive - avoid long interrupt disable periods
ESP32 Issues
------------
**USB peripheral differences**:
- ESP32-S2/S3/P4 have different USB capabilities
- DMA configuration varies between models
Advanced Debugging
==================
Using USB Analyzers
-------------------
For complex issues, hardware USB analyzers provide detailed protocol traces:
- **Wireshark** with USBPcap (Windows) or usbmon (Linux)
- **Hardware analyzers**: Total Phase Beagle, LeCroy USB analyzers
- **Logic analyzers**: For timing analysis of USB signals
Debugging with GDB
------------------
Debugging with traditional debuggers is limited due to the real time nature of USB.
However, especially for diagnosis of crashes, it can still be useful.
.. code-block:: bash
# Build with debug info
make BOARD=your_board DEBUG=1 all
# Use with debugger
arm-none-eabi-gdb build/your_app.elf
*Useful breakpoints*:
- ``dcd_int_handler()`` - USB interrupt entry
- ``tud_task()`` - Main device task
- Class-specific callbacks
Custom Logging
--------------
For production debugging, implement custom logging:
.. code-block:: c
// In tusb_config.h
#define CFG_TUSB_DEBUG_PRINTF my_printf
// Your implementation
void my_printf(const char* format, ...) {
// Send to RTT, SWO, or custom interface
}
Getting Help
============
When reporting issues:
1. **Minimal reproducible example**: Simplify to bare minimum
2. **Build information**: Board, toolchain version, build flags
3. **Logs**: Include output with ``LOG=2`` enabled
4. **Hardware details**: Board revision, USB connections, power supply
5. **Host environment**: OS version, USB port type
**Resources**:
- GitHub Discussions: https://github.com/hathach/tinyusb/discussions
- Issue Tracker: https://github.com/hathach/tinyusb/issues
- Documentation: https://docs.tinyusb.org