7 years, 1 month ago.

MAXREFDES100 Unable to stream ECG buffer ob HSPBLE

Hi,

I am trying to stream ECG data by passing max30001_ECG_FIFO_buffer in pollSensor in file HspBLE.cpp, please see code below

However i don't get the ECG buffer on android app side Can you help please

case CHARACTERISTIC_HEARTRATE: { int i; uint8_t *bytePtr; uint8_t data2[32]; MAX30001::max30001_t heartrateData; Peripherals::max30001()->max30001_ReadHeartrateData(&heartrateData); for(int x=0;x<32*4;x=x+4) { uint32_t value; uint8_t *result; value = Peripherals::max30001()->max30001_ECG_FIFO_buffer[x]; for (int y=0;y<4;y++) { data[x+0] = (value >> 24); data[x+1] = (value >> 16); data[x+2] = (value >> 8); data[x+3] = (value); data[x+y] = 10+x;data[x+y] * 10 ; }

}

end

bytePtr = reinterpret_cast<uint8_t *>(&heartrateData); for (i = 0; i < sizeof(MAX30001::max30001_t); i++) data[i] = bytePtr[i]; } break;

Can someone answer this question? I'm having a similar issue

posted by Aaron Silva 09 Mar 2017

1 Answer

7 years, 1 month ago.

Hi Rahul,

Going off what you did, I've tried this out:

 case CHARACTERISTIC_ECG: {
  	int i;
    uint8_t *bytePtr;
    uint32_t *ecgArray;
    MAX30001::max30001_ecg ecgData;
    Peripherals::max30001()->max30001_ReadECGData(&ecgData);
    if (Peripherals::max30001()->max30001_status.bit.eint == 1 || Peripherals::max30001()->max30001_status.bit.pint == 1) {      
      if(ecgData.etag == 0b000 && ecgData.etag == 0b010){
        bytePtr = reinterpret_cast<uint8_t *>(&Peripherals::max30001()->max30001_ECG_FIFO_buffer);
        for (i = 0; i < sizeof(Peripherals::max30001()->max30001_ECG_FIFO_buffer); i++)
          data[i] = bytePtr[i];
      }
    }
  	}break;

then within the tick handler:

  uint8_t data[128];
  if (bluetoothLE->isConnected()) {
    pollSensor(CHARACTERISTIC_ECG, data);
    for(int i = 0; i < 8; i++){
      uint8_t tempData[16];
      for(int j = 0; j < 16; j++){
        tempData[j] = data[(i*16)+j];
      }
      bluetoothLE->notifyCharacteristic(CHARACTERISTIC_ECG, tempData);
    }

The data that I'm seeing however is a bit nonsensical. If you find anything out let me know

Hello Aaron,

May be because BLE packet is 20 bytes and we are sending 32 bytes so some info is getting lost

I have not been able to solve this problem till now

Thanks

posted by Rahul Rastogi 15 Mar 2017

@Rahul, have you been able to get consistent data? For us, we're getting the correct ECG data now, but it is only sending data over bluetooth for a short period of time.

posted by Aaron Silva 23 Mar 2017

@Aaron - Its great that you have solved it. Can you please share the edited code at rahul.amu2@gmail.com, as I have still not been able to do that As far as short Bluetooth connection is concerned, it may be related to the way data is being sent over Bluetooth. Thanks

posted by Rahul Rastogi 20 May 2017