You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@nuttx.apache.org by Tim <Ti...@JTi.uk.com.INVALID> on 2021/03/24 17:34:46 UTC

USB Host and Bluetooth "dongle".

I hope this is not too much if a newbie/dumb question as I have tried to
research this first.

 

I've been playing with Nuttx on a SAMA5D2-XULT board ahead of porting to my
custom board (SAMA5D27C-5M, actually), especially in regard to USB Host
functionality as that's what's drawn me to NuttX in the first place.

 

USB memory sticks are recognised and I can mount them (not got automount to
work, yet - I'm still learning!; and date/time stamping of files written
doesn't seem to work either) - nice to have things like this work "out of
the box"! 

 

I can also build in Bluetooth support and the demo app, but as far as I can
tell there are no actual Bluetooth host drivers in NuttX to properly support
a detected Bluetooth device. My custom board actually has a SiLabs Bluetooth
module on it (connected to the SAM via UART and proven to work) but I quite
like the idea of just using plug-in Bluetooth devices instead :)

 

I can see the device is detected (it gets powered, and dmesg reports stuff)
but no drivers are loaded as best as I can tell. Is that correct or have I
missed something?

 

Drivers are not my strong point but, if I'm right and a driver will be
needed, is a generic Linux driver a good place to start were I to look to
add/create one to NuttX? Or maybe someone has already done this?

 

 

Thanks,

 

Tim.

 


RE: USB Host and Bluetooth "dongle".

Posted by Tim <Ti...@JTi.uk.com.INVALID>.
> >> Hi Tim,
> >>
> >> It depends on what you refers to Bluetooth: is it Bluetooth Classic
> >> or BLE ?
> >>
> >> If you want BT BLE maybe it is better to use a MCU with BLE.
> >>
> >
> > Thanks Alan
> > Bluetooth LE, which is why I put a SiLabs module on the board and have
> > it working, but thought "hey, I might be able to offload the cost of
> > the module to the customer, and they can use a USB dongle if they
> > actually want to use Bluetooth (not all users will)".
> >
> 
> And you can further offload the price of USB Dongle Bluetooth using a MCU
> with BLE.
> 
> Currently you have three MCUs with BLE support on NuttX: ESP32 (driver is
> coming soon), Bouffalo BL-602 and Nordic nRF52832.
> 
> I work at Espressif, so I want to suggest you to consider ESP32! ;-)

Main processor is SAMA5D27C as there are many many peripherals on this custom board (LCD/CAN/GPS/Accelerometers/multiple RGB LED drivers) and a SiLabs/Bouffalo/Nordic SoC will not "cut the mustard" as the main processor; Bluetooth LE is just one of many things not the "main deal". This is why I put the SiLabs SoC on the board as I have used it before with great success and it's not that expensive of course. In this case it's a "network co-processor".

The SIG licensing costs mean - and they have not clarified this to me as yet - that there is a possibility that a board with USB and a Bluetooth stack but no radio module included *may* not need the $8k declaration fee which is completely out of step with the target volumes of this design. I was/am hoping that using a plug-in radio module via USB, of the customer's choice (i.e. not supplied as part of the product) works around the need to declare the product. But this is probably cloud-cuckoo land lol. With hindsight, Wi-Fi may have been a much better choice :(


Re: USB Host and Bluetooth "dongle".

Posted by Alan Carvalho de Assis <ac...@gmail.com>.
Hi Tim,

On 3/25/21, Tim <Ti...@jti.uk.com.invalid> wrote:
>> Hi Tim,
>>
>> It depends on what you refers to Bluetooth: is it Bluetooth Classic or BLE
>> ?
>>
>> If you want BT BLE maybe it is better to use a MCU with BLE.
>>
>
> Thanks Alan
> Bluetooth LE, which is why I put a SiLabs module on the board and have it
> working, but thought "hey, I might be able to offload the cost of the module
> to the customer, and they can use a USB dongle if they actually want to use
> Bluetooth (not all users will)".
>

And you can further offload the price of USB Dongle Bluetooth using a
MCU with BLE.

Currently you have three MCUs with BLE support on NuttX: ESP32 (driver
is coming soon), Bouffalo BL-602 and Nordic nRF52832.

I work at Espressif, so I want to suggest you to consider ESP32! ;-)

BR,

Alan

RE: USB Host and Bluetooth "dongle".

Posted by Tim <Ti...@JTi.uk.com.INVALID>.
> Hi Tim,
> 
> It depends on what you refers to Bluetooth: is it Bluetooth Classic or BLE ?
> 
> If you want BT BLE maybe it is better to use a MCU with BLE.
> 

Thanks Alan
Bluetooth LE, which is why I put a SiLabs module on the board and have it working, but thought "hey, I might be able to offload the cost of the module to the customer, and they can use a USB dongle if they actually want to use Bluetooth (not all users will)".

If not, so be it.



Re: USB Host and Bluetooth "dongle".

Posted by Alan Carvalho de Assis <ac...@gmail.com>.
Hi Tim,

It depends on what you refers to Bluetooth: is it Bluetooth Classic or BLE ?

If you want BT BLE maybe it is better to use a MCU with BLE.

BR,

Alan

On 3/25/21, Tim <Ti...@jti.uk.com.invalid> wrote:
>> Am 24.03.2021 um 18:34 schrieb Tim:
>>
>> > I can also build in Bluetooth support and the demo app, but as far as
>> > I can tell there are no actual Bluetooth host drivers in NuttX to
>> > properly support a detected Bluetooth device. My custom board actually
>> > has a SiLabs Bluetooth module on it (connected to the SAM via UART and
>> > proven to work) but I quite like the idea of just using plug-in
>> > Bluetooth devices instead :)
>>
>> Bluetooth is quite complex. You will have to deal with several layers:
>>
>> 1. Hardware driver (like Ethernet Hardware driver) 2. Low Level Protocol
>> Stack (HCI, like network TCP/IP layer) 3. High Level Protocol Stack
> ("Profiles",
>> like network mail, web, ntp, nfs application protocols)
>>
>> USB dongles usually implement the hardware driver and the low-level
>> protocol stack (HCI). The computer has to run the high level protocol
> stack.
>
> [>]  Understood, of course. The documentation in NuttX regarding Bluetooth
> is superficial and I am probably guilty of assumption and naivety! Because
> there is Host device support, and there are Bluetooth tools and drivers,
> and
> because Linux itself has a Bluetooth stack I leapt to the conclusion that
> Nuttx probably had a stack, just not the "link" between it and the detected
> USB device (i.e. a relevant USB driver, which are available in the Linux
> source trees).
>
>>
>> Other modules, especially the serial ones, implement the whole stack:
>> hardware driver, low-level stack, and one or more profiles (SPP,
> audio,...). If
>> you only need SPP, you really should use these modules.
>> This allows you to write only 100 lines of code instead of 10000.
>
> [>] My custom board has a SiLabs SoC on-board. I have developed LE
> applications using custom GATT on these before very successfully and it has
> a UART link to my SAM processor running NuttX. I will probably stick with
> that.
>
> The reasons for considering using a USB Bluetooth device:
> a) reduces unit costs, when not everyone wants to use Bluetooth
> b) existence of (proven working on my custom board, using USB C) host
> support so it's over the first hurdle compared to the Bare Metal approach I
> had been taking
> c) Trying to steer through the Bluetooth SIG nightmare of registrations and
> fees...but that's another story!
>
>
>>
>> fchk
>
>
>

RE: USB Host and Bluetooth "dongle".

Posted by Tim <Ti...@JTi.uk.com.INVALID>.
> Am 24.03.2021 um 18:34 schrieb Tim:
> 
> > I can also build in Bluetooth support and the demo app, but as far as
> > I can tell there are no actual Bluetooth host drivers in NuttX to
> > properly support a detected Bluetooth device. My custom board actually
> > has a SiLabs Bluetooth module on it (connected to the SAM via UART and
> > proven to work) but I quite like the idea of just using plug-in
> > Bluetooth devices instead :)
> 
> Bluetooth is quite complex. You will have to deal with several layers:
> 
> 1. Hardware driver (like Ethernet Hardware driver) 2. Low Level Protocol
> Stack (HCI, like network TCP/IP layer) 3. High Level Protocol Stack
("Profiles",
> like network mail, web, ntp, nfs application protocols)
> 
> USB dongles usually implement the hardware driver and the low-level
> protocol stack (HCI). The computer has to run the high level protocol
stack.

[>]  Understood, of course. The documentation in NuttX regarding Bluetooth
is superficial and I am probably guilty of assumption and naivety! Because
there is Host device support, and there are Bluetooth tools and drivers, and
because Linux itself has a Bluetooth stack I leapt to the conclusion that
Nuttx probably had a stack, just not the "link" between it and the detected
USB device (i.e. a relevant USB driver, which are available in the Linux
source trees).

> 
> Other modules, especially the serial ones, implement the whole stack:
> hardware driver, low-level stack, and one or more profiles (SPP,
audio,...). If
> you only need SPP, you really should use these modules.
> This allows you to write only 100 lines of code instead of 10000.

[>] My custom board has a SiLabs SoC on-board. I have developed LE
applications using custom GATT on these before very successfully and it has
a UART link to my SAM processor running NuttX. I will probably stick with
that.

The reasons for considering using a USB Bluetooth device:
a) reduces unit costs, when not everyone wants to use Bluetooth
b) existence of (proven working on my custom board, using USB C) host
support so it's over the first hurdle compared to the Bare Metal approach I
had been taking
c) Trying to steer through the Bluetooth SIG nightmare of registrations and
fees...but that's another story!


> 
> fchk



Re: USB Host and Bluetooth "dongle".

Posted by Frank-Christian Kruegel <nu...@istda.com>.
Am 24.03.2021 um 18:34 schrieb Tim:

> I can also build in Bluetooth support and the demo app, but as far as I can
> tell there are no actual Bluetooth host drivers in NuttX to properly support
> a detected Bluetooth device. My custom board actually has a SiLabs Bluetooth
> module on it (connected to the SAM via UART and proven to work) but I quite
> like the idea of just using plug-in Bluetooth devices instead :)

Bluetooth is quite complex. You will have to deal with several layers:

1. Hardware driver (like Ethernet Hardware driver)
2. Low Level Protocol Stack (HCI, like network TCP/IP layer)
3. High Level Protocol Stack ("Profiles", like network mail, web, ntp, 
nfs application protocols)

A complete stack fron top to bottom has a code size of several 10000 
lines of code.

USB dongles usually implement the hardware driver and the low-level 
protocol stack (HCI). The computer has to run the high level protocol stack.

Other modules, especially the serial ones, implement the whole stack: 
hardware driver, low-level stack, and one or more profiles (SPP, 
audio,...). If you only need SPP, you really should use these modules. 
This allows you to write only 100 lines of code instad of 10000.

fchk


Re: USB Host and Bluetooth "dongle".

Posted by "Matias N." <ma...@imap.cc>.
Not entirely sure about your scenario here, but if the dongle simply expects HCI communication and you manage
to get a /dev/ttyUSB0 or whatever on NuttX side, then you should be able to use the bt_uart bridge to expose the controller
to NuttX. From then on, you can choose to use NuttX host layer or an external one such as nimBLE.

Best,
Matias

On Wed, Mar 24, 2021, at 14:34, Tim wrote:
> I hope this is not too much if a newbie/dumb question as I have tried to
> research this first.
> 
>  
> 
> I've been playing with Nuttx on a SAMA5D2-XULT board ahead of porting to my
> custom board (SAMA5D27C-5M, actually), especially in regard to USB Host
> functionality as that's what's drawn me to NuttX in the first place.
> 
>  
> 
> USB memory sticks are recognised and I can mount them (not got automount to
> work, yet - I'm still learning!; and date/time stamping of files written
> doesn't seem to work either) - nice to have things like this work "out of
> the box"! 
> 
>  
> 
> I can also build in Bluetooth support and the demo app, but as far as I can
> tell there are no actual Bluetooth host drivers in NuttX to properly support
> a detected Bluetooth device. My custom board actually has a SiLabs Bluetooth
> module on it (connected to the SAM via UART and proven to work) but I quite
> like the idea of just using plug-in Bluetooth devices instead :)
> 
>  
> 
> I can see the device is detected (it gets powered, and dmesg reports stuff)
> but no drivers are loaded as best as I can tell. Is that correct or have I
> missed something?
> 
>  
> 
> Drivers are not my strong point but, if I'm right and a driver will be
> needed, is a generic Linux driver a good place to start were I to look to
> add/create one to NuttX? Or maybe someone has already done this?
> 
>  
> 
>  
> 
> Thanks,
> 
>  
> 
> Tim.
> 
>  
> 
>