cancel
Showing results for 
Search instead for 
Did you mean: 

St ble NRG2 (BLUENRG-M2SP) : reading the characteristic issue : hi Every one i using BLUENRG-M2SP chip , i using st ble sensor app to communicate the chip , the problem statement , AS below

mkuma.1
Associate II

1. if i read and write  characteristic in the service  its working fine

  1. if write one characteristic and read on other characteristic of same service , its not working . after that its not able to reconnect , during this scenario i need to restart ble chip , can you any one please help me out to solve the issue .
  2. if any flow diagram or any command sequence in this situation , can you share us .

Regards

Manukumar

11 REPLIES 11
Winfred LU
ST Employee

BLE Sensor Demo project was tested? I am not aware of a command sequence for this demo.

I tested BLE Sensor Demo project , To test Demo project i Used STEVAL -IDB008V1M board (BLUE NRG2M2SA) chip its working fine, but in our custom board we are using blue NRG2 M2SP chip , here facing above issue

here i using following command Sequence

void Read_Request_CB(uint16_t handle)

{

 if(handle == (Unithandle + 0x100))

 {

  

   

  BLE_LOAD_WIND_UNIT_READ('A');

  

 }

 if((connection_handle !=0) )

 {

    __asm nop;__asm nop;__asm nop;

   __asm nop;__asm nop;__asm nop;

   __asm nop;__asm nop;__asm nop;

  ret = aci_gatt_allow_read(connection_handle);

  if (ret != BLE_STATUS_SUCCESS)

  {

   __asm nop;__asm nop;__asm nop;

   __asm nop;__asm nop;__asm nop;

   __asm nop;__asm nop;__asm nop;

   __asm nop;__asm nop;__asm nop;

  }

   

   

 }

void Attribute_Modified_CB(uint16_t handle, uint8_t data_length, uint8_t *att_data)

{

 unsigned int i=0;

 if(handle == Unithandle + 0x100)

 {

  for(i = 0; i < GS820_LOAD_WIND_UNIT_CHAR_LENGTH_READ_WRITE; i++)

  {

  Data_Recived_Mobile_App[i]= *att_data;

  ++att_data;

  }}

}

tBleStatus BLE_LOAD_WIND_UNIT_READ( unsigned char Index)

{

   tBleStatus ret;

   

    Gs820Unit_Charcterstic();

   

   

   ret = aci_gatt_update_char_value_ext(connection_handle, ConfigSerhandle, Unithandle, 1, GS820_LOAD_WIND_UNIT_CHAR_LENGTH_READ_WRITE, 0, GS820_LOAD_WIND_UNIT_CHAR_LENGTH_READ_WRITE,(uint8_t*)&Gprotocol_Read_Buff[0]);

    if (ret != BLE_STATUS_SUCCESS)

 {

  //PRINTF("Error while updating Humidity characteristic.\n") ;

  return BLE_STATUS_ERROR ;

 }

 return BLE_STATUS_SUCCESS;

}

}

void aci_gatt_read_permit_req_event(uint16_t Connection_Handle,

                  uint16_t Attribute_Handle,

                  uint16_t Offset)

{

 Read_Request_CB(Attribute_Handle);   

}

 void aci_gatt_attribute_modified_event(uint16_t Connection_Handle,

                    uint16_t Attr_Handle,

                    uint16_t Offset,

                    uint16_t Attr_Data_Length,

                    uint8_t Attr_Data[])

{

 Attribute_Modified_CB(Attr_Handle, Attr_Data_Length, Attr_Data);    

Please try to start with the differences between STEVAL -IDB008V1M and the custom board, both hardware and software.

mkuma.1
Associate II

Hi Winfred

i verified both hardware and software its same . Can you please Share the any documents , its give the information on ble Diagnostic check (like if Error command Sent in between ble communication , how ble Behaviour and how we can bring the normal State , or if we missed any command how we can retry ) . its help me lot to resolve this issue , or if any link its give information on above problem .

Regards

Manukumar

Winfred LU
ST Employee

>i verified both hardware and software its same

OK then, maybe the procedures or environment of testing were different?

Documents for ACIs (including ACI commands and events) can be found under BlueNRG GUI folder, by default at

C:\Users\<user id>\ST\BlueNRG GUI 4.0.0\Docs\gui_aci_html\bluenrg_1_v2_x.html

PM0257 BlueNRG-1, BlueNRG-2 BLE stack v2.x programming guidelines

would also be a good reference

mkuma.1
Associate II

hi Winfred i found the issue , the issue lied on below st library function i.e list .c

int list_get_size (tListNode * listHead)

{

 int size = 0;

 tListNode * temp = listHead->next;

 while (temp != listHead)

 {

  size++;

  temp = temp->next;

 }

 return (size);

in this case software is hanging , its not coming out of loop , in this case , i check if uart line receive any junk data , its also not receive any junk data . if you have any suggestion on this .

You'll need to figure out why the linked list is broken or circular.

Check you have heap space, and check list integrity periodically to narrow down when failure occurs.

Check if you have thread safe implementation, and that use in interrupts or callbacks creates race conditions.​

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

Thanks for clive1's helpful comments.

Since you have found the point it hanged, it shall be relatively simple to trace back to the error.

It did not come out the loop --> this means there should be an unexpected inner loop in the linked list

Please check when both insertion and deletion on the list.

Please also check the thread safe when accessing the list.

Note that list.c is not compiled and linked in the Sensor Demo project.

Below would be the file list of the project for information:

  <group>
    <name>HAL</name>
    <file>
      <name>$PROJ_DIR$\..\..\..\..\..\Library\hal\src\clock.c</name>
    </file>
    <file>
      <name>$PROJ_DIR$\..\..\..\..\..\Library\hal\src\context_switch.s</name>
    </file>
    <file>
      <name>$PROJ_DIR$\..\..\..\..\..\Library\hal\src\miscutil.c</name>
    </file>
    <file>
      <name>$PROJ_DIR$\..\..\..\..\..\Library\hal\src\osal.c</name>
    </file>
    <file>
      <name>$PROJ_DIR$\..\..\..\..\..\Library\hal\src\sleep.c</name>
    </file>
  </group>
  <group>
    <name>Library</name>
    <file>
      <name>$PROJ_DIR$\..\..\..\..\..\Library\BlueNRG1_Periph_Driver\src\BlueNRG1_adc.c</name>
    </file>
    <file>
      <name>$PROJ_DIR$\..\..\..\..\..\Library\BlueNRG1_Periph_Driver\src\BlueNRG1_dma.c</name>
    </file>
    <file>
      <name>$PROJ_DIR$\..\..\..\..\..\Library\BlueNRG1_Periph_Driver\src\BlueNRG1_flash.c</name>
    </file>
    <file>
      <name>$PROJ_DIR$\..\..\..\..\..\Library\BlueNRG1_Periph_Driver\src\BlueNRG1_gpio.c</name>
    </file>
    <file>
      <name>$PROJ_DIR$\..\..\..\..\..\Library\BlueNRG1_Periph_Driver\src\BlueNRG1_i2c.c</name>
    </file>
    <file>
      <name>$PROJ_DIR$\..\..\..\..\..\Library\BlueNRG1_Periph_Driver\src\BlueNRG1_mft.c</name>
    </file>
    <file>
      <name>$PROJ_DIR$\..\..\..\..\..\Library\BlueNRG1_Periph_Driver\src\BlueNRG1_pka.c</name>
    </file>
    <file>
      <name>$PROJ_DIR$\..\..\..\..\..\Library\BlueNRG1_Periph_Driver\src\BlueNRG1_rtc.c</name>
    </file>
    <file>
      <name>$PROJ_DIR$\..\..\..\..\..\Library\BlueNRG1_Periph_Driver\src\BlueNRG1_spi.c</name>
    </file>
    <file>
      <name>$PROJ_DIR$\..\..\..\..\..\Library\BlueNRG1_Periph_Driver\src\BlueNRG1_sysCtrl.c</name>
    </file>
    <file>
      <name>$PROJ_DIR$\..\..\..\..\..\Library\BlueNRG1_Periph_Driver\src\BlueNRG1_uart.c</name>
    </file>
    <file>
      <name>$PROJ_DIR$\..\..\..\..\..\Library\BlueNRG1_Periph_Driver\src\BlueNRG1_wdg.c</name>
    </file>
    <file>
      <name>$PROJ_DIR$\..\..\..\..\..\Library\BlueNRG1_Periph_Driver\src\misc.c</name>
    </file>
  </group>
  <group>
    <name>OTA</name>
    <excluded>
      <configuration>Release</configuration>
    </excluded>
    <file>
      <name>$PROJ_DIR$\..\..\..\..\..\Library\BLE_Application\OTA\src\OTA_btl.c</name>
    </file>
  </group>
  <group>
    <name>Platform_Layers</name>
    <file>
      <name>$PROJ_DIR$\..\..\..\..\..\Library\SDK_Eval_BlueNRG1\src\LPS25HB.c</name>
    </file>
    <file>
      <name>$PROJ_DIR$\..\..\..\..\..\Library\SDK_Eval_BlueNRG1\src\LSM6DS3.c</name>
    </file>
    <file>
      <name>$PROJ_DIR$\..\..\..\..\..\Library\SDK_Eval_BlueNRG1\src\SDK_EVAL_Button.c</name>
    </file>
    <file>
      <name>$PROJ_DIR$\..\..\..\..\..\Library\SDK_Eval_BlueNRG1\src\SDK_EVAL_Com.c</name>
    </file>
    <file>
      <name>$PROJ_DIR$\..\..\..\..\..\Library\SDK_Eval_BlueNRG1\src\SDK_EVAL_Config.c</name>
    </file>
    <file>
      <name>$PROJ_DIR$\..\..\..\..\..\Library\SDK_Eval_BlueNRG1\src\SDK_EVAL_I2C.c</name>
    </file>
    <file>
      <name>$PROJ_DIR$\..\..\..\..\..\Library\SDK_Eval_BlueNRG1\src\SDK_EVAL_Led.c</name>
    </file>
    <file>
      <name>$PROJ_DIR$\..\..\..\..\..\Library\SDK_Eval_BlueNRG1\src\SDK_EVAL_SPI.c</name>
    </file>
  </group>
  <group>
    <name>Stack</name>
    <file>
      <name>$PROJ_DIR$\..\..\..\..\..\Library\Bluetooth_LE\library\libbluenrg1_stack.a</name>
    </file>
    <file>
      <name>$PROJ_DIR$\..\..\..\..\..\Library\cryptolib\libcrypto.a</name>
    </file>
    <file>
      <name>$PROJ_DIR$\..\..\..\..\..\Library\Bluetooth_LE\src\stack_user_cfg.c</name>
    </file>
  </group>
  <group>
    <name>Startup</name>
    <file>
      <name>$PROJ_DIR$\..\..\..\..\..\Library\CMSIS\Device\ST\BlueNRG1\Source\system_bluenrg1.c</name>
    </file>
  </group>
  <group>
    <name>User</name>
    <file>
      <name>$PROJ_DIR$\..\..\src\BlueNRG1_it.c</name>
    </file>
    <file>
      <name>$PROJ_DIR$\..\..\src\gatt_db.c</name>
    </file>
    <file>
      <name>$PROJ_DIR$\..\..\src\sensor.c</name>
    </file>
    <file>
      <name>$PROJ_DIR$\..\..\src\SensorDemo_main.c</name>
    </file>
  </group>