Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
7 years, 8 months 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;
1 Answer
7 years, 8 months 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 15 Mar 2017
Can someone answer this question? I'm having a similar issue
posted by Aaron Silva 09 Mar 2017