#TinyUSB
Explore tagged Tumblr posts
Text
MAX3421e USB Host FeatherWing test 🖥️ 🔌 ✅
We previously made a jerry-rigged USB Host Wing (https://www.adafruit.com/product/5858) tester based on an ESP32-S2 TFT board (https://www.adafruit.com/product/5300) and a pogo-pin (https://www.adafruit.com/product/394) filled Feather Doubler (https://www.adafruit.com/product/2890) - but for final testing of hundreds of boards off a panel, a nice custom-made PCB is better. This one uses a Metro M0 since our SAMD21 board support package has TinyUSB support - so we can verify if we enumerate the connected USB peripheral. If a vid/pid is found, we're good to go, and beep and blink to indicate the test has passed.
#MAX3421e#USBHostFeatherWing#ESP32S2#PCBTesting#Adafruit#TechDIY#ElectronicsTesting#MetroM0#TinyUSB#HardwareTesting
2 notes
·
View notes
Text
youtube
A simple example how to create/change new ESP32-S2 TinyUSB HID Vendor ID, Product ID, Manufacturer Name, & Product Name with built-in Espressif ESP32 arduino core library USB HID (Human Interface Device ) Consumer Control example to control Microsoft Windows (usb host) multimedia audio Volume Increment with ESP32-S2 TinyUSB HID USB Consumer Control Device (usb client). Create Custom VID & PID ESP32-S2 TinyUSB HID ESP32 Arduino Core Composite Multi Class USB Device
#tutorials#how to#programming#arduino#esp32-s2#USB Device#Espressif#TinyUSB#Vendor ID#Product ID#Manufacturer Name#Product Name#Consumer Control#Youtube
0 notes
Text
USB-BLE MIDIインターフェイスを作る - 環境構築編
1000円ちょっとでUSB-BLE MIDIインターフェイスを作ってみようという話です。

最近Bluetooth LE(BLE)を使って無線でMIDI信号をやり取りするのが流行ってますね。しかし、WindowsではBLE MIDIの対応があまりよろしくなく、Bluetoothが使えるPCでもBLE MIDIを使うのは難儀な感じです。ということで、いわゆるMIDI端子に接続して無線化するBLE MIDIインターフェイスを買うかな……と思っていたわけですが、そんな折ふとワイヤレスMIDI製品で知られるQUICCO SOUNDの��販サイトを���てみたらBluetooth MIDI基板なるものが。
これ、小型IoTボードのSeeed Studio XIAOシリーズに似ているよなあ、XIAOシリーズはBLE対応しているし、USBポートも搭載されているからこれでUSB-BLE MIDIインターフェイスを作れるのでは? と思い立ち、早速秋葉原でボード2種類を買ってきました。
XIAOシリーズには複数の製品ラインアップがあるのですが、そのなかでも安いのが「ESP32C3」というモデル(税込940円)と、「ESP32S3」というモデルです(税込み1,150円)。
軽くネットで調べたところ、どちらも少なくとも公開されているBLE MIDIライブラリには対応しているようでした。また、USB MIDIに関しては、少なくともESP32S3についてはネットでUSB MIDIデバイス化させている記事(「蛇腹楽器型MIDIコントローラーV2 ~ USB MIDIデバイスの作り方」)がありました。
ということで、とりあえずESP32S3で試してみましょう。

開発環境を整備する
Seeed StudioのXIAOシリーズはArduino IDEで開発やプログラム書き込みが行えるのですが、そのためにはArduino IDEに追加のライブラリやボード情報をインストールする必要があります。設定方法はSeeed StudioのWebサイトに詳しく書かれているので、この手順通りボードマネージャURLの追加を行えばOKです。
USB MIDIやBLE MIDIに関しては、Arduino MIDI Libraryと組み合わせて���用できるライブラリが公開されており、これを導入することで簡単に利用できるようになるようです。いくつか選択肢もあるようですが、今回は次の3つを導入しました。いずれもArduino IDEのライブラリマネージャからインストール可能です。
Adafruit TinyUSB Library
Arduino BLE-MIDI Transport
NimBLE-Arduino
動作テスト用コードの実装
まずはこれで本当にUSB MIDIデバイスやBLE MIDIデバイスとして動作するのかを検証するため、MIDIのnote on/note offメッセージだけをやり取りするコードを書いてみます。前出の「蛇腹楽器型MIDIコントローラーV2 ~ USB MIDIデバイスの作り方」や、「NimBLE + BLE MIDIで音を出した」、「M5StickC で、BLE-MIDI ドラム」などを参考に、こんな感じでコードを書いてみました。
やっている処理は
各インターフェイスの初期化
BLE MIDI側で受け取ったnote on/offメッセージをそのままUSB MIDI側に送信
USB MIDI側で受け取ったnote on/offメッセージをそのままBLE MIDI側に送信
の3つだけです。BLE MIDIの接続時にLEDを光らせる部分のコードはそのままコピペしたのですがコンパイルエラーになったのでとりあえずコメントアウトしています。
ビルドと書き込み
ボード設定はこんな感じです。
ボードとして「XIAO_ESP32S3」を選択し、それに加えてUSB Modeとして「USB-OTG (TinyUSB)」を選択しておく必要があります。また、色々とライブラリを使用しているためかArduino IDEがOutOfMemoryでフリーズしたので、前回記事で紹介したArduino IDEのメモリ設定の変更も行っています。
書き込み自体はボードをUSBでPCに接続し、シリアルポートを適切に選択して書き込みを実行するだけ行えます。念のため書き込み後はいったんUSBケーブルをポートから取り外して、再度USBポートに差し込んで再起動させています。
動かしてみる
BLE MIDI対応デバイスと言えばiPhoneやiPadですね。ということで、PC上のAbleton LiveからMIDI信号を送ってiPad上のGarageBandを鳴らしてみました。Ableton Liveからは問題なくUSBデバイスとして認識され、またiPadからも問題なくBLE MIDIデバイスとして認識されました。MIDIノートの送信もできています。
ただ、若干発音タイミングがヨレています。このあたりは改善したいところですが、果たしてできるのでしょうか?
(続く)
5 notes
·
View notes
Text
シンセ開発ログ 2023-08-06: Pico用シンセ「PRA32-U」を開発中/MCLKが必要なDACに対応/USB-MIDI変換の問題/UART MIDI制御は安定
Pico用シンセ「PRA32-U」を開発中
「Digital Synth PRA32-U」は、Raspberry Pi Picoとオーディオ用DAC基板(Pimoroni Pico Audio PackやWaveshare Pico-Audio)を使った、誰でも作れるシンセサイザー(MIDI音源)です。ソースコードはフリーで、Arduino IDEを使って改造できます。最初のバージョン(v0.1)はArduino UNO R3用シンセサイザー「Digital Synth VRA8-U」を移植したもので、これをベースに改善や機能追加を進めています。「Maker Faire Tokyo 2023」にv1を出展予定です。
【追記】すみません。以下の写真のジャンパー線の接続は間違っています!

MCLKが必要なDACに対応
前回の投稿で、Pico用DAC基板の供給不足について心配していました(PRA32-Uを簡単に作れなくなるかも)が、Pimoroni公式でPico Audio Packの販売が再開されました。他のショップでの売り切れも収まっていくのではないかと思います。 https://shop.pimoroni.com/products/pico-audio-pack?variant=32369490853971
また、Arduino-Pico(Earle F. Philhower, IIIさんによるArduino IDEのRaspberry Pi Pico/RP2040用コア)が、バージョン3.3.1でMCLKが必要なDACに対応しました! https://github.com/earlephilhower/arduino-pico/releases/tag/3.3.1 https://arduino-pico.readthedocs.io/en/latest/i2s.html
これで、Waveshare Pico-Audio Rev2.1(写真)も使えるようになりました。こちらは、(MIDI 2.0プロトタイピングツールProtoZOAでも使用されている)Waveshare Pico LCD 1.14と一緒に使えるハズです。 https://www.switch-science.com/products/7543 https://www.waveshare.com/wiki/Pico-Audio
当面、DAC基板の心配はなくなったと思います。よかったです。
USB-MIDI変換の問題
PRA32-Uは、USB MIDIによる制御が基本なので、ライブなどでPC無しでMIDIキーボードを接続したい場合には、USB-MIDI変換(USBホスト)機器を使う必要があります。しかし、変換機器経由でキーボードからPRA32-Uに大量のMIDIメッセージを送信(4和音ノートオン/オフをたくさん実行)すると、ノートオフメッセージを取りこぼす(音が鳴りっぱなしになる)場合がありました。楽器として大問題です。また、変換機器にMIDIメッセージがたまってしまい、処理が遅延するようでした。
以下の3機器、どれも問題発生しました。ただ、下に行くほど発生率は低くなる印象でした。
DOREMiDi UMH-10
MIDITECH USB MIDI HOST
KENTON MIDI USB HOST Mk3
KENTONでは、KORG nanoKEY Studioのコードパッドやイージースケールで演奏した場合は、問題発生しませんでした。しかし、M-AUDIOb Oxygen Pro Miniで大量のコード演奏を行った場合は、問題発生しました。(実際にこのよう��演奏を行う可能性は低そうですが)
Adafruit TinyUSBコンフィグファイルでMIDI FIFO size of TX and RXを大きくしても、問題回避できませんでした。
Windows PC経由でUSB MIDI接続した場合、CME WIDI Uhostに接続した場合は、問題発生していません。
おそらく、変換機器とPRA32-U(Pico)の両方に原因があるのではないかと思います。低確率ですが、Roland S-1でもノートオフメッセージを取りこぼす場合がありました。USB MIDIの規格では最大通信スピードが規定されていないよう(詳しくは調べていません)ですが、31.25kbpsくらいに抑えて欲しい気がします。
この問題は将来的に改善したいところですが、とりあえず現状でヨシとして進めたいと思います。特に、オープンソース化される予定のPico用MIDI 2.0ライブラリに期待します。
UART MIDI制御は安定
PRA32-Uは、UARTでも制御できます。通信スピードを31.25kbpsにして、以下のような3.3V MIDI-UART変換に対応した拡張ボードを接続すれば、DIN/TRS MIDIでも制御できます。MIDIキーボードを直接接続したい場合には、この方法を使うのが安全そうです。
Adafruit MIDI FeatherWing Kit https://www.adafruit.com/product/4740
necobit電子 MIDI Unit for GROVE(写真) https://necobit.com/denshi/grove-midi-unit/
木下研究所 MIDI-UARTインターフェースさん キット https://www.switch-science.com/products/8117
他にも、PRA32-Uの機能追加や修正を進めています。8月末までには、音が新しくなったv0.2を完成させる予定です。
1 note
·
View note
Text
TinyUSB: Open-source cross-platform USB Host/Device stack for embedded systems
https://docs.tinyusb.org/en/latest/ Comments
1 note
·
View note
Link
via Adafruit Industries – Makers, hackers, artists, designers and engineers! https://ift.tt/2yIxieI
0 notes
Text
Drag And Drop Files On Select Arduino Boards
Historically, getting files on to a microcontroller device was a fraught process. You might have found yourself placing image data manually into arrays in code, or perhaps repeatedly swapping SD cards in and out. For select Arduino boards, that’s no longer a problem – thanks to the new TinyUSB library from Adafruit (Youtube link, embedded below).
The library is available on Github, and is compatible with SAMD21 and SAMD51 boards, as well as Nordic’s NRF52840. It allows the Arduino board to appear as a USB drive, and files can simply be dragged and dropped into place. The library can set up to use SPI flash, SD cards, or even internal chip memory as the storage medium.
Potential applications include images, audio files, fonts, or even configuration files. Future plans include porting the TinyUSB library to the ESP32-S2 as well. Being able to drag a settings file straight on to a board could make getting WiFi boards online much less of a hassle.
We’ve seen other nifty USB libraries before, VUSB is a great option if you need USB on your AVR microcontroller. Video after the break.
youtube
Drag And Drop Files On Select Arduino Boards was originally published on PlanetArduino
0 notes
Text
youtube
WebHID Electron Desktop App Arduino ESP32 USB HID Vendor Basic IO Example Test Demo Simple basic example Arduinp ESP32 TinyUSB HID device Electron WebHID API Microsoft Windows desktop application test demo USB HID (Human Interface Devices) Vendor feature reports.
#programming#tutorials#arduino#how to#TinyUSB#WebHID#WebHID API#Vendor feature reports#Arduino ESP32#Youtube
0 notes
Text
RP2040 USB host to program ESP chips through CDC chips
Historically, we've tested and programmed our Feather ESP8266 (https://www.adafruit.com/product/2821) and ESP32 boards (https://www.adafruit.com/product/3405) from a Raspberry Pi. We'd connect over USB and run esptool.py, which works fine but has more things that can go wrong: power flickering, SD card failures, etc. It's better to fully program it with a Pico RP2040 brain board. We can do that now because TinyUSB has support for USB CDC Serial chips (https://github.com/adafruit/Adafruit_TinyUSB_Arduino/tree/master/examples/DualRole/CDC/serial_host_bridge) like the FT232, CP210x, and WCH9102! We upload the stub and test firmware, then listen on the CDC for the self-test output. It works really fast and is much easier to manage.
#Adafruit#ESP8266#ESP32#RaspberryPi#esptool#USB#TinyUSB#PicoRP2040#FirmwareProgramming#CDCSerialChips
1 note
·
View note
Text
youtube
Desk of Ladyada - It's a RISC-V kinda weekend https://youtu.be/aC3vGKHRCBA
MMade progress on two RISC-V projects to finalize PCBs. We optimized the CH32v203g6 chip-based QT Py board by reducing it from a 4-layer to a 2-layer to cut costs, and integrated TinyUSB support for better Arduino IDE compatibility. We also advanced the Feather ESP32-C6 project, enhancing its deep sleep power efficiency and finalizing the USB Key 'Trinkey' for standalone gateways or sensors. Plus, we picked out a clear USB enclosure from Digi-Key for it.
9 notes
·
View notes
Text
QT Py USB Host BFF Tests a Trinkey
our popular USB Host FeatherWing (https://www.adafruit.com/product/5858) lets anyone with a Feather board add USB Host support via the MAX3421E (https://www.digikey.com/en/products/detail/analog-devices-inc-maxim-integrated/MAX3421EETJ-T/1455883) chip - a tried and true SPI-to-USB converter. here's a tinified version, that fits on the back of any QT Py or Xiao board. use SPI plus a CS and IRQ pin and you're ready to rock. theres tinyUSB support for me MAX3421 chip (https://github.com/hathach/tinyusb/issues/2001) for Arduino which means its trivial to connect to a USB keyboard, mouse, storage key, or a USB serial device like this Trinkey! We're using our SHT45 Trinkey (https://www.adafruit.com/product/5896) as a demo board since its an easy way to quickly verify enumeration and data transfer. since the BFF/QTPy form-factor is too small for a proper USB Type A, we're going with a micro B, you can just an OTG adapter to turn it into a full size A (https://www.adafruit.com/product/1099)
0 notes
Text
シンセ開発ログ 2023-06-04: Raspberry Pi Pico用シンセ「PRA32-U」を開発中、「VRA8-U」によく似た音を出す最初のバージョンv0.1を公開
Digital Synth PRA32-Uの紹介文:Raspberry Pi Picoとオーディオ用DAC基板(Pico Audio Packなど)を使った、誰でも作れるシンセサイザー(MIDI音源)です。ソースコードはフリーで、Arduino IDEを使って改造できます。最初のバージョンはArduino UNO R3用シンセサイザー「Digital Synth VRA8-U」を移植したもので、これをベースに改善や機能追加を進めています。
youtube
約1月前の前回投稿の直後に、Earle F. Philhower, IIIさんによるArduino-Pico、Adafruit TinyUSB、Arduino MIDI Libraryのおかげで、USB MIDIにも簡単に対応できました(オーディオへの影響も避けられています)。そこで、「PRA32-U」v0.1を公開しました(最新版はv0.1.1)。音はプロトタイプのデモ動画と同様で、シリアルMIDI制御にも対応しています。
https://github.com/risgk/digital-synth-pra32-u/releases/tag/v0.1.1
v0.1系は“「VRA8-U」によく似た音を出す”(ベタ移植)バージョンとして、最低限のメンテナンスを続けようと考えています。
その後、以下のような実装を行ってきました。まだまだ、やること/やりたいことがありますが、今年の10月にはv1をリリースしたいです。
オシレーターの線形補間精度を改善
波形テーブルのサンプル数、ビット数を増加
フィルターの計算精度を改善(ただし、乗算は32ビット×16ビットまでに留めている)
カットオフ周波数の変化幅を5オクターブから8オクターブに(滑らかさは要調整)
フィルター係数値のビット数を増加
アンプの計算精度を改善
ノイズジェネレーターを改善(特にLFOのS/H波形が改善された。ホワイトノイズは元々そこそこ優秀だった)
オシレーターから、ノイズジェネレーター、LFO、コーラスFxを分離
各モジュールを静的変数でなくする(処理性能には影響しない。「VRA8」シリーズもこうすれば良かった気がする)
CPU負荷を安定させるために、特に信号処理関数内の条件分岐を減らす(継続中)
低レート処理用の関数を独立(整理中)
今後の機能追加(ポリ化? ハイレゾ化?)や改造の余地を残すため、信号処理パワーはCPUはコア1個の25%程度(通信処理は別)、SRAM使用量は50%程度以下に抑えたいと考えています。なお、音質は着実に改善していると思うのですが、v1に到達しても“「VRA8-U」とあまり音が変わらない”と言われるリスクはありそうです。
1 note
·
View note