Param Error code in DSPS device code

17 posts / 0 new
Last post
asalhuv
Offline
Last seen:2 years 9 months ago
加入:2015-10-22 09:49
Param Error code in DSPS device code


我am using the DSPS device mode code for my application. The general purpose of my code is to change the advertise string according to my host MCU board state machine. Sometimes I see that the BLE stops transmitting advertise packets from some reason . I see that in the gapm_cmp_evt_handler() function the param->status is 0x43 (GAP_ERR_COMMAND_DISALLOWED) and afterwards it changes to 0x44 (GAP_ERR_CANCELED). can you please help about what are the possible reasons for getting these statuses and if you think that it may be related to the advertise stop transmission which I have?

short code explanation:
我n my code when I am receiving a advertise modification request for the host MCU (via UART) the dialog MCU send advertise stop request and waits for the gapm_cmp_evt_handler function call to get the operation flag. once it reached, it send advertise start request with the new values of the advertise string (changes on byte in the MAJOR string) and wait for gapm_cmp_evt_handler call to get the operation flag.
Thanks

Keywords:
Device:
MT_dialog
Offline
Last seen:2 months 4 weeks ago
Staff
加入:2015-06-08 11:34
Hi asalhuv,

Hi asalhuv,

我suppose thatthis incident happens when you perform a change on theadvertising string.The advertising string goes through a validity check when its time to be transmitted over the air, perhaps the string that you are feeding to the 580 isn't a valid one (a strange flag or something like that) that would cause your device not to advertise. Or perhaps you are issuing and advertising command without canceling the previous one.

Thanks MT_dialog

asalhuv
Offline
Last seen:2 years 9 months ago
加入:2015-10-22 09:49
Hi and thanks for your answer

Hi and thanks for your answer,
regarding the 1st option:
我sn't it suppose to to send GAP_ERR_ADV_DATA_INVALID if the advertising string is wrong?

我will check out the not stopping advertise option.
one more thing: I assume that GAP_ERR_CANCELED message is sent after I call the advertise stop function, right?
thanks
Amir

MT_dialog
Offline
Last seen:2 months 4 weeks ago
Staff
加入:2015-06-08 11:34
Hi asalhuv,

Hi asalhuv,

Yes, in an invalid data string you should get a GAP_ERR_ADV_DATA_INVALID. And yes first you cancel the advertising procedure and then you get the GAP_ERR_CANCELED message.

Thanks MT_dialog

asalhuv
Offline
Last seen:2 years 9 months ago
加入:2015-10-22 09:49
OK thanks

OK thanks
我have One last question. If everything goes OK and these steps occurs:
1. I have canceled the advertise with the stop advertise function
2.Got the GAP_ERR_CANCELED (in the param->status register) from the Kernel
3. Then I Called the start advertise function and modified the advertise string
4. MY QUESTION - what is the Kernel response should be in the param->status register afterwards?
再次感谢

MT_dialog
Offline
Last seen:2 months 4 weeks ago
Staff
加入:2015-06-08 11:34
Hi asalhuv,

Hi asalhuv,

You mean what is the message that the kernel sends when the advertising starts ? After you send the GAPM_START_ADVERTISE_CMD you dont get any message from the kernel, the operation is going to continue (unless is a directed advertising) until you stop advertising (response with a GAPM_CMP_EVT) or you receive a connection request (GAPC_CONNECTION_rEQ_IND). Please have a look at the RW_BLE_GAP_IS.pdf for more information.

Thansk MT_dialog

asalhuv
Offline
Last seen:2 years 9 months ago
加入:2015-10-22 09:49
嗨and thanks for your answer

嗨and thanks for your answer. In my case, after a while (could be from 10 minutes to 24 hours) the advertising stops from some reason. I see this flow of occurrences:
1. My host MCU send a new advertise modification request (I can trigger it whenever I want).
2.我get the request and call the stop_adv() function, then I get param->status==GAP_ERR_CANCELED in the gapm_cmp_evt_handler() function.
3. After I am getting this status , I call the adv_start() function and modify the advertise string , then the gapm_cmp_evt_handler() function is not being called.
following our conversion, I assume that this is the right procedure that should be, but still I don't see any advertise packets in my BLE scanning App. Can you think about anything that could help me debug/solve this?
Thanks
Amir

MT_dialog
Offline
Last seen:2 months 4 weeks ago
Staff
加入:2015-06-08 11:34
Hi asalhuv,

Hi asalhuv,

The procedure of changing the advertising string is correct:

1) Start advertise - issue a GAPM_START_ADVERTISE_CMD and continue advertising until you decide to stop

2) Stop advertise - Issue a GAPM_CANCEL_CMD

3) Receive the GAPM_CMP_EVT that the advertising has stopped

4) Change the advertising string and start advertising once more.

我suppose that you get the gapm_cmp_evt_handler() when you cancel the advertising and instead of GAP_ERR_CANCELED you get the GAP_ERR_COMMAND_DISALLOWED. Try to connect to the smart snippets tool and check that your device for sure isn't advertising (no rx, tx activity) when re-initiating advertising isn't working also you can check the status of your device when this incident occurs. I ve tried to modify the DSPS project in order to get theGAP_ERR_COMMAND_DISALLOWED, it seems that i am getting this error when i am connecting to the device and i try to start advertise but as soon as i am disconnected the device is able to advertise again.

Thanks MT_dialog

asalhuv
Offline
Last seen:2 years 9 months ago
加入:2015-10-22 09:49
Hi

Hi
我will try, but I checked it well, I get the exact procedure that you described in the 4 steps above. I am not getting the GAP_ERR_COMMAND_DISALLOWED. I will try to use the smart snippets tool but still I would be happy to know if there is another flag or any other indication, for the RF start advertising. currently I will need to do periodical resets, but is solution will not last for mass production.
thanks

MT_dialog
Offline
Last seen:2 months 4 weeks ago
Staff
加入:2015-06-08 11:34
Hi asalhuv,

Hi asalhuv,

Considering your first post i thought that your problem was that you were getting GAP_ERR_COMMAND_DISALLOWED when you trying to re-advertise instead of GAPM_CANCEL_CMD and your device just stoppped advertising. You can use the arch_last_rwble_evt_get() in order to get the last BLE event that your device went through. Please check the beacon reference design in the app_asynch_trm() function in the app_sleep.h file. It uses this function to count the advertising events.

Thanks MT_dialog

asalhuv
Offline
Last seen:2 years 9 months ago
加入:2015-10-22 09:49
Hi

Hi
我did tracked the last status in rwble_last_event, and it seems ok: it is getting a few 0x02 (BLE_EVT_RX) and 0x03 (BLE_EVT_RX) until I am getting the 0x04 (BLE_EVT_END). I assume (according to beacon project) that BLE_EVT_TX and afterwards BLE_EVT_END means that this 1 count of advertise.But still after a while I don't see the packets over the Air. I have a few inputs that maybe can help you to help me:
1. I don't use any external oscillator - I canceled the two sleep with #undef of CFG_EXT_SLEEP and CFG_DEEP_SLEEP
2.我canceled the SW and HW UART flow control (don't have enough pins)
3. I use development debug
Thanks again for your help, I really appreciate it

MT_dialog
Offline
Last seen:2 months 4 weeks ago
Staff
加入:2015-06-08 11:34
Hi asalhuv,

Hi asalhuv,

The points that you mention shouldn't affect the advertising procedure of the 580, it shouldn't just stop advertising. Can you please issue advertise stop, advertise start and modify the string by using a timer and not send a command through the external MCU in order to isolate the problem. Perhaps the MCU affects somehow your system and causes to hault BLE activity somehow. Also if you check if there is BLE activity by tracking the BLE_EVT_END as the beacon snippet does and when there is no activity to issue a start advertise command, is the command executed or you have to reset the stack in order for your device to start advertise?

Thanks MT_dialog

asalhuv
Offline
Last seen:2 years 9 months ago
加入:2015-10-22 09:49
Hi I am sorry didn't

Hi I am sorry didn't understand you last sentence (with the BLE_EVT_END), can you please explain again. When I did the debug the BLE_EVT_END was a temporary state and after it reached the break point again it was with state RX or TX. If it is mention that the state is TX, isn't it suppose to be that advertise has surely occurred? Even if I solve this issue , I want to be able to know if the BLE transmitting or not.

MT_dialog
Offline
Last seen:2 months 4 weeks ago
Staff
加入:2015-06-08 11:34
Hi asalhuv,

Hi asalhuv,

When the advertising occurs the function should return the states in the following order TX/RX/TX/RX/TX/RX/BLE_END_EVT (this is the cycle of an advertising event - it will return the other states as well since its awakening but you are not interested in that, CSNT_EVT and SLP etc) so every successfull advertising event should end with BLE_END_EVT. In my previous post i mentioned that you can track the full cycle of the advertising procedure by keeping the last and the current BLE event. If the state of your device doens't change to the above states and doesn't complete the above cycle you will be able to know that your device isn't advertising. By tracking only TX is only advertising in one channel and not a full advertise operation, you can track that as well if you want to.

Thanks MT_dialog

asalhuv
Offline
Last seen:2 years 9 months ago
加入:2015-10-22 09:49
Hi and thanks for your answer

Hi and thanks for your answer. I tried to see what happen with the original code: I used the version DSPS 3.150.2 with this changes:
1. #undef CFG_EXT_SLEEP (was #define)
2.#undef CFG_UART_HW_FLOW_CTRL (was #define)

我am uploading the FW via UART port and CRC is OK. the unit start to transmit but after a while, it stops same as my Firmware version.

As I mentioned before, I am not using an external oscillator, and in my setup I have couple of units about 8 units that the distance between them is ~30cm, inside each unit there are ZigBee transmitters (about 5 CM from the BLE module) that Occasionally transmit data. Maybe this will help you help me.
thanks

MT_dialog
Offline
Last seen:2 months 4 weeks ago
Staff
加入:2015-06-08 11:34
Hi asalhuv,

Hi asalhuv,

When you say you dont use an external oscillator you mean, you dont use any external oscilator, not even the XTAL16 ? The XTAL16 is mandatory for the 580 as the datasheet indicates you can omit only the XTAL32 external oscillator when you are in buck mode, in boost mode the XTAL32 is mandatory as well. Sorry for not noticing your indication in post 11 earlier.

Thanks MT_dialog

asalhuv
Offline
Last seen:2 years 9 months ago
加入:2015-10-22 09:49


我和你使用村田模块r embedded chip (type ZY) which including the Xtal16. I think that the DSPS version 3.0.8 has some problem under loaded environment:
when I tested it in my house during the weekend (only one module) everything was OK, and it keep transmitting for 3 days.As soon as I started testing at work (where we have many BLE modules{at least 30}, ZigBee transmitters, and WIFI), the advertising stops after a while, even with the reference FW as I described in earlier post.
我tried the DSPS of SDK 5 (the new one you published), and for now it looks better, but I will know for sure only in Sunday when I will check it out again.
Maybe I worth checking this issue out, I will update again on Sunday.