Help Needed: Building an Audio CD Player with USB DVD Drive

false_terry

New member
Hi folks,
I’m new here and recently got back into working on my hobby projects. I decided to build an audio CD player using the hardware I already have.

Here’s what I’ve already have:

Atmega2560
VS1053b audio decoder module
A cheap yellow display
A USB host shield (unfortunately, a clone version—it’s all I could find in local hardware stores)
The idea is to connect my ASUS USB DVD drive to this setup and control it by sending SCSI commands to achieve basic functionality like ejecting the tray, starting the motor, and reading data from CDs.

What I’ve Achieved So Far:
Successfully tested the USB host shield using Bill Greiman's UsbFat library (GitHub link: https://github.com/greiman/UsbFat) to read and write data on a USB flash drive. This confirms the shield is functioning correctly.
Retrieved the DVD drive descriptor and enumerated the device.
Obtained the maximum Logical Unit Number (LUN) of the drive.
Identified and set up the IN and OUT endpoints for communication.
Captured USB packets using Wireshark to analyze commands and responses.
Wireshark indicates the DVD drive has a max packet size of 512 bytes, whereas the USB host shield supports a maximum of 64 bytes. I believe this isn’t an issue since the data can likely be sent and received in chunks (e.g., commands are around 31 bytes).
Additionally, I’ve ensured the drive receives enough power using a Y-cable.

My Questions:

Is the USB host shield sufficient to communicate with the DVD drive, or do I need a more capable MCU like the Teensy 4.1? For reference, I found a complete example using the Teensy here: https://github.com/A-Dunstan/teensy4_usbhost/blob/master/examples/storage/cd_audio/cd_audio.ino
Are there any specific limitations I should be aware of when using the USB host shield?

What I Want to Achieve:
At the very least, I’d like to:

Send basic SCSI commands (e.g., eject tray, start motor) and receive proper responses.
Read data from the DVD drive to eventually play audio CDs.
Any help, advice, or resources to guide me through this project would be greatly appreciated!

Thanks in advance!

You can find latest project files in here : https://drive.google.com/drive/folders/1jYBsNS1oo6o_e1qHY8SXCp1Jt2E-dmTD

Code:
FreeRam 6990
MS ConfigureDevice
MS Init
Addr:01
NC:01
Device Descriptor Retrieved:
12 1 0 2 0 0 0 40 6B 1C 23 A2 0 0 1 2 3 1
GET_DESCRIPTOR successful.
String Descriptor (Index 1): USB2.0 External
String Descriptor (Index 2): Mass Storage Device
String Descriptor (Index 3): 97 436311501508
Enumerating devices...
Device Address: 1
Parent Address: 0
Is Hub: No
Endpoint Count: 1
Low Speed: No
Configuration set successfully.
Bulk IN Address: 0x81, Max Packet Size: 64
Bulk OUT Address: 0x2, Max Packet Size: 64
Registered Endpoints:
Endpoint Index: 0
  Address: 0x0
  Max Packet Size: 64
  Type: CONTROL

Endpoint Index: 1
  Address: 0x81
  Max Packet Size: 64
  Type: IN

Endpoint Index: 2
  Address: 0x2
  Max Packet Size: 64
  Type: OUT

MS Init
setAddr:0D
BulkOnly initialization failed. Error code: 13

ReadCapacity
---------------
CBW.dCBWTag: 00000001
USB Error: 0D
Index: 02
============================ CBW: 11

ResetRecovery
-----------------

ResetRecovery
-----------------
Gen SCSI Err: 11
LUN: 00
isLunOk 0
CBW.dCBWTag: 00000002
USB Error: 0D
Index: 02
============================ CBW: 11

ResetRecovery
-----------------

ResetRecovery
-----------------
Gen SCSI Err: 11
LUN: 00
isUnitReady 17
sectorSize 0
key.begin failed
 
If you’re doing any work on the Teensy 4.1 I’d suggest using USBHost_T36
There, you can control chunk size. On most USB storage devices we tested recently (SD card reader, Flash drive etc) reading and writing data in 32k chunks had the fastest data rates. Reading in 512 byte chunks was slow - around 0.3 to 0.7MB/s
But, on SD cards directly with SDIO, 512 Bytes is the optimal size for best speed.

So I would suggest using the Teensy dedicated USB host lib mentioned above and start to play with chunk sizes to see where the sweet spot is
 
The USB Host shield you're using is only capable of USB 1.1, not USB 2. That's fine for using it to control the CD drive to play audio (since the audio data doesn't travel over USB) but for actually reading data discs or extracting CD audio it will be slow.

I disagree with the comment above; the repository linked in OP's post is mine, it's designed as a replacement for USBHost_T36 and specifically supports optical drives. USBHost_T36 can't handle storage devices that don't use 512 byte sectors, so it doesn't work with optical drives (2048 byte sectors) or newer HDDs (4096 byte sectors).
 
I disagree with the comment above; the repository linked in OP's post is mine, it's designed as a replacement for USBHost_T36 and specifically supports optical drives. USBHost_T36 can't handle storage devices that don't use 512 byte sectors, so it doesn't work with optical drives (2048 byte sectors) or newer HDDs (4096 byte sectors).
I was not aware of that - thanks for correcting and educating!
 
Thank you, guys. I will try with teensy then. I wonder why my setup is not sending commands to the dvd drive. Do you have any thoughts?
 
Back
Top