My project is modify form DSPS project.
when I set intv_min and intv_max to 10000,the interval is getting longer,but also I find it's hard to connection.
1.how to solve the problem?
2.how many advertises packets it send after once wakeup?Can I modify it?I think if the value is bigger,it will be easy to connect.
3.How big can this value is set to?
4.What is the effect ,if the two values is deffient?
Device:
Hi RandyYu,
1. You ve changed the intv_min and intv_max to 10000ms ? If you ve changed it in about 10 seconds thats what happens, after your device sees the advertising message of the peripheral device the central will have to wait to listen on the second advertising message in order to send the connection request and if there is trafic (fails to see the next advertising message) it might wait for longer as well.
2.The advertising command doesn't timeout after waking up and send the advertising command it will advertise as long as you dont cancel the command. Only at the directed advertising there is a timeout. The advertising packets are defined only via the interval set, if you have set it into 10 seconds then you will send 3 advertising messages (one for each advertising channel) every 10 seconds.
3. Its about 10.24 seconds, you can check the BLE specification for this.
4. Check the answer on this threadhttp://support.dialog-semiconductor.com/help-help-help-cant-go-deep-slee...on post #10.
Thanks MT_dialog
1.if I modify the device and central to paired,does the time will be decreased for connecting and send data.If it is ,can you give me a example for pairing.
2.you said interval?I don't quite understand,Can I change it?if I want change it to every 10 seconds send 10 advertising messges.which parameter need I to change it.
3.I sorry ,my english is not very good.I mean the parameter of intv,the biggest value it can set.becasue I want it sleep about 10minutes
thank you
Hi RandyYu,
1. In order for a connection to be established (paired or not) the device has to be awake and listen for requests (connection requests in your case) so if your scanner listens one advertising event and initiate a connection the connenction request will be send by the master at the next advertising event of the peripheral, what you can try is the directed advertising if it suits you, in that case your device will emmit directed advertising events to the scanner in order to get connected (the procedure is power consuming and you can directly advertise only to a specific central with a allready known bluetooth address). So an idea could be to advertise undirectly for a large amount of time and while you dont have an available central bd address, when a central finds your device you can establish a connection (the initial connection will be time consuming for the reasons i ve explained above). After that every time you are unconnected you will directly advertise to that central and you will get connected faster than the undirected advertising procedure. But i repeat that directed advetising is power consuming, stops automatically after 1.28 seconds, hasn't any advertising data (no advertising data means that you are not going to be able to connect to the DSPS android & ios application also you will have to reconfigure the 580 host to accept directed advertising requests and you will have to know the address of your central). You can implement the above with or without security. The above could be a solution depending on your device's use case. Also since from what i can tell you care about low power consumption, what you can do is keep the undirected advertising and gradually increase the advertising interval while there is no activity (being with no connection for quite sometime) or, if there is a possibility you can place a button on the device to increase advertising interval so that the user can force a reconnection with no delays.
2.If you set in the .intv_min and .intv_max the value of MS_TO_BLESLOTS(10000) your advertising intervalwill beset in 10 seconds, that means that the device will be sleeping for about 10 seconds and then exit sleep mode advertise and sleep again automatically. You cant control the number of the advertising packets by the advertising command you will have to implement a counter in order to count the advertising messages emmited from your device.
3. The maximum value of the advertising is 10.24 seconds by the specification, if you want more than this you will have to implement a custom advertising scheme via using a ke_timer. The timer can take as maximum value of 300s (5 minutes) but you can wake up and reset that timer and fall back to sleep.
Thanks MT_dialog
2.因为我want my device can work 3 years with a battery,so the directly advertise does not suit to me.vertise
You said I can "implement a counter in order to count the advertising messages emmited".
I think it is good idea to slove my problem,but I don't know in which position can changes it.
**************************************
I have tried to change it ,
a.close the sleep
b.open printf console
c.add a adv_counter++;in app_easy_gap_undirected_advertsie_start()
and write a arch_printf
but I found the function has only execute once.
It is stranged that my android app can also scaned it.does there have oher position and function
send advertise?
3.how can I implement a custom advertise scheme?
can you give me a detailed descriptions or a example.
thank you very much
dear dialog
i want to use another timer to solve the problem mention above,the code paste here
void adv_timer_fsm(void)
{
static uint8_t adv_state = ADV_INIT_STATE;
arch_printf("adv_timer_fsm\r\n\r\n");
switch(adv_state)
{
case ADV_INIT_STATE:
arch_printf("ADV_INIT_STATE\r\n\r\n");
spss_env.adv_tmr_hndl = app_easy_timer(10, spss_env.adv_timer_cb );
adv_state = ADV_MODIFY_STATE;
break;
case ADV_MODIFY_STATE:
arch_printf("stop advtise\r\n\r\n");
app_easy_gap_advertise_stop();
spss_env.adv_tmr_hndl = app_easy_timer(6000, spss_env.adv_timer_cb ); //Q1
adv_state = ADV_CYCLE_STATE;
break;
case ADV_CYCLE_STATE:
arch_printf("ADV_CYCLE_STATE\r\n\r\n");
default_advertise_operation();
spss_env.adv_tmr_hndl = app_easy_timer(300, spss_env.adv_timer_cb );Q2
adv_state = ADV_MODIFY_STATE;
break;
default:
break;
}
}
My question is :
Q1:the code at Q1 postion(code above) does this can stop the advertise and sleep for 60s? after 60s ,device wakeup by the
timer of spss_env.adv_tmr_hndl
Q2:the code at Q2 postion(code above) does this code in this postion can start advertise and continued 3s?(I have modified the advertise interval to 100,
and what's the minimum of this value)?
I have a test,but the result does not very ideal.when connected ,my slave send packets to master,and the master have ack.after I received
the ack,I called app_easy_gap_disconnect(spss_env.con_info.conidx), it's have a little disconnect(actually,I'm only sure that user_on_disconnect had executed).but after a short time
it;s connected again(I want it sleep 1 minute,and wake up by the timer spss_env.adv_tmr_hndl = app_easy_timer(6000, spss_env.adv_timer_cb ); ).
can you give me a suggestion how to modified it.
thank you very much
Hi RandyYu,
I dont get what you are trying to do with the above code.
我不看到你广告的测量essages will help you in connecting faster, the app_easy_gap_undirected_advertise_start() its executed only once and then the device advertises with the interval that you have set. In order to count the advertising messages that you ve emmited you can follow the example in the beacon project. Please check the implementation in the app_asynch_trm() function, the implementation will check the last state of the BLE if its a BLE_END_EVT and will increment the app_advertise_counter, you can take this implementation in order to count your messages.
Thanks MT_dialog
I have change as you said ,but the counter is not accuracy,I have set the MAX counter = 20,but I have Sniffer 49.
Hi RandyYu,
I am not sure if comparing with the sniffer is a reliable comparison, as far as i know that method is quite accurate if implemented correctly since you are tracking the end of each BLE event. Just remember that in order to track the advertising messages you should be in advertising state, if not, the counter will measure the connected events as well. Regarding the sniffer comparison with the method i ve mentioned, the counter will measure once for advertising on every channel (37, 38, 39) this will count as 3 advertising messages on the sniffer, also the sniffer as far as i know, wont show the advertising messages if there is any advertising packet collision on air.
Thanks MT_dialog