How to open multiple BLE connection simultaneously with the SmartBASIC AT interface?

Answer

While it is not possible to open multiple virtual serial port (VSP) connection at a time, it is possible to open more than one regular BLE connection.

The SmartBASIC AT interface application provides configuration S registers for setting certain BLE parameters, which are accessible by the ATS command. The default configuration is optimized for establishing one VSP connection with high throughput between two BLE modules. Given this, certain S register have to be modified to accomodate for different applications.

The default configuration has set bit 3 in S register 100 (Start-up Flags), which gives max bidirectional throughput of about 127kbps. As a consequence the number of simultaneous BLE connections is being limited to 1. If you want to use more than one non-VSP BLE connections, bit 3 in S register 100 needs to be cleared and then max connections in S register 126 can be increased.

  • ATS 100=1  (if you want to keep the VSP service being active)
  • ATS 100=0  (if you want to disable the VSP service)

If you need to set other bits in S register 100, like data length extension or phy rate, add them as required. You can use ATS 100? to retrieve the current settings before changing.

Now the number of simultaneous BLE connections can be set in S register 126.

  • ATS 126=8  (set max connections to eight or some other value, the actual maximum number might depend on your particular BLE module)

Then make sure to save and apply the new settings.

  • AT&W  (this will store S register settings permanently)
  • ATZ  (does a soft reset and apply changed settings of S registers)

After the soft reset the new settings are active and you can open several BLE connections simultaneously with AT+LCON command.

See BL65x AT Interface User Guide for more information on S register settings and AT commands.