BLE Transparent UART how to?

Hi all

I’m trying to use the RN4871 chipset of ExpLoRer as tranparent UART
My sketch is the following:

#include "RN487x_BLE.h"
#define bleSerial Serial1
void setup()
rn487xBle.hwInit() ;
 bleSerial.begin(rn487xBle.getDefaultBaudRate()) ;
 rn487xBle.initBleStream(&bleSerial) ;
  rn487xBle.setDiag(SerialUSB) ;
if (rn487xBle.swInit())
 rn487xBle.enterCommandMode() ;
 rn487xBle.stopAdvertising() ;
 rn487xBle.setAdvPower(3) ;
 rn487xBle.setSerializedName("Microchip") ;
 rn487xBle.clearAllServices() ;
rn487xBle.reboot() ;

void loop()
  if (bleSerial.available()){
  if (SerialUSB.available()){

The first thing strange for me is when I connect it with BLE Device explorer ( I can’t see any characteric with READ attribute in configured service.

After some troobleshooting I’ve seen this in RN87x_CONS.h

#define UART_TRANSP_SERVICE   0x40

But, accoding to the documentation ( transparent UART Mode is activated by issuing the folloing command:
So I try to change my code from rn487xBle.setDefaultServices(UART_TRANSP_SERVICE); to rn487xBle.setDefaultServices(0xC0); but unfortunatly the result is the same…

In addition, if from a Linux Box I connect it with gatttool (gatttool -b mac_addr -I) nothing is comming when I push something t SerialUSB
On the reverse side, If I write something to the characteristic declare in READ, NOTIFY it’s comming to SerialUSB

What’s wrong with my sketch? How can have a bi-directionnal communication and us the RN4871 as transparent UART?


1 Like