Hi Joseph,
> The main advantage of such a UART service IMHO is that it provides an easy mean to define the packets
format without having to modify/implement a new service within the BLE SOC.
I totally agree with you.
I have been playing with this for a few days now, and I was expecting (mistakenly) some sort of UART available.
I guess the "de facto standard" you mention is the nRF implementation
Nordic Semiconductor Infocenter
for which several clients are available.
nRF UART 2.0 - App su Google Play
An example implementation from SiLabs is descibed here:
https://www.silabs.com/community/thunderboard/knowledge-base.entry.html/2016/04/10/spp-over-ble_bgsc...
NXP delivers its own UART implementation with the KW41 and QN9080 SDKs (example is called wireles_uart), and we have a client implementation available in the IoT toolbox application.
IoT Toolbox - Apps on Google Play
I am not able to understand just by looking at the code whether this is an NXP custom implementation, or matches the nRF implementation. Nevertherless this might be the starting point to wrap an UART over BLE service to the Rapid IoT prototyping. Moreover, I was not able to get the wireless uart example working with QN9080 recently, even though I am sure I did use it in the past.
In the first place I was thinking I would have to implement the "right" protocol on the KW41 code (my aim was to implement a BLE-MIDI controller like described here https://www.novelbits.io/bluetooth-gatt-services-characteristics/ ). But the more I tried, the more I realized that is just not the way the Rapid IoT kit is thought to work: it does not seem you are really supposed to modify the code on the KW41, and to me it was not easy to manipulate the sensors form MCUXpresso (besides I do not like much playing with MCUXpresso). Really trying to write the K64 code seems a nightmare to me, as there are too many software layers (freeRTOS, ATMO, sensors), and the examples are not helping me much in even understanding the structure of the code. Therefore it seemed to me that the most reasonable option was to leverage the existing Rapid IoT IDE to wrap the sensor data into GATT service, and then implement a GATT client (in my case the aim is using a host PC), which eventually might implement a virtual com port.
I believe the "right way" to do that would be to develop a windows GATT application on visual studio, as descibed here
Bluetooth GATT Client - UWP app developer | Microsoft Docs
but with time I grow allergic to MS Visual Studio...
Instead I have tried using python wrappers around existing libraries that expose the GATT protocol
GitHub - peplin/pygatt: Python wrapper for gatttool (from BlueZ) and the BGAPI for accessing Bluetoo...
bleak · PyPI
but it seems the frameworks I found are supposedly only working on on linux, and I was not able to make them run on my machine (pygatt hangs the python interpreter as soon as I try to open a connection. I might try to play with this a bit still but I am less enthusiastic than yesterday about it).
As an alternative that seems working in principle, I have currently being considering using a QN9080 DK board that I had laying around from my previous project ( QN9080DK: A highly extensible platform for application development of QN908x|NXP ), running the ble_shell example. With this I was able to connect to the Rapid IoT kit over BLE, and communicate with the PC over the debug serial port ( I know using the debugger is a little bit cheating ), and reading data from the sensors. I believe the same example should be available also for the KW41 freedom board, and eventually the code should be relatively easily portable between the two ( FRDM-KW41Z |Bluetooth Low Energy/IEEE® 802.15.4 wireless enabled Freedom Development Kit|NXP ). In perspective, I believe I can implement the GATT client on the QN9080, and even process the sensor data to translate the GATT messages into MIDI messages, then redirect the output to the serial debug port, and finally use some "standard" destop application to "virtually plug together" the serial debug port and a virtual MIDI input port.
I hope sharing those information might help you figure out what would be the best option for you too (and maybe suggest a path to add the UART over BLE to the Rapid IoT SDK).
Regards,
MM