嗨
我正在使用DSP设备模式代码进行应用程序。我的代码的一般目的是根据我的主机MCU板状态机更改广告字符串。有时我看到BLE从某种原因停止传输广告数据包。我看到,在GAPM_CMP_EVT_HANDLER()函数中,参数 - >状态为0x43(GAP_ERR_COMMAND_DISALLED),然后更改为0x44(GAP_ERR_CANCELED)。您可以帮助获取这些状态的可能原因,以及如果您认为它可能与我所拥有的广告停止传输有关吗?
short code explanation:
在我的代码中,当我收到主机MCU的广告修改请求时(通过UART)对话框MCU发送通告停止请求并等待GAPM_CMP_EVT_HANDLER函数调用以获取操作标志。一旦到达,它会使用通告字符串的新值发送通告启动请求(主要字符串中的字节上的更改)并等待GAPM_CMP_EVT_HANDLER调用以获取操作标志。
谢谢
关键词:
设备:
嗨Asalhuv,
我想在执行更改时发生此事件advertising string.广告字符串通过有效性检查它在空中传输时间,也许是您对580馈送的字符串不是一个有效的字符串(一个奇怪的标志或类似的东西),这会导致您的设备不到广告。或者您正在发出和广告命令,而不取消前一个。
谢谢MT_dialog
嗨,谢谢你的答案,
关于第1个选项:
如果广告字符串错误,它是否认为发送GAP_ERR_ADV_DATA_INVALID?
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
嗨Asalhuv,
是的,在无效的数据字符串中,您应该得到一个gap_err_adv_data_invalid。是的,首先取消广告过程,然后获取Gap_err_Canceled消息。
谢谢MT_dialog
OK thanks
我有一个最后一个问题。如果一切顺为确定,就会出现这些步骤:
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.然后我称之为启动函数并修改了广告字符串
4.我的问题 - 之后应该在Param->状态登记中的内核响应是什么?
再次感谢
嗨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
嗨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.我的主机MCU发送新的广告修改请求(我可以在我想要的时候触发它)。
2.我得到了请求并调用stop_adv()函数,然后在gapm_cmp_evt_handler()函数中获得Param-> Status == Gap_err_Canceled。
3.我获得此状态后,我调用ADV_START()函数并修改通告字符串,然后不调用GAPM_CMP_EVT_HANDLER()函数。
在我们的转换之后,我认为这是应该是正确的程序,但我仍然没有看到我的BLE扫描应用程序中的任何广告数据包。你能想到任何可以帮助我调试/解决这个问题的东西吗?
谢谢
Amir
嗨Asalhuv,
更改广告字符串的程序是正确的:
1) Start advertise - issue a GAPM_START_ADVERTISE_CMD and continue advertising until you decide to stop
2)停止宣传 - 发出GAPM_CANCEL_CMD
3)接收广告已停止的GAPM_CMP_EVT
4) Change the advertising string and start advertising once more.
我想你在取消广告时得到GapM_CMP_EVT_Handler(),而不是Gap_err_Canceled,你得到了Gap_err_command_disallow。尝试连接智能代码段工具并检查您的设备是否肯定是在重新启动广告不起作用时肯定的(没有RX,TX活动),您可以在发生此事件时检查设备的状态。我试图修改DSP项目以获得GAP_ERR_COMMAND_DISALLED,当我连接到设备时,我似乎正在收到此错误,我尝试开始通告,但一旦我断开连接,设备就可以再次通告。
谢谢MT_dialog
Hi
我会尝试,但我检查一下,我得到了上面4步中描述的确切程序。我没有得到gap_err_command_disogped。我会尝试使用智能片段工具,但我仍然很高兴知道是否有另一个标志或任何其他指示,对于RF启动广告。目前我需要进行期刊重置,但解决方案不会持续批量生产。
thanks
嗨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
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.我不使用任何外部振荡器 - 我取消了与cfg_ext_sleep和cfg_deep_sleep的#undef的两个睡眠
我取消了SW和HW UART流量控制(没有足够的针)
3.我使用开发调试
再次感谢你的帮助,我真的很感激
嗨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?
谢谢MT_dialog
嗨,我很抱歉没有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.
嗨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
嗨,谢谢你的答案. 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)
我上传FW通过UART端口,CRC还可以。单位开始传输但过一段时间后,它会停止与我的固件版本相同。
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
嗨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
嗨
我用日本村田公司模块与嵌入式芯片(类型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.
我尝试了SDK 5的DSP(你发表的新一个),现在看起来更好,但我会肯定只在星期天时才知道我再次检查一下。
也许我值得检查这个问题,我会在星期天再次更新。