cancel
Showing results for 
Search instead for 
Did you mean: 

Problems using USB mass storage middleware with BLE stack on STM32WB55?

crwper
Senior

I'm developing an application which uses both USB mass storage and BLE. I've started by building two separate applications using STM32CubeMX:

  • A USB mass storage application communicating with a microSD card over SPI1
  • A BLE P2P server

Both of these work fine on their own. But if I build an application that includes both components, the USB mass storage device will not enumerate properly.

Initially, I discovered that in the full application, HAL_PCD_IRQHandler got called, but it never fell through to PCD_EP_ISR_Handler. This makes me think the mass storage endpoints have not been configured properly.

I've also tackled the problem a different way--by systematically eliminating parts of the BLE initialization to determine what is interfering with USB mass storage. Using this method, I've been able to determine that if I comment out the call to SHCI_C2_BLE_Init in APP_BLE_Init (in app_ble.c), USB mass storage enumerates properly. If I then uncomment this line, it stops working again.

SHCI_C2_BLE_Init simply sends a message to CPU telling it to start the BLE stack, so this makes me think that the BLE stack on CPU2 is somehow interfering with USB endpoints configured before the call to APPE_Init in main.c.

I believe USB is a shared resource between CPU1 and CPU2, so it seems likely that the BLE stack is also trying to do something with USB. However, I'm at a loss as to how to debug this further or how to avoid the problem.

Any help would be greatly appreciated!

Michael

22 REPLIES 22

Hello,

Thank you so much for this! I have had already done the MOOC, and I would say that I understand most of it. Now I managed to make the sensors work and to transmit them to the ST BLE Sensor app. However I can only have one screen active at a time. So for instance I can either have the temperature or humidity transmitted at a time, but not both at the same time.

I have created a custom template for both of them, and as I said separately they work fine, however I can't figure out how to have both of them at the same time.

Each template has its own UUID, specific to temperature and humidity, however I don't really understand this portion of the code:

/**
 * Advertising Data
 */
#if (P2P_SERVER1 != 0)
static const char local_name[] = { AD_TYPE_COMPLETE_LOCAL_NAME ,'T','R','Y','P','I'};
uint8_t manuf_data[14] = {
    sizeof(manuf_data)-1, AD_TYPE_MANUFACTURER_SPECIFIC_DATA, 
    0x01/*SKD version */,
    CFG_DEV_ID_P2P_SERVER1 /* STM32WB - P2P Server 1*/,
    0x00 /* GROUP A Feature  */,
    0x04 /* GROUP A Feature */, //0x00040000
    0x00 /* GROUP B Feature */,
    0x00 /* GROUP B Feature */,
    0x00, /* BLE MAC start -MSB */
    0x00,
    0x00,
    0x00,
    0x00,
    0x00, /* BLE MAC stop */
};
#endif
/**

My transmission works only when I change the mask to 0x00040000 for temperature (the temperature screen in the app and the transmission work fine) or when I change it to 0x00080000 for humidity. How would I manage to have both of them at the same time?

I read the documents that you have sent in their entirety, also I checked the example apps, but I can't seem to figure it out.

Thank you,

Bogdan

Edit: I forgot to mention that this portion of the code is from app_ble.c

Hi Bogdan--

I'm afraid this is getting out of my area of expertise (such as it is). It might be worth posting this as a separate question in the forum.

Michael

INSANE!

I am on this problem since last week. A big up to you my friend!

Now it works!