LairdCP / Lyra_Firmware

Lyra module binary release page
5 stars 1 forks source link

Behavior of the escape sequence to close VSP connection #8

Closed JoLo33 closed 1 year ago

JoLo33 commented 1 year ago

To close an active VSP connection via uart an escape sequence can be sent. Default settings are 4 characters of '^' with a minimum delay of 250ms between each character.

As I understand, I can send '^^^^' in one and the connection won't close because there was no delay between each character. But if I send '^' wait 500ms '^' wait 500ms '^' wait 500ms '^', the connection will be closed.

But when I send '^^^^^^' wait 500ms '^^^^^^' wait 500ms '^^^^^^' wait 500ms '^^^^^^', the connection will be closed. when I send '^ABC' wait 500ms '^ABC' wait 500ms '^ABC' wait 500ms '^ABC', the connection will be closed.

Problem: We will poll every second or even more data from our device. The data consist of multiple binary bytes, so it could be that an uint8_t value will represent a '^' character in ascii. The data can be polled 4 times and then the connection get terminated.

Is that the correct behavior of the escape sequence? Should the VSP connection be closed only if the escape characters are sent without any other characters in between?

Best Jonas

FlorianBaumgartl-Ezurio commented 1 year ago

Hi Jonas − Many thanks for raising this issue. I want to inform you that our engineering team fixed and changed the behavior for the ^ escape sequence implementation.

In upcoming versions, only ^ <DELAY> ^ <DELAY> ^ <DELAY> ^ <DELAY> ^ and ^ <CR> <DELAY> ^ <CR> <DELAY> ^ <CR> <DELAY> ^ <CR> would terminate the VSP connection. All other ASCII characters (which are sent and received in between) will reset the counter for the ^ escape sequence to 0 again, so something like ^ <DELAY> ^ <DELAY> ABC <DELAY> ^ <DELAY> ^ is no longer causing or resulting in a BLE disconnect.

Please note that by default, ATS 109 (SIO used to control VSP command mode) is set to -1, ATS 111 (Number of '^' characters to send over the UART to trigger a disconnect) to 4, and ATS 210 (VSP Escape Character Minimum Inter-Character Spacing in milliseconds) to 250.

FlorianBaumgartl-Ezurio commented 1 year ago

This is for future reference and documentation purposes only. Bug ID 24367 has been assigned to this issue.

FlorianBaumgartl-Ezurio commented 1 year ago

This issue has been resolved in the Lyra GA2.1 release (https://github.com/LairdCP/Lyra_Firmware/releases/tag/GA2.1).