为ADC进行自定义配置文件

⚠️
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.wsdof.com/support。We’ll be fixing bugs / optimising the searching and tagging over the coming days.
18 posts / 0 new
Last post
herochua617
Offline
Last seen:3年11个月前
Joined:2017-01-18 12:46
为ADC进行自定义配置文件

Hi there,

I would like to capture the ECG signals and then I want to convert them into heart rate which is in bpm and I want signal to be sent through the BLE to the smartphone. The smartphone will use BLE scanner to get the reading. I have modified the ble_app_peripheral example in the SDK folder so that I can be able to capture the data (see the attachment). I have realized that the problem is most probably due to the ADC function. Did I put at the wrong location and where should I put?

adc_init(gp_adc_se,gp_adc_sign,gp_adc_attn3x).....
....

Thank you very much.

设备:
herochua617
Offline
Last seen:3年11个月前
Joined:2017-01-18 12:46
Hi there,

Hi there,

Besides that, I do not know how to link the adc output to the custom profile and basically the output from the ADC is in ECG signal and I need to convert them into heart rate. Do I need to use the hrpc.c, hrpc_task.c ? Thanks

MT_dialog
Offline
Last seen:2个月3周前
Staff
Joined:2015-06-08 11:34
Hi herochua617,

Hi herochua617,

没有BLE实现,您是否从ECG和ADC获取任何值?如果是,则可以转到下一步并通过BLE发送值。存在心率配置文件文件,以便使用SIG标准心率曲线分开发送HRP值,因为Tha个人资料将为您提供何时可以为您做任何难题,可以使用自定义配置文件从传感器发送值。关于您必须放置读取ADC功能的地方,您可以在向堆栈发送通知之前执行此操作。关于如何发送值,您在app_adcval1_timer_cb_handler()中拥有的样本变量是每次定时器经过的时候它将其发送到中央的虚拟值,因此您可以用从ADC读取的值替换该数据。

谢谢MT_dialog

herochua617
Offline
Last seen:3年11个月前
Joined:2017-01-18 12:46
嗨mt_dialog,

嗨mt_dialog,

I would like to ask. If I want to run this profile from SPI, do I need to configure anything in the ble_peripheral_app? Since I can use smart snippets to straight away burn the coding inside the SPI and it will run automatically when I switch on the development kit when I run the development kit on coin cell battery supply? Am I right? Thanks

herochua617
Offline
Last seen:3年11个月前
Joined:2017-01-18 12:46
Hi there,

Hi there,

What i am getting from the custom profile is not the heart rate. Is actually the ECG signal value which is the value obtained from the ADC output. i know that I need to fix the interval of the QRS complex of the ECG signal in order to obtain the heart rate value. But do you have any example on how to configure that? Thanks

chey856
Offline
Last seen:4 years 3 weeks ago
Joined:2017-01-06 11:30
1.Enable ADC value notify

1.Enable ADC value notify
ADC_VAL_1_UUID_128(UUID 0x17, 0xB9, 0x67, 0x98, 0x4C, 0x66, 0x4C, 0x01, 0x96, 0x33, 0x31, 0xB1, 0x91, 0x59, 0x00, 0x15)
2.将0x01写入Ctrl_point
CTRL_POINT_UUID_128 (0x20, 0xEE, 0x8D, 0x0C, 0xE1, 0xF0, 0x4A, 0x0C, 0xB3, 0x25, 0xDC, 0x53, 0x6A, 0x68, 0x86, 0x2D)
ADC func location you put is not wrong.

herochua617
Offline
Last seen:3年11个月前
Joined:2017-01-18 12:46
Hi chey856,

Hi chey856,

非常感谢你!。I am able to see the value changing. Can I ask? What is the function of control point? Why I do need to turn on in order to obtain the value? Thanks

MT_dialog
Offline
Last seen:2个月3周前
Staff
Joined:2015-06-08 11:34
Hi herochua617,

Hi herochua617,

The control point characteristic that chey856 kindly mentioned is a characteristic that when written it enables a kernel timer in the fw. When the kernel timer elapses it triggers the sending of a notification towards the stack and eventually at your phone and resets the timer. So as soon as you write to that characteristic the function user_custs1_ctrl_wr_ind_handler() is triggered and starts the timer, and when the timer elapses the app_adcval1_timer_cb_handler() gets triggered.

thaks mt_dialog

chey856
Offline
Last seen:4 years 3 weeks ago
Joined:2017-01-06 11:30
这是正确的!谢谢你

这是正确的!谢谢你very much Thaks
by the way can you tell the adc sample rate of DA14580

MT_dialog
Offline
Last seen:2个月3周前
Staff
Joined:2015-06-08 11:34
Hi chey856,

Hi chey856,

它在数据表中提到,“最大采样率为3.3 msample / s”。

谢谢MT_dialog

herochua617
Offline
Last seen:3年11个月前
Joined:2017-01-18 12:46
Hi there,

Hi there,

What if I wanna take the data and convert them into heart rate so that the adc value 1 will give the result as in heart rate. Will I able to do it using my existing code? Thanks

chey856
Offline
Last seen:4 years 3 weeks ago
Joined:2017-01-06 11:30
heart rate = ( adc_get_sample

heart rate = ( adc_get_sample() * 1.2Volt * ADC_ATTN3X)/1023
如果未在ADC_INIT()中未设置ADC_ATTN3X,则设置ADC_ATTN3X = 1其他SET ADC_ATTN3X = 3
1.2Volt is the reference voltage
10bit ADC所以它的决议:2 ^ 10 - 1 = 1023
您应该看看“Projects \ target_apps \ peripheral_examples \ adc \ batt_lvl”示例

herochua617
Offline
Last seen:3年11个月前
Joined:2017-01-18 12:46
static uint16_t heart_rate,

static uint16_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 =(样本+样品2);
heart_rate = heart_rate/2;
heart_rate = (heart_rate*3.6)/1023;

req-> conhdl = app_env-> conhdl;
req->handle = CUST1_IDX_ADC_VAL_1_VAL;
req-> length = def_cust1_adc_val_1_char_len;
memcpy(req->值,&heart_rate,def_cust1_adc_val_1_char_len);

KE_MSG_SEND(REQ);

if(ke_state_get(task_app)== app_connected)
{
// Set it once again until Stop command is received in Control Characteristic
timer_used = app_easy_timer(100, app_adcval1_timer_cb_handler);
}
}

这是我的代码。我从BLE Scanner App的ADC Val 1特性获得0x01。任何建议吗?

谢谢

chey856
Offline
Last seen:4 years 3 weeks ago
Joined:2017-01-06 11:30
Sorry for late, It seems that

Sorry for late, It seems that your code is OK, can you tell me more details about your project?
我的邮箱:cheyu856@gmail.com.

herochua617
Offline
Last seen:3年11个月前
Joined:2017-01-18 12:46
我已经回复了你的

我已经回复了你的mailbaox. Thanks

herochua617
Offline
Last seen:3年11个月前
Joined:2017-01-18 12:46
嗨,大家好,

嗨,大家好,

我可以使用HRPS配置文件与我的心率设备一起使用吗?这将更容易,因为HRPS将在HRPS中有算法,它会将我的数据转换为可读的心率而不是十六进制值?

MT_dialog
Offline
Last seen:2个月3周前
Staff
Joined:2015-06-08 11:34
Hi herochua617,

Hi herochua617,

HRP只是一个SIG标准,它只是以特定方式格式化传感器的数据,以便由其他客户端设备读取,它没有算法实现或任何额外的东西,它只是表达心率值的标准方法订购其他设备能够解释它们。

谢谢MT_dialog

herochua617
Offline
Last seen:3年11个月前
Joined:2017-01-18 12:46
嗨mt_dialog,

嗨mt_dialog,

谢谢。这解决了我的问题https://support.dialog-semicondiondiondum/forums/post/dialog-smartbond-bl ...。谢谢。但是,我正在尝试自己检测到间隔的方式。我想在两个峰之间获得时间https://support.dialog-semicondiondiondum/forums/post/dialog-smartbond-bl ...。非常感谢你!