DSPS Buffer Limitations

4 posts / 0 new
Last post
Greavesinator85
Offline
Last seen: 1 week 3 min ago
Joined: 2016-09-20 17:02
DSPS Buffer Limitations

Hi,

I'm currently using the DSPS program for the DA14580. I understand that the DSPS contains buffers for out and inbound transmission in regards to the host microcontroller, my question is what size are these buffers by default, can this size be changed and what are the size limitations?

Also, what is the expected behaviour of the DSPS if a host microcontroller writes to the buffer continuously while no bluetooth device is connected? I found the device stops operating, but should I be monitoring the flow control hardware lines after writing each individual character? Or is there a way to detect if a device is connected?

Regards,
Jake

Device: 
MT_dialog
Online
Last seen: 9 min 7 sec ago
Staff
Joined: 2015-06-08 11:34
Hi Greavesinator,

Hi Greavesinator,

The DSPS device implements two buffers, one for incomming data and an additional buffer for outgoing (ble_to_periph_buffer and periph_to ble_buffer), the size of those buffers is 1800 and 500 bytes respectively, you can change the size of the buffers (although i dont see any reason for doing that) and your limitation about this how much heap memory you can allocate on the 580.

If we assume that a host writes to the 580 that is loaded with the DSPS fw, the DSPS will stay awake (will not sleep between the advertising events since it will have at least one byte to send but no connection to send to), capture the data until it reaches the RX's buffer watermark, as soon as that happens the device will issue a flow off in order to prevent the external device to send more data, if you dont use flow control, or the extenral device wont respect the flow off the device will simply fill in the entire buffer and will eventually assert a warning (stuck in a fw break point due to the fact that its buffer is filled). Yes there is a way to detect if the device is connected you can simply check the state of your TASK_APP (ke_state_get(TASK_APP)). If the device is in APP_CONNECTABLE state that means that the device is ready and its advertising.

Thanks MT_dialog

Greavesinator85
Offline
Last seen: 1 week 3 min ago
Joined: 2016-09-20 17:02
Thanks MT_dialog,

Thanks MT_dialog,

So I'm currently using hardware flow control. Once the RX watermark is reached, I should see the RTS line be set by the device? So by writing to the DA14580 and monitoring the RTS line between bytes I should be able to avoid overfilling the buffer and causing a warning?

Apologies, I meant a way for the host to detect if the DA14580 was currently connected to a device, such as the DSPS App.

Regards,
Jake

MT_dialog
Online
Last seen: 9 min 7 sec ago
Staff
Joined: 2015-06-08 11:34
Hi Greavesinator,

Hi Greavesinator,

The device doesn't issue a flow off only when the buffer is filled up to the RX watermark it also issues a flow off when the device is sleeping, between the advertising strings for example (when there are no data in the buffer) or between the connection events. The fact that you will get a flow off doesn't indicate that the device is connected.

Thanks MT_dialog