Custom DSPS application not receiving all bytes

3 posts / 0 new
Last post
ao
Offline
Last seen: 6 days 19 hours ago
Joined: 2016-06-02 20:58
Custom DSPS application not receiving all bytes

Hi Dialog,

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)

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.

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)

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.

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

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. The device is disconnected from the DSPS mobile app and is stuck in some state.
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.

There are a couple things I suspect could be causing the problem:
Is there anything I need to do when I reconfigure the pins from GPIO to UART during runtime?
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?

Anything helps, thank you for your time

Keywords: 
Device: 
PM_Dialog
Offline
Last seen: 41 min 41 sec ago
Staff
Joined: 2018-02-08 11:03
Hi ao,

Hi ao,

Let me check your issue and I will get back to you as soon as possible.

Thanks, PM_Dialog

PM_Dialog
Offline
Last seen: 41 min 41 sec ago
Staff
Joined: 2018-02-08 11:03
Hi ao,

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?

  • “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”

 

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

 

  • “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.”

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

 

  • In case you have a custom board with the DA14580 chip, could you please let me know that when using the default DSPS application is fully functional?

 

  • “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?”

 

I not quite sure what you mean with this question, so can you please try to explain It a little bit more?

Thanks, PM_Dialog