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