DSP设备代码中的Param错误代码

17 posts / 0 new
Last post
asalhuv
Offline
Last seen:2 years 9 months ago
加入:2015-10-22 09:49
DSP设备代码中的Param错误代码


I 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:
In 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.
谢谢

Keywords:
Device:
MT_dialog
Offline
Last seen:3 months 12 min ago
Staff
加入:2015-06-08 11:34
嗨Asalhuv,

嗨Asalhuv,

我想this incident happens when you perform a change on theadvertising string.广告字符串通过有效性检查它在空中传输时间,也许是您对580馈送的字符串不是一个有效的字符串(一个奇怪的标志或类似的东西),这会导致您的设备不到广告。或者您正在发出和广告命令,而不取消前一个。

谢谢MT_dialog

asalhuv
Offline
Last seen:2 years 9 months ago
加入:2015-10-22 09:49
嗨,谢谢你的答案

嗨,谢谢你的答案,
regarding the 1st option:
Isn't it suppose to to send GAP_ERR_ADV_DATA_INVALID if the advertising string is wrong?

I 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:3 months 12 min ago
Staff
加入:2015-06-08 11:34
嗨Asalhuv,

嗨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.

谢谢MT_dialog

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

OK thanks
I 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:3 months 12 min ago
Staff
加入:2015-06-08 11:34
嗨Asalhuv,

嗨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. I 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?
谢谢
Amir

MT_dialog
Offline
Last seen:3 months 12 min ago
Staff
加入:2015-06-08 11:34
嗨Asalhuv,

嗨Asalhuv,

The procedure of changing the advertising string is correct:

1)启动广告 - 发出GAPM_START_ADVERTES_CMD并继续广告,直到您决定停止

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.

我想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.

谢谢MT_dialog

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

Hi
I 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:3 months 12 min ago
Staff
加入:2015-06-08 11:34
嗨Asalhuv,

嗨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.

谢谢MT_dialog

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

Hi
I 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. I canceled the SW and HW UART flow control (don't have enough pins)
3.我使用开发调试
谢谢again for your help, I really appreciate it

MT_dialog
Offline
Last seen:3 months 12 min ago
Staff
加入:2015-06-08 11:34
嗨Asalhuv,

嗨Asalhuv,

你提到的要点不应该影响580的广告程序,它不应该停止广告。您能否通过使用计时器来发布广告停止,广告启动和修改字符串,而不是通过外部MCU发送命令以隔离问题。也许MCU以某种方式影响你的系统,并以某种方式向Hault Activity的原因产生影响。此外,如果通过跟踪BLE_EVT_END作为BEACON SCIPPET检查BLE Activity是否存在BLE Activity,并且当没有活动发出启动通告命令时,是执行的命令,或者您必须重置堆栈,以便您的设备启动广告?

谢谢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:3 months 12 min ago
Staff
加入:2015-06-08 11:34
嗨Asalhuv,

嗨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.

谢谢MT_dialog

asalhuv
Offline
Last seen:2 years 9 months ago
加入:2015-10-22 09:49
嗨,谢谢你的答案

嗨,谢谢你的答案. 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)

I 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:3 months 12 min ago
Staff
加入:2015-06-08 11:34
嗨Asalhuv,

嗨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.

谢谢MT_dialog

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


我使用Murata模块与您的嵌入式芯片(类型ZY),包括XTAL16。我认为DSPS 3.0.8在加载环境下有一些问题:
当我测试了它在我的房子里在周末(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.
I 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.