PDA

View Full Version : Sample code for USB - MIDI



RuudNL
- 4th November 2020, 11:37
Is there any sample code available to have a PIC18F4550 recognized by the PC as an (USB) MIDI device?
(And yes, I know it is mainly finding the correct device descriptor...)
I have been struggling with this problem for a long time, but unfortunately without success.
In principle, I am mostly interested in communication FROM the PC TO the 18F4550.
It is driving me crazy... Tried almost everything, but I can't get it working!
So I hope one of the clever people here can steer me in the right direction!

RuudNL
- 5th November 2020, 14:29
Nobody knows? Too difficult?

CuriousOne
- 9th November 2020, 12:36
Activity goes down and down here.....

Jerson
- 9th November 2020, 13:13
have you tried the Windows based HID descriptor tool application? It contains some sample descriptors which can help you get started. I have not checked if it has a MIDI descriptor.

I found a thread which may help you

https://www.microchip.com/forums/m297214.aspx

towlerg
- 9th November 2020, 13:18
The problem with finding descriptors for other format compilers is trying to convert them. Have you looked at other PIC device Basic compilers, perhaps with a similar format?

towlerg
- 9th November 2020, 14:17
Don't seem to be able to edit my previous - should read "perhaps with a similar descriptor format?"

Jerson
- 9th November 2020, 14:36
Since you're looking for plain communication with the PC via USB, I can suggest you look up the USB CDC descriptor. This will turn your PIC into a USB comm port visible to your PC. You then just communicate with that comm port.

towlerg
- 10th November 2020, 12:54
I see you're a subermod but I don't see how running a USB capable PIC device as CDC help the op problem.

Jerson
- 10th November 2020, 14:28
I see you're a subermod but I don't see how running a USB capable PIC device as CDC help the op problem.

You probably didn't see this in the OM. Moreover, I wonder what being supermod got to do with helping someone


In principle, I am mostly interested in communication FROM the PC TO the 18F4550.
It is driving me crazy... Tried almost everything, but I can't get it working!

RuudNL
- 10th November 2020, 18:32
OK, let's forget this all and use a dedicated USB to MIDI chip...

towlerg
- 11th November 2020, 16:09
"You probably didn't see this in the OM." I did not. Mea culpa

mpgmike
- 20th November 2020, 05:35
Most of the USB code floating around is based on the HID class. However, if you download the current Microchip Libraries for Applications (MLA) (https://www.microchip.com/mplab/microchip-libraries-for-applications/mla-legacy), and go to:

mla/v2018_11_26/apps/device/audio_midi

there are examples for numerous PIC devices. Of course, it will be written in C, and will have to be opened in MPLABX. That's about as much help as I can offer.