DSPS without flow control, BLE buffer overflow.

15 posts / 0 new
Last post
Vadym
Offline
Last seen:1 year 2 months ago
Joined:2015-08-13 08:28
DSPS without flow control, BLE buffer overflow.

Hi.

I try to use the project DSPS version 5.150.2 on DA14580
In my project:
1) The sleep is disabled (ARCH_SLEEP_OFF).
2) Flow control are disabled too:
a) #undef CFG_UART_HW_FLOW_CTRL
b) #undef CFG_UART_SW_FLOW_CTRL

The BLE Device (peripheral) side connected to UART interface of some external processor. The external processor starts to send information to BLE UART immediately after initialization. Immediately, after initialization, BLE doesn't have established connection.
I get ASSERT_WARNING in function:
"user_periph_push"
on line:
"if (user_buffer_write_check(&periph_to_ble_buffer, wrdata, RX_CALLBACK_SIZE) != RX_CALLBACK_SIZE)"

How can i solve this trouble?
(There isn't any importance of the data in the buffer and part of the data can be lose)

Thanks.

Keywords:
Device:
MT_dialog
Offline
Last seen:2 months 2 weeks ago
Staff
Joined:2015-06-08 11:34
Hi Vadym,

Hi Vadym,

The flow control isn't only necessary for the sleeping, if you remove this there is no guarantee that there is not going to be any dataloss in your system. You can try to remove the ASSERT_WARNING and the checking for writing into the buffer but the DSPS isn't tested for this kind of usage (without flow control). Most probably old data will be overwritten by new data and you are going to lose bytes.

Thanks MT_dialog

Vadym
Offline
Last seen:1 year 2 months ago
Joined:2015-08-13 08:28
I removed the ASSERT_WARNING.

I removed the ASSERT_WARNING.
I come to "HardFault_HandlerC" from "uart_sps_rcv_data_avail_isr".
Now I tried to disable DEVELOPMENT_DEBUG but I doesn't get WDT reset.

How can I disable the UART receiving data while i have not yet in connection state?

MT_dialog
Offline
Last seen:2 months 2 weeks ago
Staff
Joined:2015-06-08 11:34
Hi Vadym,

Hi Vadym,

As as i ve allready mention the DSPS isn't tested for this kind of usage, another thing that you can try is to remove the user_sceduler_init() from the user_on_init() function and also remove the uart_sps_init() from the periph_init() and invoke both of the removed functions in the user_on_connection() function, the new user_on_connection() function should be something like this:

void user_on_connection(uint8_t connection_idx, struct gapc_connection_req_ind const *param)
{
default_app_on_connection(connection_idx, param);
user_gattc_exc_mtu_cmd(connection_idx);
app_easy_gap_param_update_start(connection_idx);
arch_printf("Device connected\r\n");
uart_sps_init(UART_SPS_BAUDRATE, 3);
user_scheduler_init();
}

Of course you should set and reset your UART in connections and disconnections respectively since if there isn't any sleep the UART and the interrupts will stay configured.

Thanks MT_dialog

Vadym
Offline
Last seen:1 year 2 months ago
Joined:2015-08-13 08:28
Hi.

Hi.

Thanks for you answer. It helps but only partly.
When central moves away from peripheral and connection becomes weak i still to get the buffer overflow.

p.s.
For me, don't need to insert "uart_sps_init" into "user_on_connection". The function is inside of "user_scheduler_init".

MT_dialog
Offline
Last seen:2 months 2 weeks ago
Staff
Joined:2015-06-08 11:34
Hi Vadym,

Hi Vadym,

If you dont have a flow control i suppose that this is expected.

Thanks MT_dialog

naracontrol
Offline
Last seen:3 years 5 months ago
Joined:2016-04-14 10:22
Hi, all.

Hi, all.
I interested in same issue and solved with following method.

1. condition:
1) No flow control and only use RX, TX signal
2) Always wake up
2. Change code at "user_sps_device.c"
enum arch_main_loop_callback_ret user_on_system_powered(void)
{
user_sps_sleep_restore();
user_ble_pull(true, NULL);
return KEEP_POWERED; // <-------------------return GOTO_SLEEP;
}

Thanks.

redcobaltbluedragon
Offline
Last seen:2 years 7 months ago
Joined:2017-11-16 18:38
I am working on the same

I am working on the same lines where I only need Tx/RX. Did you do all the changes from the rest of the post plus the edit you made. Could you tell me more.

Thanks,

redcobaltbluedragon
Offline
Last seen:2 years 7 months ago
Joined:2017-11-16 18:38
This is for naracontrol , I

This is for naracontrol , I am working along the same line are you are. Could you post a little more information. Did you do all the steps from above and then the edit you mentioned.

Thanks,

罗密欧
Offline
Last seen:3 months 1 week ago
Joined:2018-07-24 06:58
Has this problem been solved?

Has this problem been solved? I'm also worried about this. Please share your information with anyone who has solved it.

PM_Dialog
Offline
Last seen:2 days 4 hours ago
Staff
Joined:2018-02-08 11:03
Hi Romeo,

Hi Romeo,

Could you please clarify your issue? If I am able to understand correctly, you want to use the DSPS without flow control? In case you mean that, you won’t be able to operate the DSPS with sleep when having no flow control. If you prefer to have no flow control, you should run the DSPS in active mode configuration. Otherwise, if you have only RX/TX pins and sleep mode configuration, you will have data loss. Be aware that the DSPS project is designed to operate by default with software and hardware flow control. If you disable the sleep mode and remove the software flow control functionality from your project, I am not 100% sure that there will be no missing data.

Thanks, PM_Dialog

罗密欧
Offline
Last seen:3 months 1 week ago
Joined:2018-07-24 06:58
Hi,MT_dialog

Hi,PM_dialog

As Vadym said, I am in the same situation.
1) The sleep is disabled (ARCH_SLEEP_OFF).
2) Flow control are disabled too:
a) #undef CFG_UART_HW_FLOW_CTRL
b) #undef CFG_UART_SW_FLOW_CTRL

The RX data overflow BLE down after connection with the BLE.
我不关心如果我丢失数据,but I don't want the BLE down from it.
I tried it here, but it didn't work. I don't want sleep mode.
Please tell me specifically how to throw RX overflow data away.
I don't know where to throw it away.
Please give me a specific code.

Please help me don't the BLE down.

Thanks,

PM_Dialog
Offline
Last seen:2 days 4 hours ago
Staff
Joined:2018-02-08 11:03
Hi romeo ,

Hi romeo ,

Can you please try this and let me know?

1) No flow control and only use RX, TX signal

2) Always wake up

2. Change code at "user_sps_device.c"

enum arch_main_loop_callback_ret user_on_system_powered(void)

{

user_sps_sleep_restore();

user_ble_pull(true, NULL);

return KEEP_POWERED; // <-------------------return GOTO_SLEEP;

}

Also, the past forum thread below might be helpful.

https://support.dialog-semiconductor.com/forums/post/dialog-smartbond-bluetooth-low-energy-%E2%80%93-software/read-buffer-overflow

Thanks, PM_DIalog

罗密欧
Offline
Last seen:3 months 1 week ago
Joined:2018-07-24 06:58
Dear PM_DIalog,

Dear PM_DIalog,

The result is the same.
Does Always wake up mean ARCH_SLEEP_OFF?
const static sleep_state_t app_default_sleep_mode = ARCH_SLEEP_OFF;
This is what I did.

We used various methods, but they were not resolved.
baud rate from 115200 to 19200,
Although it blocked RX at the time BLE was Overflow , the connection was no longer received and the connection had to be reconnected.
This is not what we want.

There are many sensors that use only TX,RX. It must be solved.
Please come up with a solution.

Thanks,

PM_Dialog
Offline
Last seen:2 days 4 hours ago
Staff
Joined:2018-02-08 11:03
Hi romeo,

Hi romeo,

If you don’t have a flow control scheme then you won’t be able to control the incoming data and you are going to lose data, so the DSPS isn't designed to operate without flow control. When sending data with BLE interrupts, the 580 isn't able to cope with the BLE and the UART interaction, so you need flow control in order to stop data transition on the other side when needed. In case of sw flow control (CFG_UART_SW_FLOW_CTRL), the sleep does not work as your UART needs to use 16MHz XTAL clock as a source to communicate. In case of hw flow control( CFG_UART_HW_FLOW_CTRL) enabled then the device will go to sleep only if there is 0 byte of data in the data buffer even a single byte of data will keep the device awake. Therefore with hw flow control the device goes to sleep when there is 0 byte of data in the buffer and RTS will toggle when the device will wake up. This is the reason why flow control is so important on DSPS, even with no sleep mode S/W flow control is advised if you don’t want to use the additional CTS / RTS signals. If you would like to remove the sleep mode and set you device into sleep mode, yes, you should modify the app_default_sleep_mode as ARCH_SLEEP_OFF. For getting more information, I would highly suggest you to have a look at the DSPS user manual.

Thanks, PM_Dialog