fbpx
Skip to main content

MIDI Forum

Debugging MIDI on t...
 
Notifications
Clear all

Debugging MIDI on the Mac ( OSX )

12 Posts
2 Users
0 Reactions
10.6 K Views
Keith Sloan
Posts: 7
Active Member
Topic starter
 

I am trying to program a program a Microchip Curiosity MX470 board to behave as a MIDI USB Keyboard.

I have basically followed the setup as per http://www.microchip.com/forums/m914640.aspx.

After much debugging I believe I am send NoteOn and NoteOff packets to the USB Endpoint.
My NoteOn packet is 0x19901F17 and NoteOff 0x18801F0. But when I start up Garageband on the Mac
and open a track with a software instrument I get no sound.

If I try the application MIDI monitor then if I plug or unplug the USB cable or reset the PIC micro.
I get a "To MIDI monitor" SysEx message F0 7E 00 06 01 F7

If I use About this Mac to look at the USB it lists it as a Composite Device with product ID 0x0059 and vendor 0x04db the same as the values in the code for the PIC.

 
Posted : 22/11/2016 9:08 am
Clemens Ladisch
Posts: 323
Reputable Member
 

Does "send" mean from the device to the host, or from the host to the device?

Why do you write you "believe" it is sending? Do you have any evidence for that?

Does the MIDI monitor work with a 'real' USB MIDI device?

 
Posted : 23/11/2016 12:05 am
Keith Sloan
Posts: 7
Active Member
Topic starter
 

Does "send" mean from the device to the host, or from the host to the device?

Send from device to host. Host being the Mac.

Why do you write you "believe" it is sending? Do you have any evidence for that?

Well the code writes to the Endpoint with a USB_DEVICE_EndpointWrite request - return code good and the USB event handler
sees the subsequent USB_DEVICE_EVENT_ENDPOINT_WRITE_COMPLETE event

Does the MIDI monitor work with a 'real' USB MIDI device?

Don't have access to a real USB MIDI device, but if I use an Arduino to send to the serial port and
run Hairless-midiserial on the Mac then MIDI monitor works and shows the noteon requests arriving on the Mac

 
Posted : 23/11/2016 2:05 am
Clemens Ladisch
Posts: 323
Reputable Member
 

Everything sounds as if you're using the MIDI monitor correctly.

The problem is probably with your firmware. In theory, outputting USB-MIDI event packets should work exactly the same as outputting data from a CDC device. But you should ask somebody who knows about the Microchip USB stack.

 
Posted : 24/11/2016 2:04 am
Keith Sloan
Posts: 7
Active Member
Topic starter
 

Okay I made some progress by connecting to a Windows 7 machine. I had to change some things to get Windows to be happy with enumeration. If I use MIDI-OX on the windows machine then I am able to send a "note on" to the PIC. But I am not having any luck the other way. If I send from the PIC 0x0FF8487C I do get F8 time clock messages in MIDI-OX but no channel info or Data values. If I try and send 0x0990487C I do not get anything turn up in MIDI-OX input window.

 
Posted : 01/12/2016 6:29 am
Keith Sloan
Posts: 7
Active Member
Topic starter
 

Okay I have borrowed my daughters MIDI keyboard and there seems to be an exchange of SysEX messages before being able to send Note On's. But the exchange is not the same on a real keyboard as my PIC device. The real keyboard seems to receive according to MIDI Monitor F0 7E 00 06 01 F7 but my PIC device get 0x06F0F700 and nothing shows in MIDI Monitor where can I find out more info on these initial SysEx exchanges?

 
Posted : 02/12/2016 7:34 am
Keith Sloan
Posts: 7
Active Member
Topic starter
 

If I look at "Audio MIDI Setup" and Window Show MIDI Studio on the Mac for a working MIDI keyboard I see 3 ports 2 with MIDI in and 3 with MIDI out. With my PIC32 device connected I don't see any ports. Am at a loss of how to define ports to the PIC device

 
Posted : 02/12/2016 1:32 pm
Clemens Ladisch
Posts: 323
Reputable Member
 

"F0 7E 00 06 01 F7" is a Device Inquiry message (with a device ID that is unlikely to be correct ). You can ignore it.

06 F0 F7 corresponds to the SysEx message "F0 F7", which is empty and does not make sense. If this is indeed the message you're getting (check that you handle multiple USB packets and multiple USB-MIDI event packets correctly), then this looks like a bug in the USB MIDI driver.

Ports are defined in the descriptors.

 
Posted : 03/12/2016 3:28 am
Keith Sloan
Posts: 7
Active Member
Topic starter
 

My descriptors are setup as per Appendix B of the MIDI 1.0 specification document. Don't understand why the Mac see's no Ports

 
Posted : 03/12/2016 11:41 am
Clemens Ladisch
Posts: 323
Reputable Member
 

I cannot see your code. And there would be better debugging mechanisms on a Linux host.

 
Posted : 04/12/2016 6:54 am
Keith Sloan
Posts: 7
Active Member
Topic starter
 

Code is the same as on this web page http://www.microchip.com/forums/m914640.aspx.

 
Posted : 05/12/2016 10:20 am
Clemens Ladisch
Posts: 323
Reputable Member
 

Those descriptors look OK (but you can check with "lsusb -v" on a Linux host if they are enumerated correctly).

If there were not any ports, then you would not be able to see anything in the MIDI monitor.

 
Posted : 06/12/2016 4:58 am
Share: