BLE module with serial API built in? - Page 1
Forum section: electronics / general

author: mark03
author_rank: Frequent Contributor
timestamp: April 02, 2024, 03:34:17 am
content: Long ago I used a bluetooth module which shipped with some firmware allowing easy interfacing to a host MCU. There was a binary API running over SPI or UART where you could send it commands to set up the GATT services and so on. It didn't require building a separate application to run on the module processor; the pre-loaded firmware was enough.Is there any modern BLE module that works like this? I just need to add BLE connectivity to an existing project and I would really like to avoid getting tooled up for a whole extra MCU. I'm planning to use connection-oriented channels (L2CAP COC) to transfer data to a PC.

author: Psi
author_rank: Super Contributor
timestamp: April 02, 2024, 04:04:20 am
content: There are modules that support BLE functions all done over UART.

author: shabaz
author_rank: Frequent Contributor
timestamp: April 02, 2024, 04:42:08 am
content: It sounds like you're looking for something like Laird BT860, which does offer HCI over UART. Available from Mouser for about $10 in single qty.However if you want something very lightweight for your microcontroller, then there are simpler interfaces.For example, Silabs had quite a convenient range, called BGX that uses very simple AT commands. However it's EOS, and the replacement is Laird Lyra, e.g. part code 453-00090R ($6 in single qty, $5 in 1000 qty). I've not used Lyra, but have used BGX13P in the past, it was easy to use, and I believe Lyra can use the same identical serial AT commands.If you really want to save costs then there is DA14531MOD, ($5 single qty, but $3 in 1000 qty) and it can have special firmware loaded into it, called CodeLess, which allows simple AT commands to be used to control it. Otherwise, by default it can be used as a normal microcontroller with BLE. I've only used it with C code as a normal microcontroller, so I don't know how good/bad the CodeLess feature is. The main downside of the DA14531MOD is that it really is extremely basic, not a lot of compute power, but that depends on your needs. The Lyra product is likely a lot more powerful, but it costs more.

author: mark03
author_rank: Frequent Contributor
timestamp: April 02, 2024, 04:55:01 pm
content: I don't know that it needs to be quite as simple as AT commands. The host processor is a STM32L4 which is doing a fair bit of signal-processing work, but ought to have enough cycles left over for this.I finally remembered the API I used before, while looking at Silabs stuff. It was called BGAPI and I think whichever company had it was acquired by Silabs. It appears that their new parts still use BGAPI, and they support L2CAP COCI haven't played around at the HCI level so couldn't say if that would be too low or not. But isn't that a legacy Bluetooth thing? Is there such a protocol as HCI for BLE?

author: selcuk
author_rank: Frequent Contributor
timestamp: April 02, 2024, 09:39:16 pm
content: You can use an ESP32 module flashed with open source esp-at firmware. esp-at has BLE, classic Bluetooth, Wi-Fi and Ethernet controlled with AT commands. It runs like a modem. But you need to build and flash the firmware.https://docs.espressif.com/projects/esp-at/en/latest/esp32/AT_Command_Set/BLE_AT_Commands.html

author: shabaz
author_rank: Frequent Contributor
timestamp: April 02, 2024, 09:52:09 pm
content: Please take the attached diagram with a pinch of salt (it was just some personal notes, I may have got it wrong)I was under the impression that HCI was used at the interface shown with the green dashed line, for BLE, but my understanding could be completely wrong there.I've never worked with HCI, I've always just gone with the simpler AT commands that some of the BLE chipsets have offered, or alternatively just used the C SDK for BLE, i.e. just directly used as a microcontroller.I think I may have used BGAPI, I can't recall in detail. It may be the same as what they now callXpress command APIbut I'm fuzzy on it since it was so long ago.

author: NaDobraNich
author_rank: Regular Contributor
timestamp: April 02, 2024, 11:48:28 pm
content: UBlox has a "Uconnect" which is AT Commands over UART with some interesting features. A transparent "data mode" and a you're in control "command mode".

author: mark03
author_rank: Frequent Contributor
timestamp: April 03, 2024, 04:59:41 pm
content: Quote from: shabaz on April 02, 2024, 09:52:09 pmAh, thanks for this. Some googling for "BGX" (Bluetooth Xpress) clarified the difference between BGAPI and BGX. It looks like BGAPI is the somewhat lower-level API which is more capable, whereas BGX is more like the AT command sets with fairly limited functionality but a very easy set up. Different Silabs modules support one or the other.I think I will give BGAPI a go since I used it once before. If I were going to develop from scratch I think I would use Nordic but I really don't want to spend the timeNext thing to figure out is if I can do this feasibly without hardware flow control. I left myself a header with UART TX/RX but no RTS/CTS. Should be a conservative approach that will prevent filling the module buffer. Hopefully.