USB Host and guitar pedal board.

It’s my first time programming an Arduino, let alone working with serial peripherals.

I’m working with the USB Shield and a guitar effects pedal board, which currently can be configured by the PC with some open source software GUI (MeEdit on sourceForge) and a USB cable. I’m able to successfully reproduce 2 (proof of concept) messages (clean all effects & mute) from the PC using the USB cable but without the MeEdit GUI but rather a serial message manager (Bome’s SendSX) . I figured out those messages using USB sniffers while using MeEdit GUI.

I used the descriptor sketch for my pedal board and take note of the data. I copied Collin Cunningham USB Guitar toy - Midi keyboard sketch and use it as a basis for my sketch. After polling when ready I send 5 times each message (first mute, wait 2k milliseconds, then clean effects [which restores the volume]) and no dice with either one. It doesn’t even mute in the first place. Usb.setReport response is 0 for all 10 messages (not sure if good or bad, what does this means?).

I’m using the old libraries prior USB Shield 2.0 and Arduino IDE 0022 (an alpha version I think).

My main concerns are:

  • I’m not using the descriptors parameters correctly.
  • I’m using wrong libraries.
  • I’m missing something I didn’t even knew it had to be done in the first place.
  • Being forced to change to USB Shield which I think is not compatible with my USB Shield version.

I’m discarding this concerns:

  • Hardware doesn’t work (descriptor sketch works fine)
  • The message was wrongly copied (I’ve made a simple message converter/parser from FF EE DD notation (Bome’s) to 0xFF, 0xEE, 0xDD (Arduino) to copy/paste them easily)
  • I need some messages to initialize the pedal board (Using Bome’s SendSX I’m able to successfully notice changes between the 2 messages without the need of initial - messages, but I’m not sure of this)

Any help would be appreciated.

Could you post the problem code? (Use the code # format button).

For the sake of this post I’m just posting some parts of the code. I use many functions/files for parsing and trying to organize the code.

Again, help would be appreciated. Specially for my concerns and start discarding issues (or rising new ones).

Descriptor Test

Start
Device addressed... Requesting device descriptor.
Device descriptor:

Descriptor Length:		12
USB version:			1.10
Class:					FF Vendor Specific
Subclass:				00
Protocol:				FF
Max.packet size:		08
Vendor  ID:        		0582
Product ID:        		0113
Revision ID:        	0100
Mfg.string index:   	01 Length: 10 Contents: BOSS
Prod.string index:  	02 Length: 12 Contents: ME-25
Serial number index:	00
Number of conf.:    	01

Configuration number 0
Total configuration length: 155 bytes

Configuration descriptor:
Total length:			009B
Number of interfaces:	03
Configuration value:	01
Configuration string:   00
Attributes:        		C0 Self-powered
Max.power:        		00 0ma

Interface descriptor:
Interface number:		00
Alternate setting:   	00
Endpoints:        		00
Class:            		FF Vendor Specific
Subclass:        		02
Protocol:        		00
Interface string:    	00

Interface descriptor:
Interface number:    	00
Alternate setting:    	01
Endpoints:        		01
Class:            		FF Vendor Specific
Subclass:        		02
Protocol:        		00
Interface string:    	00

Unknown descriptor:
Length:					07
Type:        			24
Contents:    			01010001000B24

Unknown descriptor:
Length:        			0B
Type:        			24
Contents:    			02010203180144AC000705

Endpoint descriptor:
Endpoint address:		01 Direction: OUT
Attributes:				09	Transfer type:	Isochronous, 
							Sync Type:		Not Supported, 
							Usage Type:		Data
Max.packet size:		0120
Polling interval:		01 1 ms

Unknown descriptor:
Length:					07
Type: 					25
Contents:    			01000200020904

Interface descriptor:
Interface number:		01
Alternate setting:    	00
Endpoints:        		00
Class:            		FF Vendor Specific
Subclass:        		02
Protocol:        		00
Interface string:    	00

Interface descriptor:
Interface number:    	01
Alternate setting:    	01
Endpoints:        		01
Class:            		FF Vendor Specific
Subclass:        		02
Protocol:        		00
Interface string:    	00

Unknown descriptor:
Length:        			07
Type:        			24
Contents:    			01070001000B24

Unknown descriptor:
Length:        			0B
Type:        			24
Contents:    			02010203180144AC000705

Endpoint descriptor:
Endpoint address:    	02 Direction: IN
Attributes:        		05	Transfer type:	Isochronous, 
							Sync Type: 		Data, 
							Usage Type: 	Data
Max.packet size:    	0120
Polling interval:    	01 1 ms

Unknown descriptor:
Length:        			07
Type:        			25
Contents:    			01000000000904

Interface descriptor:
Interface number:    	02
Alternate setting:    	00
Endpoints:        		02
Class:            		FF Vendor Specific
Subclass:        		03
Protocol:        		00
Interface string:    	00

Endpoint descriptor:
Endpoint address:    	03 Direction: OUT
Attributes:        		02 Transfer type: Bulk
Max.packet size:    	0020
Polling interval:    	00 0 ms

Endpoint descriptor:
Endpoint address:    	04 Direction: IN
Attributes:        		02 Transfer type: Bulk
Max.packet size:    	0020
Polling interval:    	00 0 ms

Interface descriptor:
Interface number:    	02
Alternate setting:    	01
Endpoints:        		02
Class:            		FF Vendor Specific
Subclass:        		03
Protocol:        		00
Interface string:    	00

Endpoint descriptor:
Endpoint address:    	03 Direction: OUT
Attributes:        		02 Transfer type: Bulk
Max.packet size:    	0020
Polling interval:    	01 1 ms

Endpoint descriptor:
Endpoint address:    	04 Direction: IN
Attributes:        		03 Transfer type: Interrupt
Max.packet size:    	0020
Polling interval:    	01 1 ms

Descriptor params

#define ME25_ADDR            1
#define ME25_VID_LO          0xFFFFFF82
#define ME25_VID_HI          0x05
#define ME25_PID_LO          0x13        // Batch Device
#define ME25_PID_HI          0x01
#define ME25_CONFIG          1
#define ME25_IF              0
#define ME25_NUM_EP          3           //EP record structure for ME25 controller
#define EP_MAXPKTSIZE        0x08
#define EP_BULK              0x03
#define EP_POLL              0x01
#define CONTROL_EP           0
#define OUTPUT_EP            1
#define INPUT_EP             2
#define ME25_01_REPORT_LEN   0x09
#define ME25_DESCR_LEN       0x9B
EP_RECORD ep_record[ ME25_NUM_EP ];     //EP record structure for ME25 controller

Product’s init

void ME25_init( void ){
  byte rcode = 0;
  ep_record[ CONTROL_EP ] = *( Usb.getDevTableEntry( 0 , 0 ));// copy EP 0 params
  ep_record[ OUTPUT_EP  ].epAddr = OUTPUT_EP;		    // Output endpoint
  ep_record[ OUTPUT_EP  ].Attr  = EP_BULK;
  ep_record[ OUTPUT_EP  ].MaxPktSize = EP_MAXPKTSIZE;
  ep_record[ OUTPUT_EP  ].Interval  = EP_POLL;
  ep_record[ OUTPUT_EP  ].sndToggle = bmSNDTOG0;
  ep_record[ OUTPUT_EP  ].rcvToggle = bmRCVTOG0;
  ep_record[ INPUT_EP   ].epAddr = INPUT_EP;		    // Input endpoint
  ep_record[ INPUT_EP   ].Attr  = EP_BULK;
  ep_record[ INPUT_EP   ].MaxPktSize = EP_MAXPKTSIZE;
  ep_record[ INPUT_EP   ].Interval  = EP_POLL;
  ep_record[ INPUT_EP   ].sndToggle = bmSNDTOG0;
  ep_record[ INPUT_EP   ].rcvToggle = bmRCVTOG0;
  Usb.setDevTableEntry( ME25_ADDR, ep_record );//plug kbd.EP params to devtable
  rcode=Usb.getDevDescr(ME25_ADDR,ep_record[CONTROL_EP].epAddr,ME25_DESCR_LEN,descrBuf);
  if((descrBuf[ 8 ] != ME25_VID_LO)  || (descrBuf[ 9 ] != ME25_VID_HI) || (descrBuf[ 10 ] != ME25_PID_LO) || (descrBuf[ 11 ] != ME25_PID_HI) ){
      Serial.println("Unsupported USB Device");
      while(1); //stop
  }
  
  rcode = Usb.setConf( ME25_ADDR, ep_record[ CONTROL_EP ].epAddr, ME25_CONFIG );
  if( rcode ) {
    Serial.print("Error attempting to configure ME25. Return code :");
    Serial.println( rcode, HEX );
    while(1); //stop
  }
  Serial.println("ME25 Ready");
}

Start & Polling

MAX3421E Max;
USB Usb;

void setup() {
  Serial.begin(9600);
  Max.powerOn();
  delay(200);
}

void loop() {
  Max.Task();
  Usb.Task();
  
  //wait for addressing state
  if( Usb.getUsbTaskState() == USB_STATE_CONFIGURING ) {
    ME25_init();
    Usb.setUsbTaskState( USB_STATE_RUNNING );
  }
  
  //poll the ME25 Controller      
  if( Usb.getUsbTaskState() == USB_STATE_RUNNING ) {
    process_report();
  }
}

Function while polling

void process_report(void){
  serialOutput(msgMute, sizeof(msgMute), "msgMute"); //Returns 0's
  delay(2000);
  serialOutput(msgClean, sizeof(msgClean), "msgClean"); //Returns 0's
  while(1);
}

The actual message being sent

void serialOutput(char input[], int length, String message) {
  byte rcode = 0;
  //Serial.println(message);
  for(int i = 0; i < 10; i++){
      rcode = Usb.setReport(ME25_ADDR, 0x00, length, ME25_IF, 0x02, 0x00, input);
      Serial.print(rcode, HEX);
      delay(200);
    }
    Serial.println("");
}

The message

char msgClean[] = {
	/**HEADERS**/
	0xF0, 0x41, 0x10, 0x00, 0x00, 0x45, 0x12, 0x7F, 0x00, 0x00, 0x00, 
	
	/**STRUCTURE**/
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
	0x00, 0x6E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x63, 0x00, 0x5A, 
	0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 0x00, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20,
	0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20,
	
	/**FOOTER**/
	/*CheckSum2*/	0x7C, 
	/*Footer1*/     0xF7
};

So I started to begin to work with the new USB library. I can get some descriptions.

Start
01
--
Device descriptor: 
Descriptor Length:  12
Descriptor type:    01
USB version:        0110
Device class:       FF
Device Subclass:    00
Device Protocol:    FF
Max.packet size:    08
Vendor  ID:        0582
Product ID:     0113
Revision ID:        0100
Mfg.string index:   01
Prod.string index:  02
Serial number index:    00
Number of conf.:    01

Configuration descriptor:
Total length:       009B
Num.intf:       03
Conf.value:     01
Conf.string:        00
Attr.:          C0
Max.pwr:        00

Interface descriptor:
Intf.number:        00
Alt.:           00
Endpoints:      00
Intf. Class:        FF
Intf. Subclass:     02
Intf. Protocol:     00
Intf.string:        00

Interface descriptor:
Intf.number:        00
Alt.:           01
Endpoints:      01
Intf. Class:        FF
Intf. Subclass:     02
Intf. Protocol:     00
Intf.string:        00
Unknown descriptor:
Length:     07
Type:       24
Contents:   01010001000B24
Unknown descriptor:
Length:     0B
Type:       24
Contents:   02010203180144AC000705

Endpoint descriptor:
Endpoint address:   01
Attr.:          09
Max.pkt size:       0120
Polling interval:   01
Unknown descriptor:
Length:     07
Type:       25
Contents:   01000200020904

Interface descriptor:
Intf.number:        01
Alt.:           00
Endpoints:      00
Intf. Class:        FF
Intf. Subclass:     02
Intf. Protocol:     00
Intf.string:        00

Interface descriptor:
Intf.number:        01
Alt.:           01
Endpoints:      01
Intf. Class:        FF
Intf. Subclass:     02
Intf. Protocol:     00
Intf.string:        00
Unknown descriptor:
Length:     07
Type:       24
Contents:   01070001000B24
Unknown descriptor:
Length:     0B
Type:       24
Contents:   02010203180144AC000705

Endpoint descriptor:
Endpoint address:   82
Attr.:          05
Max.pkt size:       0120
Polling interval:   01
Unknown descriptor:
Length:     07
Type:       25
Contents:   01000000000904

Interface descriptor:
Intf.number:        02
Alt.:           00
Endpoints:      02
Intf. Class:        FF
Intf. Subclass:     03
Intf. Protocol:     00
Intf.string:        00

Endpoint descriptor:
Endpoint address:   03
Attr.:          02
Max.pkt size:       0020
Polling interval:   00

Endpoint descriptor:
Endpoint address:   84
Attr.:          02
Max.pkt size:       0020
Polling interval:   00

Interface descriptor:
Intf.number:        02
Alt.:           01
Endpoints:      02
Intf. Class:        FF
Intf. Subclass:     03
Intf. Protocol:     00
Intf.string:        00

Endpoint descriptor:
Endpoint address:   03
Attr.:          02
Max.pkt size:       0020
Polling interval:   01

Endpoint descriptor:
Endpoint address:   84
Attr.:          03
Max.pkt size:       0020
Polling interval:   01

Addr:1(0.0.1)

Does this means I don't have to connect the pin 7 to reset?