Hi Dialog,
我目前正在使用DSPS应用程序在自定义板上使用DS14580芯片开发固件。在此项目中,我正在使用GPIO引脚,打开和关闭外部微控制器,以便在微控制器不使用时节省电力。当我需要使用微控制器时,我使用手机向DA14580发送短命令,DA14850然后用GPIO引脚唤醒外部微控制器,设置UART,发送短命令,然后等待接收数据发送到手机。
如果没有打开/关闭外部微控制器,我就可以成功地在微控制器和手机之间来回发送数据。但是,我认为当我在运行时重新配置引脚时,它会在接收时导致数据丢失,并且有时导致DA14580在某处挂断。(如果启用了看门狗,则会出现看门狗重置,并且手机与蓝牙断开连接,如果禁用看门狗,则设备不再宣传)
On bootup, in the "set_pads_function" the pins will be set to GPIO output low to prevent any voltage on the pins of the external microcontroller.
When I connect to the device from a phone, I disable sleep mode.
在函数“user_sps_server_data_rx_ind_handler”中,我开始一个我用来处理我的应用程序进程的计时器。
发生定时器回调时,我将引脚配置为打开外部微控制器并设置我的UART引脚。TX,RX,CTS和RTS。(我已经定义了HW流量控制)
After a couple seconds, for testing purposes, I disable the timer in case it is causing any problems. Then, I send the outgoing command to the external microcontroller. I can see that the external microcontroller has received and processed the command correctly.
然后,外部微控制器在240字节块中向DA14580发送3000多个字节。
At this point, I can see that all of the bytes have been sent over UART on a scope. The DA14580 will respond either one of two ways:
1.设备与DSP移动应用程序断开连接,并粘在某些状态。
2.If the device doesn't get stuck. I can look at the amount of bytes received from the DSPS mobile app, there will be ~1940 bytes in the last receive file.
If I initially set up the pins as UART and have the microcontroller "on", the DA14580 is able to handle the 240 byte chunks without HW flow control enabled. The DA14580 is also able to handle the 240 byte chunks with flow control enabled without setting the RTS pin during a transmission.
我怀疑有几件事可能会导致问题:
Is there anything I need to do when I reconfigure the pins from GPIO to UART during runtime?
当我重新配置可能导致我无法处理所有3000多个字节的引脚时,我需要使用SPS调度程序吗?
Anything helps, thank you for your time
Hi ao,
Let me check your issue and I will get back to you as soon as possible.
谢谢,PM_DIALOG.
Hi ao,
As you mentioned, you have modified the DSPS reference application code according to your application’s need, so it is little bit difficult o replicate your issue. Could you please let me know where the code gets stuck?
您能否请启用WDOG,运行固件,使用热连接调试器?这是WDOG到期的原因?
如何在运行时重新配置引脚?你打电话给periph_init()吗?
I not quite sure what you mean with this question, so can you please try to explain It a little bit more?
谢谢,PM_DIALOG.
I haven't been working on this specific problem lately, but will be getting back to it soon. Let me respond quickly to what I can right now:
1. How can I see the reason for wdog expiration?
2.What is the best way to reconfigure pins? I am calling a function that changes the pins shown below. Also, the flag "sam_on" is used in periph_init() to decide whether to set the pins as GPIO or UART. I think that periph_init() is called each time that the device wakes from sleep, is this true?
void turn_off_sam(void)
{
gpio_setpinfunction(gpio_uart1_tx_port,gpio_uart1_tx_pin,输入,pid_gpio);
GPIO_SetPinFunction(GPIO_UART1_RX_PORT, GPIO_UART1_RX_PIN, INPUT, PID_GPIO);
#if(uart_hw_flow_enabled)
gpio_setpinfunction(gpio_uart1_rts_port,gpio_uart1_rts_pin,输入,pid_gpio);
GPIO_SetPinFunction(GPIO_UART1_CTS_PORT, GPIO_UART1_CTS_PIN, INPUT, PID_GPIO);
#endif // uart_hw_flow_enabled.
GPIO_CONFIGUREPIN(GPIO_PORT_1,GPIO_PIN_0,输出,PID_GPIO,TRUE);
sam_on = false;
}
3. DSPS is fully functional as long as I am not turning on/off the external microcontroller.
4.我注意到SPS调度程序在睡眠之前和之后都会改变。是否可以完全剥离SPS调度程序,然后在需要时初始化SPS?理想情况下,我希望能够在不需要时对引脚/ SP进行减少,然后在需要时重新初始化所有内容。当设备未连接时,不需要SPS,因此此时将被执行。在连接期间,我将从移动设备发送到DA14580的命令,然后DA14580需要初始化SPS并打开外部微控制器并进行通信,然后关闭微控制器并使SPS减去SPS。
Ho Ao,
1.当看门狗超时时,触发NMI_HandlerC。请从我们的支持门户中查看以下教程,以了解如何调试固件。您应该遵循的过程与教程中描述的相同://www.xmece.com/sites/default/files/training_08_deb...请注意,最大WDOG超时为2.6秒,我们在SDK中使用此值。
2.你是正确的,执行periph_init every time that the chips wakes up. Which is the sleep mode configuration that you are using? Could you please make sure tha the periph_init is correctly triggered and the reconfigurations is correctly happened? My recommendation is to reconfigure the pins into the user_periph_setup.c file
关于你的最后一个问题,我并不完全确定你的意思。你能澄清一下吗?你的意思是“当设备未连接时不需要SPS,因此它将在此时间进行减少。”?我的建议是尝试使用Debugger Hat附加的调试模式运行固件,并尝试找到固件所卡住的位置。
谢谢,PM_DIALOG.