MiniPCIe Bluetooth 5 IO Card

The mPCIe Bluetooth 5 card features the Laird BL652 module with embedded application support

This application note details how to load a sample application that will scan for advertisement data from sensors and re-transmit new values to the attached COM port.

This requires us to cover the following steps

•    Verify communications with the module
•    Check the loaded firmware version
•    Generate the compile application program using matching compiler
•    Load the program into the module
•    Start the program

We’ve prepared a ZIP file that has most of what we need here :

BL652 Application Pack

To start with we need to establish the module is responding to serial comms, and go on to check the firmware version loaded.


To do this we’ll use Minicom terminal program.


For the EdgeGateway unit there is a udev rule on the demo image that creates a symlink /dev/ttyS1 which points at the correct ttyUSBx port for the module. If you do not have this udev rule available use “dmesg | grep FTDI” to get a list of ttyUSB ports to test against, the correct port will cause the LEDs on the card to flash and the console will report 00 in response to pressing enter.


If using Minicom pressing “CTRL+a u” and “CTRL+a e” key combinations will re-configure the terminal to enable local echo and addition of carriage returns on received data, making this process easier.

Next we need to establish which firmware version the module is running, this is important as the compiler version used to create the loadable application must match the firmware version installed on the module.
Typing : at i 3 ( that’s at[space]i[space]3) and pressing return will report back the modules firmware version.


We have pre-compiled the example scanner application for two firmware versions , other module firmware update ZIPs (including compilers for that version) can be downloaded from the Laird website product page, see links at bottom of page.

To recompile the application you will need a Windows machine, the XComp compiler for the matching firmware version installed on the module and the .sb smartbasic file


Armed with the compiled smart basic program (the .uwc file) we can transfer this and the bash script to our EdgeGateway unit for loading into the module.


Running will generate the file, this is contains a formatted hex dump of the compiled smart basic application and upload commands (using the method outlined in the app note linked to below). If you are using a different system than the EdgeGateway you will need to edit this file to change references for ttyS1 to the correct device.

Once this has been loaded we can then verify the file has been installed using at+dir and launch the application using at+run “scanner”

Once started the module will report back advertisements received, these are cached on the module so advertisements are reported only if they are not in the modules cache.





Installed programs can be auto launched at system start-up in two ways.

The simplest is via command line scripting, to do this add the below lines to a one of the start up scripts e.g. /etc/init.d/

screen -dmS BL652 /dev/ttyS1 115200
screen -S BL652 -X stuff 'AT+RUN "scanner"
screen -S BL652 -X kill

Second is a bit more complex, so needs to be used with care. The module features an active low AutoRun pin, when this pin is active the module will at power up automatically look for a file called $autorun$ and attempt to run it.

The AutoRun pin has been connected to the WDIS pin of the mPCIe card, giving user control over this feaure and is inverted so the default state of the WDIS line (logic high) corresponds to the active state of the AutoRun pin (logic low).  

Once an application called $autorun$ has been loaded it will always be run at startup, in order to regain control and put the module back to command line access mode the following sequence needs to happen :

With the system booted set the GPIO line controlling WDIS to logic 1 (this pulls mPCIe WDIS line to logic low), then toggle the GPIO lines controlling mPCIe emergency reset line (this resets the module, causing it to re-read the AutoRun pin) The module should then be in command line mode, check this by connecting a minicom session and verify the terminal responds to enter as above – consult the product user guide for the respective GPIO lines.

Once this is done the application can be deleted using at+del “$autorun$”

Further support can be obtained directly from the bluetooth module vendor (i.e. Laird) and other sample applications giving different operation are available from their GitHub page linked to below.

Laird BL652 Module Product Page

Laird BL652 smartBASIC Application Walkthrough

Laird BL652 Firmware update

Laird BL652 GitHub Application Samples

Load SmartBasic program into Laird BL652 module App Note


Contact us now to discuss your project

Ready to order, contact us today for pricing or samples

Contact Us