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()
{
SerialUSB.begin(115200);
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.setDefaultServices(UART_TRANSP_SERVICE);
rn487xBle.reboot() ;
}
}
void loop()
{
if (bleSerial.available()){
SerialUSB.write(bleSerial.read());
}
if (SerialUSB.available()){
bleSerial.write(SerialUSB.read());
}
}
The first thing strange for me is when I connect it with BLE Device explorer (https://play.google.com/store/apps/details?id=no.nordicsemi.android.mcp) 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 (http://ww1.microchip.com/downloads/en/DeviceDoc/50002466A.pdf) transparent UART Mode is activated by issuing the folloing command:
SS,C0
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?
Thanks