Android Question Bluetooth UUIDs

ElliotHC

Active Member
Licensed User
I would very much like to establish something here and I have just one question.

1. Has anyone got a working app using the transparent UART UUIDs?

This doesn't use: Return "0000" & id.ToLowerCase & "-0000-1000-8000-00805f9b34fb"

It uses these UUIDs:

Service
49535343-fe7d-4ae5-8fa9-9fafd205e455
Read
49535343-1e4d-4bd9-ba61-23c647249616
Write
49535343-8841-43f4-a8d4-scbe34729bb3

This doesn't work with all the existing projects I've found, I am hoping that there is a way to use these UUIDs instead. But of course the project example may not lend itself to working with the transparent UART service.
 

ElliotHC

Active Member
Licensed User
Yes, the service is on the list when using the project that connects. There are many services available.

All the projects that send and recieve bytes seem to not use this type of service, they use UUID which have common numbers.

How do I make a project that can send and recieve bytes using the service I need?

I have used project to connect and it is working making connection and showing services available, I need to connect now to transparency UART service and exchange data.
 
Upvote 0

ElliotHC

Active Member
Licensed User
I have used the BLE_Example.zip project that scans & Connects and merged it with code from the BleCentral_B4A.zip project, It's a little bit messy at present but it's working.

Later today, when I've tidied it up I'll post the project as it does exactly what I was looking for initially. So anyone doing a similar project with a BLE module in transparent UART mode will have something working.

Microchip RN_BLE RN4871

Transparent UART Mode.

UUID:

Service
49535343-fe7d-4ae5-8fa9-9fafd205e455
Read
49535343-1e4d-4bd9-ba61-23c647249616
Write
49535343-8841-43f4-a8d4-ecbe34729bb3
 
Upvote 0

ElliotHC

Active Member
Licensed User
I have attached a project which I'm sure many will be able to improve on. As I only started using B4A a couple days ago so I still don't fully understand the syntax.

What this project does:

1. Scan and connect to BLE device
2. Allow 3 individual UUIDs
3. Send Button with "DATA TO SEND GOES HERE" text
4. Receive window

If you are using a Micorchip RN4871 as I am, you will first need to configure it using the host microcontroller.

The default baud rate for the RN4781 and most likely other Microchip BLE module is 115200 so you will need to be able to reach this rate with the host microcontroller.

The RN4871 does not do well with a slight mis-match so if you are getting either it sometimes working or perhaps not at all, you might need to compare the length of the bytes going in and coming out of your module to ensure they are the same.

If you don't have a scope you can keep changing the OSCTUNE bits or frequency offset of your host microcontroller until you get a reliable response from your module.

Once you have a good link with the RN4871(or other BLE Module using Transparent UART) you will need to configure your module, this is done every time on power up by your host microcontroller.

You will need to send at 115200:

[Pseudo Code] (As you might be writing firmware in another syntax)

Power up your RN4871 holding the RESET pin

When you are ready release the RESET pin.

Send "$"
Wait 101 Milliseconds
Send "$$"

Wait for data response ' Now you are in Command mode

Send "+"

Wait for data response ' This turns on Echo, you need this to ensure that you have a reliable data link and no miss-match in frequency.
You can send a nice long string as I have then check it's the same string, if not you can trim your microcontroller frequency or change your baudrate slightly to compensate.

Send "SS,C0" ' You might as I have, needed to send "S" , "S" , "," , "C" , "0" because my hardware serial port on the microcontroller sent the bytes too close together for the RN4871. This enables Transparent UART Mode

Wait for data response

Send "R,1" ' This does a reset to apply your change and when it comes back up it will be in Data mode

Wait for data response. ' You need to do this twice as it will acknowledge the reset then there will be a short time when it comes back on

Now you are ready to use the Transparent UART Service...

Use the Project below as a starting point, the button Sub sends "DATA TO SEND GOES HERE" and data back from your RN4871 goes in to the txtlog.

Any issues getting the RN4871 up and running Message me.
 

Attachments

  • BLE_TRANSPARENT_UART.zip
    11.4 KB · Views: 435
Last edited:
Upvote 0
Top