Hi Dialog,
I have a follow up query from following thread
// My ADC configuration adc_config_t echo_pin_cfg = { .input_mode = ADC_INPUT_MODE_SINGLE_ENDED, .input = ADC_INPUT_SE_P0_6, .smpl_time_mult = 15, .continuous = true, .interval_mult = 0, .input_attenuator = ADC_INPUT_ATTN_4X, .chopping = false, .oversampling = 7 }; adc_init(&echo_pin_cfg); //Sample ISR code void timer_0_isr() { if ((counter % 4) == 0) // approx every 50 microsecond { adc_count = adc_get_sample(); sprintf((char *) tempbuff," %d , %d \n",adc_count,counter); uart_send(UART2, (uint8_t *) tempbuff, strlen(tempbuff), UART_OP_BLOCKING); } counter ++; }
FYI : The Timer 0 ISR reload value is 12.5 micro seconds
PROJECT USED :ble_app_peripheral
When I tried to debug my application i getgarbage values from my ADC channel, whenBLE starts advertising. Otherwise I get required ADC counts. This repeats for every3seconds as BLE interval is set for this value inuser_peripheral.hWhen I turn OffADV PACKETSthrough setting
// Default Handler Operations static const struct default_app_operations user_default_app_operations = { .default_operation_adv = NULL, // PREVIOUSLY ITS DEFINED AS user_app_adv_start };
inuser_callback_config.hI get proper output from my ADC channel.
P.S. check the attached file and do the needful.
I need clarification on why BLE ADV timer interrupts ADC channel, how to overcome it ?
Br,
BALAJI.
Keywords:
Device:
Hi BALAJI,
Thanks for your post.
Can you please indicate which BLE device you are using? Is it DA14580 ( according to your initial post) or DA14531 TINY module ( according to your previous post) ?
Are you using any of the available sleep modes? What is the value of the app_default_sleep_mode variable in user_config.h header file?
Please keep in mind that the device can sleep between intervals ( advertising or connections). When the chip is sleeping, all the peripheral domains including ADC, UART and TIMERS are powered down.
You could use the app_easy_timer(), as it is using the BLE Timer and is available in sleep mode.
In the user_app_adv_start() you could also disable the app_adv_data_update_timer_used TIMER that is scheduling the next advertising data update.
Thanks, PM_Dialog
Hi Dialog,
Sorry for late reply/
I'm using DA14531 module , for development usingDevelopment Kit - USB.
My sleep config
I have following queries from your reply,
1. What is the BLE_ADV_INTERVAL? and from below config (user_peripheral.h)
I infer its3 secfor each ADV and after30 sec its updates ADV parameters . correct me if I'm wrong.
So if that is the case every 3 sec this ble_adv interrupts my timer ISR where I got stuck.
我的要求是配置定时器0为12.5米cro-seconds and run it till 40 ms , (counter value => 3200 * 12.5) , which is reset after 40 ms and wait for 12.5 micro-second and timer overflow and cycle repeats. Now this BLE_ADV interrupts my 40 ms loop and I get Garbage values in my ADC channel.
Note : BLE is the main update we are making in our product and we can't put it to SLEEP MODE as per our product specification.
I can share my full code, bcoz of IP i can't share here , so if any mail ID is provided it would be much easier to replicate my issue.
Thanks in advance
Br,
BALAJI
Hi BALAJI,
The app_adv_data_update_timer_used timer elapses every APP_ADV_DATA_UPDATE_TO seconds. So, upon its expiration, the adv_data_update_timer_cb() is triggered in order to update the advertising data on the fly (specifically the manufacturer data)
>>> I infer its 3 sec for each ADV and after 30 sec its updates ADV parameters . correct me if I'm wrong.
Can you please clarify this statement – to be honest I didn’t get what you mean exactly.
Let’s take part by part – the SDK includes a peripheral example for the TIMER0. So, if you run it on non-BLE project, is the TIMER0 configured correctly and the callback is getting triggered as expected?
If yes, please run it in debug mode in a BLE example and add breakpoint on the timer_0_isr(). Does the breakpoint hit, so that the adc_get_sample() is executed ?
Thanks, PM_Dialog
Hi Dialog,
I have following config in user_callback_config.h
So what this function actually do. Could you explain ?
What is the BLE advertisment interval used in BLE projects from SDK 6.0.12.1020 ?
Thanks in advance
Br,
BALAJI.
Hi Balaji,
First of all, I would strongly suggest you to use that lasted version of SDK which is SDK6.0.14.
This is the callback function that is responsible for the advertisement. If you remove the user_app_adv_start() and place NULL that device will not start advertising – of course you should put it into sleep mode. If you check the user_app_adv_start() source code, you will see that the app_easy_gap_undirected_advertise_get_active*( is creating the message that will be send to the BLE stack and the app_easy_gap_undirected_advertise_start() starts advertising for undirected connection.
The advertising intervals are set into the user_adv_conf structure in user_config.h header file. I would recommend first checking theBLE Advertising Tutorial (HTML)tutorial.
Thanks, PM_Dialog