USB Connection , API problems

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

USB Connection , API problems

899 Views
BetoGreen
Contributor III

Hi

I need someone to steer me in the right direction with a MIDI usb device I am developing using the USB API's on LPC51u68.

 

I have set up the USB API handlers with the code below and they return ret == LPC_OK.

/* register ISO OUT endpoint interrupt handler */
ep_index = ((MIDI_EP_OUT & 0x0F) << 1);

ret = USBD_API->core->RegisterEpHandler(hUsb, ep_index, MIDI_bulk_out_hdlr, in_buff);

ep_index = (((MIDI_EP_IN & 0x0F) << 1)+1);

ret = USBD_API->core->RegisterEpHandler(hUsb, ep_index, MIDI_bulk_in_hdlr, out_buff);

So my USB initializes OK but at the end after it initializes with PC , I get a URB_BULK_IN message to my EP from the host but it does not seem to fire the MIDI_bulk_in_hdlr() I setup?   

I am trying to use MIDI_bulk_in_hdlr()  to set CONNECTED=true so I can transmit out.

Currently I am sending messages out before the link is truly connected so it crashes the CPU sometimes when I do a

ret = USBD_API->hw->WriteEP at the wrong time.

Somehow I am missing something here about when and from what data to set my CONNECTED flag....

 

Thanks

 

 

 

 

 

 

0 Kudos
1 Reply

867 Views
FelipeGarcia
NXP Employee
NXP Employee

Hi,

Are you using one of our SDK examples as reference? Unfortunately, we do not have a MIDI example that you can use directly. However, there are some customers that have implemented MIDI device class using our MCUXpresso SDK software as you can see in the link below. Maybe this can be helpful.

Solved: (SDK) usb MIDI device? - NXP Community

If not, please describe the steps you are doing on your side and how can we replicate your issue so we can help you further.

Best regards,

Felipe

0 Kudos