Making Heart Rate ADC values being advertised

⚠️
Hi there.. thanks for coming to the forums. Exciting news! we’re now in the process of moving to our new forum platform that will offer better functionality and is contained within the main Dialog website. All posts and accounts have been migrated. We’re now accepting traffic on the new forum only - please POST any new threads at//www.xmece.com/support. We’ll be fixing bugs / optimising the searching and tagging over the coming days.
13 posts / 0 new
Last post
herochua617
Offline
Last seen:3 years 11 months ago
Joined:2017-01-18 12:46
Making Heart Rate ADC values being advertised

Hi there,

Referring to the previous link (https://support.dialog-semiconductor.com/forums/post/dialog-smartbond-bl...) that I've commented. I do not know how to make this thing work. I have already tried this function in custom profile of SDK 5 and I am able to get the adc data from the heart rate module. So now I want to implement this function to the heart rate profile in SDK 3 but it seems that I do not know where to place this function in order to make it working. I have already include the adc header files. (attachment 7). I want the heart rate values to be notified in terms of bpm unit in the profile. Thanks.

Attachment:
Device:
herochua617
Offline
Last seen:3 years 11 months ago
Joined:2017-01-18 12:46
请您看一看

请您看一看updated attachment instead. Thanks

Attachment:
MT_dialog
Offline
Last seen:2 months 4 weeks ago
Staff
Joined:2015-06-08 11:34
Hi herochua617,

Hi herochua617,

About which function you are talking about ? i dont see any function name in the attachment that you have uploaded, as i ve mentioned a previous post please have a look at the RW BLE Heart Rate Profile (HRP) Interface specification in order to check the message that you need to exchange with the profile in order to communication with the HRP profile module.

Thanks MT_dialog

herochua617
Offline
Last seen:3 years 11 months ago
Joined:2017-01-18 12:46
Hi there,

Hi there,

I have searched the documents RW-BLE-HRP-IS but it looks very surface. It does not show where I need to put my adc coding in order for me to get the data.

uint8_t heart_rate, sample, sample2;

adc_init (GP_ADC_SE, 0, GP_ADC_ATTN3X);
adc_enable_channel (ADC_CHANNEL_P01);
sample = adc_get_sample ();

adc_init (GP_ADC_SE, GP_ADC_SIGN, GP_ADC_ATTN3X);
adc_enable_channel (ADC_CHANNEL_P01);
sample2 = adc_get_sample ();

heart_rate = (sample + sample2);
heart_rate = heart_rate/2;

app_heart_rate_set_value(heart_rate)

this is the adc function I have been talking about and i fed the output of the adc to app_heart_set_value which is one of the function in app_hrps.c. Refer to Attachment 8. Thanks

Attachment:
MT_dialog
Offline
Last seen:2 months 4 weeks ago
Staff
Joined:2015-06-08 11:34
Hi herochua617,

Hi herochua617,

文档资料的信息解释道e exposes in order for you to use it, where you are going to perform the measurement from the sensor it depends on your application. So the document mentions a message called HRPS_MEAS_SEND_REQ, this is what should be invoked in order to send notifications to the other side of the central (the notifications will reach the other side as long as you have enabled the notification from the central side). So you can trigger that message via a timer and perform the adc measurement as soon as the message is served, get the value from the adc, pack the value in the message and send the message to the profile. Something like you have allready done. How to trigger the function that depends as i ve mentioned on your application, it could be upon connection, or when the central writes the specified CCC of the heart rate profile in order to enable the notifications, you can catch that event in the gattc_write_cmd_ind_handler() in the hrps_task.c file.

Thanks MT_dialog

herochua617
Offline
Last seen:3 years 11 months ago
Joined:2017-01-18 12:46
Hi,

Hi,

I have called the function in gattc_write_cmd_ind_handler. But the values are not updating. I need to turn off and on the notifications to get the value. By the way, the values should not be so high because I did not stick the electrodes on my body. Please refer to attachment 9. Thank you very much!

Attachment:
MT_dialog
Offline
Last seen:2 months 4 weeks ago
Staff
Joined:2015-06-08 11:34
Hi herochua617,

Hi herochua617,

You will have to turn the notifications on in order to trigger the gattc_write_cmd_ind_handler() and in order for the timer to be triggered, also where you have placed the function whenever the gattc_write_cmd_ind_handler() regardless which characteristic is writen the timer will get activated, the point was to have the timer counting as soon as you write the CCC characteristic, please try to read and understand the code. the regarding the values that you get, i am not able to assume why they are high (this is something that you have to find out via debugging), i would suggest to send dummy data until you can verify that you can send data properly.

Thanks MT_dialog

herochua617
Offline
Last seen:3 years 11 months ago
Joined:2017-01-18 12:46
Hi there,

Hi there,

I would like to ask, the app_timer_set is unlike app_easy_timer. Can I able to use app_timer_set to call back function just like app_easy_timer?

herochua617
Offline
Last seen:3 years 11 months ago
Joined:2017-01-18 12:46
Hi there,

Hi there,

I have been trying to understand the coding and tried to change the placement of the timer function. I want to have a real time data on my smartphone which means once the notifications is on, the value describes by the the heart rate profile will show real time changes until I turn off the notifications but it seems no matter where I put the timer, the results seems to be no real time data but a non-real time data. The non-real time data refers to the data that is showed in the the heart rate profile when i trigger the notification button. Once trigger, the value shows will not be changing with respect to time.

herochua617
Offline
Last seen:3 years 11 months ago
Joined:2017-01-18 12:46
Hi there,

Hi there,

I have solved the looping problem through this topic -https://support.dialog-semiconductor.com/timer-problem-again. Thanks

herochua617
Offline
Last seen:3 years 11 months ago
Joined:2017-01-18 12:46
Hi there,

Hi there,

I found out that @app_hrps.c. This req->meas_val.rr_intervals[0] in

void app_heart_rate_set_value(uint16_t heart_rate_val)
{
// Allocate the message
struct hrps_meas_send_req * req = KE_MSG_ALLOC(HRPS_MEAS_SEND_REQ, TASK_HRPS, TASK_APP,
hrps_meas_send_req);

// Fill in the parameter structure
req->conhdl = app_env.conhdl;
//struct hrs_hr_meas meas_val;
/// Flag
req->meas_val.flags = HRS_FLAG_HR_8BITS_VALUE;
/// RR-Interval numbers (max 4)
req->meas_val.nb_rr_interval = 4;
/// RR-Intervals
//req->meas_val.rr_intervals[0] = heart_rate_val;
/// Heart Rate Measurement Value
req->meas_val.heart_rate = heart_rate_val-104;
/// Energy Expended
req->meas_val.energy_expended = HRS_HR_CNTL_POINT_CODE;}

has no effect on the heart rate values. No matter what I change the value of rr_intervals[0], the values coming out from the heart rate profile is the same. Does this really has no effect? Thanks

herochua617
Offline
Last seen:3 years 11 months ago
Joined:2017-01-18 12:46
Hi there,

Hi there,

Can I measured the rr_intervals from the heart rate profile. I just found out my values are in terms of ECG or in another words electrical signal over time. What is generated out from the profile currently does not represent heart rate (bpm) but the values of electrical signal over time. Any idea so I can get heart_rate values? Thanks.

herochua617
Offline
Last seen:3 years 11 months ago
Joined:2017-01-18 12:46
Hi there,

Hi there,

Thanks. I have found out. You've already answered this question in this linkhttps://support.dialog-semiconductor.com/forums/post/dialog-smartbond-bl....