Skip to main content
Visitor II
July 15, 2025
Question

BLE + Vibration Detection

  • July 15, 2025
  • 4 replies
  • 764 views

I am trying to build a project to detect vibration using STEVAL PROTEUS 1 (STM32WB5MMG, ISM330DHCX and BLE SENSOR). Unfortunately my sensor and BLE does not initialize despite 0 errors.

I have used custom BLE Template. I have initialized sensor code in custom_app.c. 

My inference:

Below is the main.c function 

MX_APPE_Init();

 Custom_APP_Init();//

//  UTIL_SEQ_RegTask(1 << CFG_TASK_BLINK_LED_ID,

while (1)

{

   /* USER CODE END WHILE */

MX_APPE_Process();

   /* USER CODE BEGIN 3 */

// HAL_GPIO_TogglePin(GPIOD, GPIO_PIN_2);

HAL_GPIO_WritePin(GPIOD, GPIO_PIN_2, SET);

HAL_Delay(100);

HAL_GPIO_WritePin(GPIOD, GPIO_PIN_2, RESET);

HAL_Delay(100);

}

/* USER CODE END 3 */

}

Here, the code works when I comment out MX_APP_Init() and MX_APPE_process() and i can see the LED toggle, LED constantly stays ON when I only comment out MX_App_Process() but that is not the dfesired outcome i want. I want my code to help me log vibration data via BLE, it is not happening since both BLE and Accelerometer are not working.

    This topic has been closed for replies.

    4 replies

    ST Employee
    July 17, 2025

    Hello,

    in the main while loop, there should be only MX_APPE_Process() function for running the sequencer.

    Please visit this topic below as it might be helpful for your application.

    Sending sensor data via BLE - STMicroelectronics Community

    Could you please provide more information what exactly doesn't work in your project?

    Are you able to read any data from the sensors? (simple reading data app without STM32WPAN)

    Is the code stuck anywhere? Can you please try to debug the project?

    Thank you.

    Best regards,

    Filip Kremen

    RB4Author
    Visitor II
    July 17, 2025

    I am able to read data from sensor without any BLE connection (STM32WPAN).

    But when I try to implement BLE with Sensor Logic I am unable to make a working vibration detection project.

    Board is not visible on sensor app and the led is supposed to initialize when sensor turns on , that is not happening either.

     

    ST Employee
    July 17, 2025

    I think root of the problem is that BLE isn't properly initialized yet.

    Firstly, function APP_BLE_Init() must be called before adding any services or characteristics.

    You have to wait for the SHCI_SUB_EVT_CODE_READY event to be able to work with BLE stack.

    Please read the document below for more information.

    How to build wireless applications with STM32WB MCUs - Application note

    If you need further help, please don't hesitate to ask.

    Best regards,

    Filip Kremen

     

    RB4Author
    Visitor II
    July 18, 2025

    Hey, I tried out this approach but it is throwing multiple errors and upon resolving them, I am still unable to connect to bluetooth.

    ST Employee
    July 18, 2025

    Hello,

    can you please describe the errors more in detail?

    Also, could you please send me the modified project again?

    Thank you.

    Best regards,

    Filip Kremen