Answer
The LWB5+ Bluetooth UART with HCI (Host Controller Interface) supports an internal loopback mode that can be enabled.
There are two loopback modes available for testing purposes: a Local Loopback Mode, and a Remote Loopback Mode.
These modes are defined in the BLUETOOTH CORE SPECIFICATION Version 5.4 | Vol 2, Part F, Section 8
Method: Loopback Test using hcitool to loopback from the Host to the LWB5+ and back to the Host:
To receive a Loopback_Command_Event, you would send an HCI Loopback Command to the Bluetooth device. This command instructs the device to send back a Loopback_Command_Event containing the data from the original command. Here's a generic example using hcitool on Linux:
hcitool -i hci0 cmd 0x03 0x0002 0x01 0x02 0x03 0x04
In this example:
hci0
is the device number of the Bluetooth interface. Adjust this to match your interface number.0x03
is the OGF (Opcode Group Field) for HCI Host Controller & Baseband Commands.0x0002
is the OCF (Opcode Command Field) for HCI Loopback Command.- The remaining bytes
0x01 0x02 0x03 0x04
are the data to be looped back.
This command is not permanent and will only loop back the 4 bytes of data sent with the command. You can manually toggle the RTS or CTS lines to watch the data pause and then resume.