Custom DSPS application not receiving all bytes

⚠️
Hi there.. thanks for coming to the forums. Exciting news! we’re now in the process of moving to our new forum platform that will offer better functionality and is contained within the main Dialog website. All posts and accounts have been migrated. We’re now accepting traffic on the new forum only - please POST any new threads at//www.xmece.com/support. We’ll be fixing bugs / optimising the searching and tagging over the coming days.
5个帖子/ 0新
Last post
ao
Offline
Last seen:1 year 8 months ago
加入:2016-06-02 20:58
Custom DSPS application not receiving all bytes

嗨对话框,

I am currently developing firmware using the DSPS application with a DA14580 chip on a custom board. In this project, I am using a GPIO pin to turn on and off an external microcontroller in order to conserve power when the microcontroller is not in use. When I need to use the microcontroller, I send a short command to the DA14580 using a mobile phone, the DA14850 then wakes up the external microcontroller with a GPIO pin, sets up the UART, sends the short command, then waits to receive data to send to the phone.

Without turning on/off the external microcontroller, I am able to send data back and forth between the microcontroller and phone successfully. However, I think that when I am reconfiguring the pins during runtime, it is causing data to be lost when receiving and sometimes causing the DA14580 to get hung up somewhere. (a watchdog reset occurs if watchdog is enabled, and the phone is disconnected from Bluetooth and the device no longer advertises if watchdog is disabled)

在启动时,在“set_pads_function”中,引脚将设置为GPIO输出低,以防止外部微控制器引脚上的任何电压。

当我从电话连接到设备时,我禁用睡眠模式。

In the function "user_sps_server_data_rx_ind_handler", I start a timer I use to handle my application processes.

The first time the timer callback occurs, I configure the pins to turn on my external microcontroller and set up my UART pins. TX, RX, CTS, and RTS. (I have HW flow control defined)

几秒钟后,为了测试目的,我禁用计时器,以防发生任何问题。然后,我将外向命令发送到外部微控制器。我可以看到外部微控制器已接收并正确处理该命令。

The external microcontroller then sends 3000+ bytes to the DA14580 in 240 byte chunks.

此时,我可以看到所有字节都已在范围上发送过UART。DA14580将响应两种方式之一:
1. The device is disconnected from the DSPS mobile app and is stuck in some state.
2.如果设备不会被卡住。我可以查看从DSPS移动应用程序收到的字节数,最后一个接收文件中会有〜1940字节。

如果我最初将引脚设置为UART并具有微控制器“开”,则DA14580能够在没有启用HW流量控制的情况下处理240字节块。DA14580还能够处理具有流量控制的240字节块,而无需在传输期间设置RTS引脚。

There are a couple things I suspect could be causing the problem:
在运行时将从GPIO重新配置到UART时,我需要做什么?
Is there anything I need to do with the SPS scheduler when I am reconfiguring the pins that could be causing me to not be able to process all 3000+ bytes?

任何有帮助的东西,谢谢你的时间

关键词:
设备:
PM_Dialog
Offline
Last seen:4 hours 25 min ago
工作人员
加入:2018-02-08 11:03
嗨敖,

嗨敖,

让我检查你的问题,我会尽快回复你。

Thanks, PM_Dialog

PM_Dialog
Offline
Last seen:4 hours 25 min ago
工作人员
加入:2018-02-08 11:03
嗨敖,

嗨敖,

如您所提到的,根据您的应用程序需要修改了DSP参考应用程序代码,因此重复了您的问题。你能告诉我代码卡在哪里吗?

  • “如果启用了看门狗,则会出现看门狗重置,并且手机与蓝牙断开连接,如果禁用看台,则设备不再宣传”

Could you please enable the WDOG, run the firmware with hot-attaching the debugger? Which is the reason of WDOG expiration?

  • “我认为当我在运行时重新配置引脚时,在接收时导致数据丢失,有时导致DA14580在某处挂断。”

How you reconfigure the pins during runtime? Do you call the periph_init() ?

  • 如果您有一个带有DA14580芯片的定制板,可以让我知道使用默认的DSPS应用程序是否完全奏效?

  • “Is there anything I need to do with the SPS scheduler when I am reconfiguring the pins that could be causing me to not be able to process all 3000+ bytes?”

我不太确定你用这个问题的意思,所以你可以尝试解释一下吗?

Thanks, PM_Dialog

ao
Offline
Last seen:1 year 8 months ago
加入:2016-06-02 20:58
我没有努力

最近我没有在这个特定的问题上工作,但很快就会回到它。让我快速回应我现在可以的东西:

1.如何看到WDOG到期的原因?

2.重新配置针脚的最佳方式是什么?我正在调用一个函数,改变下面所示的引脚。此外,标志“SAM_ON”用于PERIPH_INIT()以决定是否将引脚设置为GPIO或UART。我认为每次设备从睡眠中唤醒时都会调用periph_init(),这是真的吗?

void turn_off_sam(void)
{
GPIO_SetPinFunction(GPIO_UART1_TX_PORT, GPIO_UART1_TX_PIN, INPUT, PID_GPIO);
gpio_setpinfunction(gpio_uart1_rx_port,gpio_uart1_rx_pin,输入,pid_gpio);
#if (UART_HW_FLOW_ENABLED)
GPIO_SetPinFunction(GPIO_UART1_RTS_PORT, GPIO_UART1_RTS_PIN, INPUT, PID_GPIO);
gpio_setpinfunction(gpio_uart1_cts_port,gpio_uart1_cts_pin,输入,pid_gpio);
#endif //UART_HW_FLOW_ENABLED

GPIO_ConfigurePin(GPIO_PORT_1, GPIO_PIN_0, OUTPUT, PID_GPIO, true);

sam_on = false;
}

3.只要我未接通/关闭外部微控制器,DSP就会完全正常。

4. I've noticed that the sps scheduler is reinit before and after sleeping. is it possible to deinit the sps scheduler completely and then initialize the sps when needed? Ideally, I want to be able to deinitialize the pins/sps when not needed and then reinitialize everything when needed. The SPS is not needed when a device is not connected so it will be deinitialized for this time. During a connection, I will send a command to the DA14580 from the mobile device, then the DA14580 will need to initialize SPS and turn on the external microcontroller and communicate, then turn off the microcontroller and deinitialize the SPS.

PM_Dialog
Offline
Last seen:4 hours 25 min ago
工作人员
加入:2018-02-08 11:03
Ho ao,

Ho ao,

1. When the watchdog times out, the NMI_HandlerC is triggered. Please check the following tutorial from our support portal in order to understand how you can debug your firmware. The procedure you should follow is the same that is described into the tutorial:https://www.dialog-seminile.com/sites/default/files/training_08_deb ...Be aware that the maximum WDOG time out is 2.6 second, and this value we are using in the SDK.

2.您是正确的,每次芯片唤醒时都会执行Periph_Init。哪个是您使用的睡眠模式配置?您能否请确保正确触发Periph_Init,并且正确发生重新配置?我的建议是将引脚重新配置到user_periph_setup.c文件中

Regarding your last question, I am not completely sure what you exactly mean. Could you please clarify it a little bit more? What do you mean with “The SPS is not needed when a device is not connected so it will be deinitialized for this time.” ? My recommendation is to try to run the firmware into debug mode with the debugger hat attached and try to find where the firmware gets stuck.

Thanks, PM_Dialog