Android Question BLE RN4871 in UART mode

Put Claude

Active Member
Licensed User
Longtime User
Hi all, all the best for this new year....

BLE RN4871, used as tranparent UART, I can write from device to PC (= module), but can NOT write from PC (= module) to device, did manage it for 3 different BT modules, can 't manage it for this one. Has someone some experience with this module and some code...

Claude
 

Put Claude

Active Member
Licensed User
Longtime User
Think so... worked with your chat example in B4A code, manage 3 diferent modules in B4A code, except this last one...
 
Upvote 0

Put Claude

Active Member
Licensed User
Longtime User
I'm not sure that I understand the configuration. Is the UART connected to the Android device?
When my B4A app on the Android device starts, it set BT on, search for the peripherie-module BLE RN4871, and connect.
Now I can send what-ever from my Android device to the BLE RN4871, that will stream this data to the serial-terminal-port of my PC or MCU, both works fine...
The only thing is, my app on the Android device is not receiving what I send trough BLE RN4871 from serial-terminal-port of my PC or MCU...

Public MLDP_PRIVATE_SERVICE As String = "49535343-fe7d-4ae5-8fa9-9fafd205e455" 'works for RN-BLE RN4871, write to pc
Public MLDP_DATA_PRIVATE_CHAR As String = "49535343-8841-43f4-a8d4-ecbe34729bb3" 'works for RN-BLE RN4871, write to pc

Set notify does not have a error
Dim D() As Byte = msgPkt.GetBytes("UTF8")
delay(125) '125 sending multiple back to back packets fails without this delay.
manager.WriteData(MLDP_PRIVATE_SERVICE, MLDP_DATA_PRIVATE_CHAR, D) 'this works
delay(125)
manager.SetNotify(MLDP_PRIVATE_SERVICE,"49535343-4c8a-39b3-2f49-511cff073b7e" , True) 'NO ERROR
Log("end write")

Only a few hints if you have the time, thanks for answering...

Claude
 
Upvote 0

Put Claude

Active Member
Licensed User
Longtime User
BLE RN4871 2way communication SOLVED

BLE RN4871 is a very tiny BLE with very low power consuming at sleep.
So, I use the chat example from Erel to communicate from device to BLE-module that is connected at TERM/MCU, this in 2 ways.
I managed it for already 3 BLE modules, but this one was a little tricky...
You can use 2 different notify-settings, .... of caorse I took the bad one...
All is working fine now, for those that use the BLE RN4871, below the services and the RIGHT notify...
On the internet, the BLE RN4871 is mentioned as a difficult module...

Public DATA_SERVICE As String = "49535343-fe7d-4ae5-8fa9-9fafd205e455" 'data service for RN-BLE RN4871, write to pc
Public DATA_CHAR As String = "49535343-8841-43f4-a8d4-ecbe34729bb3" 'write writenoresponse
Public DATA_CHAR_NOTI_INDI As String = "49535343-1e4d-4bd9-ba61-23c647249616" 'write writenoresponse Notify Indicate, THIS AS 'SET.NOTIFY'

Claude
 
Upvote 0

ElliotHC

Active Member
Licensed User
Hi Put Claude, I am using the BLE RN4871. Please would it be possible to share some code so that I can get an App connected and running.

Currently using the terminal App with Macros.

Anything you have would be very useful as I'm very new to the B4x platform.

Super thanks.
 
Upvote 0
Top