AnsweredAssumed Answered

Communicating with BlueNRG-MS after waking up the SPI Master (Application Processor)

Question asked by Muhammad Waseem Abbas on Apr 25, 2017
Latest reply on Apr 26, 2017 by Antonio Vilei

Hi All,

 

I am running BLE peripheral profile application on Mentor Graphics' Nucleus RTOS using STM32 MCU interfaced with BlueNRG-MS module. The application runs successfully and I can connect to the heart rate monitor profile using Android app by ST named "STM32 BLE Profiles". One of our requirements is that the BLE module should keep on advertising after we disconnect from it and we shutdown the MCU (Application Processor) and then we should be able to connect to it after MCU shutdown and it should wake up the MCU and start communicating with it normally. We are using SPI_IRQ line of BlueNRG-MS to send the wake up signal to MCU. As the profile has already been initialized on BlueNRG-MS before MCU went to shutdown state, we do not re-initialize the profile on BlueNRG-MS and only local objects used by the application are initialized again after MCU wake-up. The Android app connects to the BLE successfully and BueNRG-MS wakes up the MCU via SPI_IRQ pin. We set the device state in our application as APPL_CONNECTED and then we execute the main application process given in the source code by ST shown below:

 

/* Start the main processes */
while(1){
HCI_Process();
profileApplContext.profileStateMachineFunc();
if (Profile_Process_Q() == 0x00)
{
      if (low_power_enabled)
      {
                if (profileApplContext.profileApplicationProcessFunc() != 0) {
                        LPM_Mode_Request(eLPM_MAIN_LOOP_PROCESSES, eLPM_Mode_RUN);
                 }

                 else{
                         LPM_Mode_Request(eLPM_MAIN_LOOP_PROCESSES, eLPM_Mode_LP_Stop);
                 }
      }
      else
      {
            profileApplContext.profileApplicationProcessFunc();
      }
}
LPM_Enter_Mode();
} /* end while(1) */

 

When we execute this loop, the function Profile_Process_Q() returns 0x00 in the first iteration but in all other iterations it returns 0x01 and prints below message on the console:

"Error While Initializing main profile."

Due to this it cannot call the profile application process function pointed to by "profileApplContext.profileApplicationProcessFunc()". 

We do not know in detail what this Profile_Process_Q() function is doing as it has been provided in binary form and very little information is given about it in the documentation. 

 

We have also tried to skip its call after the first iteration of while loop using control statement and calling profile application process function forcefully but when we try to write the heart rate value using "HRProfile_Send_HRM_Value(tHeartRateMeasure heartRateVal)" function in HR_Application_Process(), it returns 0x41 and we don't see any data on Android app. 

 

It would be helpful if someone can provide information on what exactly the Profile_Process_Q() function is doing and any other insight that might help in this regard.

Outcomes