2020-12-23 05:29 PM
So, for a project, I needed a CDC and MIDI composite device. So after some research and learning, I based my code around the CubeMX generated CDC example.
I then modified the descriptors accordingly, created functions for transmitting and receiving on those specific EPs, and life was good. Until I ran into an issue where if I attempted to transmit more than 6 MIDI messages (4 bytes each), it would transmit garbage, and then all future transmissions on that EP were also garbage.
After some digging, I realized that I never configured the PMA for my IN/OUT endpoints for the MIDI interface (I'm using 0x83 and 0x3).
So I'm unsure of why it was working with small data packets in the first place, and also how to get it working. I've done a lot of digging and trawling through the reference manuals for the STM32G4 and can't quite wrap my head around why it's not working. I tried configuring the PMA address's based on the existing offsets, but now it doesn't work even with low data quantities.
#define MIDI_IN_EP 0x83U // EP1 for data IN
#define MIDI_OUT_EP 0x03U // EP2 for data OUT
.
.
.
HAL_PCDEx_PMAConfig((PCD_HandleTypeDef*)pdev->pData , MIDI_IN_EP , PCD_SNG_BUF, 0xc0);
HAL_PCDEx_PMAConfig((PCD_HandleTypeDef*)pdev->pData , MIDI_OUT_EP , PCD_SNG_BUF, 0x190);
Can someone help me out with what I'm missing?
2020-12-23 10:49 PM
Hello,
Did you set hardware fifo for new EPs? (In function "USBD_LL_Init", by using "HAL_PCDEx_SetTxFiFo")
2020-12-24 12:04 AM
I was under the impression that this part uses the PMA as the buffer rather than a FiFo buffer. None of the other endpoints generated by CubeMX have FiFo configuration calls.
2020-12-28 12:48 PM
Anyone have any other thoughts? There's no SetTxFiFo call found in the LL_Init function for the CubeMX generated Endpoints. Only PMA