2023-02-16 19:11:30

by Neacsu Cristian

[permalink] [raw]
Subject: Need a BLE socket to connect to a nRF52832 Nordic (Low energy BT 5)

Hello,

Long story short, I am trying to connect with a linux PC using a
Bluetooth 5 universal adapter (Asus USB-BT500) to a Bluetooth 5 module
PCB, called BT832X which is using a Bluetooth Low Energy Technology
that is using a chip Nordic nRF52832 (see url for the module
documentation https://static1.squarespace.com/static/561459a2e4b0b39f5cefa12e/t/63de8b578e4d7813cde64445/1675529048975/BT832X-p+Product+Specifications.pdf).
Therefore I tried everything, reading docs, sniffing through the
bluetoothctl sources, gatttools sources, and I am not able to open and
connect on a socket on my PC to connect properly.
Usually for legacy Bluetooth stuff, I create a RF_COMM socket, and the
magic is done by itself. No biggie.
Here I tried an L2CAP approach (not sure if I had a proper
configuration), I tried to use the gatttool as it is, without success.
I feel a bit lost.
The remote device is working properly, because using the Nordic
demo Android app (downloadable from Google Play Store), I am able to
communicate with the PCB and exchange packages.
Do you have a functional, very simple sample, or suggestion,
preferably in C, to help me to open a socket and send a data package?
I mean, you have a BLE module, you want to connect with it using
BlueZ, how do you open a socket, how do you configure it, connect to
it and send a byte through it?
Let's keep in mind that I am already able to scan for the
destination address (I created a custom agent in bluetoothctl that is
fishing data using the "scan on" command), so the address that I'm
connecting to is already known.

Thank you and I'm really really looking forward to your reply.

Cristian-Stefan


2023-02-16 21:04:27

by Luiz Augusto von Dentz

[permalink] [raw]
Subject: Re: Need a BLE socket to connect to a nRF52832 Nordic (Low energy BT 5)

Hi Neacsu,

On Thu, Feb 16, 2023 at 11:20 AM Neacsu Cristian
<[email protected]> wrote:
>
> Hello,
>
> Long story short, I am trying to connect with a linux PC using a
> Bluetooth 5 universal adapter (Asus USB-BT500) to a Bluetooth 5 module
> PCB, called BT832X which is using a Bluetooth Low Energy Technology
> that is using a chip Nordic nRF52832 (see url for the module
> documentation https://static1.squarespace.com/static/561459a2e4b0b39f5cefa12e/t/63de8b578e4d7813cde64445/1675529048975/BT832X-p+Product+Specifications.pdf).
> Therefore I tried everything, reading docs, sniffing through the
> bluetoothctl sources, gatttools sources, and I am not able to open and
> connect on a socket on my PC to connect properly.
> Usually for legacy Bluetooth stuff, I create a RF_COMM socket, and the
> magic is done by itself. No biggie.
> Here I tried an L2CAP approach (not sure if I had a proper
> configuration), I tried to use the gatttool as it is, without success.
> I feel a bit lost.
> The remote device is working properly, because using the Nordic
> demo Android app (downloadable from Google Play Store), I am able to
> communicate with the PCB and exchange packages.
> Do you have a functional, very simple sample, or suggestion,
> preferably in C, to help me to open a socket and send a data package?
> I mean, you have a BLE module, you want to connect with it using
> BlueZ, how do you open a socket, how do you configure it, connect to
> it and send a byte through it?
> Let's keep in mind that I am already able to scan for the
> destination address (I created a custom agent in bluetoothctl that is
> fishing data using the "scan on" command), so the address that I'm
> connecting to is already known.
>
> Thank you and I'm really really looking forward to your reply.

I guess for LE what you really want is to use GATT procedures, which
are available via bluetoothctl> menu gatt

> Cristian-Stefan



--
Luiz Augusto von Dentz

2023-02-17 18:08:55

by Neacsu Cristian

[permalink] [raw]
Subject: Re: Need a BLE socket to connect to a nRF52832 Nordic (Low energy BT 5)

Hello,

Thank you for your reply. Yes gatt is the way to go. I tried in
bluetoothctl using gatt.list_attributes gatt.select_attribute,
selecting the tx uuid and the send some bytes. Exactly what I need.
But that is directly in bluetootctl. I don't want to do that by doing
a wrapper around it. How can I implement it directly in C?
Do you have a scenario for a gatt connection in C?

Cristian-Stefan


Cristian-Stefan




On Thu, Feb 16, 2023 at 11:04 PM Luiz Augusto von Dentz
<[email protected]> wrote:
>
> Hi Neacsu,
>
> On Thu, Feb 16, 2023 at 11:20 AM Neacsu Cristian
> <[email protected]> wrote:
> >
> > Hello,
> >
> > Long story short, I am trying to connect with a linux PC using a
> > Bluetooth 5 universal adapter (Asus USB-BT500) to a Bluetooth 5 module
> > PCB, called BT832X which is using a Bluetooth Low Energy Technology
> > that is using a chip Nordic nRF52832 (see url for the module
> > documentation https://static1.squarespace.com/static/561459a2e4b0b39f5cefa12e/t/63de8b578e4d7813cde64445/1675529048975/BT832X-p+Product+Specifications.pdf).
> > Therefore I tried everything, reading docs, sniffing through the
> > bluetoothctl sources, gatttools sources, and I am not able to open and
> > connect on a socket on my PC to connect properly.
> > Usually for legacy Bluetooth stuff, I create a RF_COMM socket, and the
> > magic is done by itself. No biggie.
> > Here I tried an L2CAP approach (not sure if I had a proper
> > configuration), I tried to use the gatttool as it is, without success.
> > I feel a bit lost.
> > The remote device is working properly, because using the Nordic
> > demo Android app (downloadable from Google Play Store), I am able to
> > communicate with the PCB and exchange packages.
> > Do you have a functional, very simple sample, or suggestion,
> > preferably in C, to help me to open a socket and send a data package?
> > I mean, you have a BLE module, you want to connect with it using
> > BlueZ, how do you open a socket, how do you configure it, connect to
> > it and send a byte through it?
> > Let's keep in mind that I am already able to scan for the
> > destination address (I created a custom agent in bluetoothctl that is
> > fishing data using the "scan on" command), so the address that I'm
> > connecting to is already known.
> >
> > Thank you and I'm really really looking forward to your reply.
>
> I guess for LE what you really want is to use GATT procedures, which
> are available via bluetoothctl> menu gatt
>
> > Cristian-Stefan
>
>
>
> --
> Luiz Augusto von Dentz