How to driver CSR

157 views
Skip to first unread message

lincic...@gmail.com

unread,
Sep 8, 2017, 1:51:51 PM9/8/17
to btstack-dev
Hi,
Matthias
   I want to through Bt-stack to driver bluetooth USB Dongle,However, my microcontroller is unable to drive USB dongle。I would like to ask you, is the USB dongle (CSR) driver in the directory(Btstack-master/Chipset/CSR)?
   
Thanks,
cc lin

Matthias Ringwald

unread,
Sep 8, 2017, 3:31:42 PM9/8/17
to btsta...@googlegroups.com
Hi Lin

Most USB Bluetooth Dongles work without special configuration, eg the CSR or Broadcom ones. 

Bluetooth Controller connected via HCI UART usually need special configuration. chipset/csr contains the code to configure most CSR UART ones. 

platform/libusb contains an HCI USB implementation for larger / POSIX systems using libusb. 

Sent from my iPhone
--
You received this message because you are subscribed to the Google Groups "btstack-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to btstack-dev...@googlegroups.com.
To post to this group, send email to btsta...@googlegroups.com.
Visit this group at https://groups.google.com/group/btstack-dev.
For more options, visit https://groups.google.com/d/optout.

lincic...@gmail.com

unread,
Sep 14, 2017, 3:20:21 AM9/14/17
to btstack-dev
Thank you for your answer. Matthias
     I read the libusb code based on the information you gave me。I know that to drive USB Dongle, I have to understand its drivers. However, when I read usb_open (), 
I could not know how USB was initialized because I failed to find the prototype of the function libusb_init (NULL). Can you give me some advice? Or where 
should I go to find the driver code for USB Dongle?

Thanks,
cc lin
在 2017年9月9日星期六 UTC+8上午3:31:42,Matthias Ringwald写道:

Matthias Ringwald

unread,
Sep 14, 2017, 3:27:22 AM9/14/17
to btsta...@googlegroups.com
Hi Lin

What microcontroller do you want to use? Does the vendor provide an USB Host stack that you can use?

the code in port/libusb makes use of the open-source libusb package for linux-class systems (embedded linux, full linux, macOS): http://libusb.info

libusb_init() jus starts up the libusb stack, but it will be different for the USB stack on your microcontroller. Still, the hci_transport_h2_libusb code can give you an idea what you need to do:
- go over all USB devices and find a Bluetooth dongle
- identify the endpoints (one endpoint for HCI commands, one for HCI Events, two endpoints for incoming/outgoing ACL packets and two more for SCO packets)
- then you need be able to send and receive HCI packets over the correct endpoints.

Best
 Matthias

lincic...@gmail.com

unread,
Sep 15, 2017, 5:08:00 AM9/15/17
to btstack-dev
Hi, 
Matthias

Thanks again for your answer.

The chip I use is M453VG6AE.(http://www.nuvoton.com.cn/hq/products/microcontrollers/arm-cortex-m4-mcus/m453-can-series/m453vg6ae?__locale=zh),I want to use its USBH driver to connect to the CSR USB Dongle.
My idea is to first identify and drive CSR USB Dongle through the USBH driver, and then transplant the bt-stack program to process the communication message.However, I failed, and I couldn't make my USBH recognize 
and drive CSR USB Dongle.I think my CSR USB Dongle driver is not perfect enough. Could you give me some advice?

Thanks,
cc lin


在 2017年9月14日星期四 UTC+8下午3:27:22,Matthias Ringwald写道:

Matthias Ringwald

unread,
Sep 15, 2017, 7:12:52 AM9/15/17
to btsta...@googlegroups.com
Hi Lin

I'm not familiar with the Nuvoton MCUs. We also didn't use BTstack with an USB Dongle on an embedded MCU either, just on desktop (libusb/windows) yet.
If you can explain a specific problem, that's not related to your MCU and its USB Host stack, please post about it. Maybe I or someone else can help.

Best
 Matthias

lincic...@gmail.com

unread,
Dec 19, 2017, 6:54:55 AM12/19/17
to btstack-dev
Hi,
Matthias
    I drive the USB DONGLE (refer to the UUBT program) based on BTSTACK-MASTER, STM32F4DISCOVER.
    I use /example/spp_count.c to implement the connection and data transmission of SPP services.However, I encountered some problems: first, I can read and set other information about CSR USB DONGLE, but I can't read DONGLE local name and local supported commands.Second, the program sends HCI commands 24 0C 03 0C 02 7A, and sometimes it will fail so that the program dies.Third, the connection handle that CSR USB DONGLE connects to other devices is 0x0047 or 0x0048, not the same handle as CC2564 and other devices.Finally, although the device was barely connected to other Bluetooth devices, it could not receive and receive data.
(uubt demo:https://github.com/byly/uubt

Note: test. Txt is debug information

Thanks,
cc lin
test.txt

Matthias Ringwald

unread,
Dec 19, 2017, 8:27:58 AM12/19/17
to btsta...@googlegroups.com
Hi Lin

Thanks for reminding us on your port using USB Host on STM32. I didn't have a look at it yet - or did implement other embedded USB transports yet.

On 19 Dec 2017, at 12:54, lincic...@gmail.com wrote:

Hi,
Matthias
    I drive the USB DONGLE (refer to the UUBT program) based on BTSTACK-MASTER, STM32F4DISCOVER.
    I use /example/spp_count.c to implement the connection and data transmission of SPP services.However, I encountered some problems: first, I can read and set other information about CSR USB DONGLE, but I can't read DONGLE local name and local supported commands.

The local name during startup might as well be empty. BTstack uses it to pick the correct init script on Broadcom chipsets. There, the device type is used as local name.

Second, the program sends HCI commands 24 0C 03 0C 02 7A, and sometimes it will fail so that the program dies.

No idea yet. In the debug log, there are times when one log line is printed before the previous is finished. This might be a bug in the UART console or could indicate logging from ISR context or different threads. Please try to fix this. Any kind of processing from an (unexpected) different context could cause errors. There's also a [15:..:..] timestamp which is weird.

Third, the connection handle that CSR USB DONGLE connects to other devices is 0x0047 or 0x0048, not the same handle as CC2564 and other devices

The HCI Connection handles only need to be unique. It doesn't matter if they differ from the ones on the CC2564

.Finally, although the device was barely connected to other Bluetooth devices, it could not receive and receive data.

Let's see about the other issues - especially the incorrect debug output.

Best
 matthias

(uubt demo:https://github.com/byly/uubt

Note: test. Txt is debug information

Thanks,
cc lin

--
You received this message because you are subscribed to the Google Groups "btstack-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to btstack-dev...@googlegroups.com.
To post to this group, send email to btsta...@googlegroups.com.
Visit this group at https://groups.google.com/group/btstack-dev.
For more options, visit https://groups.google.com/d/optout.
<test.txt>

lincic...@gmail.com

unread,
Dec 20, 2017, 4:03:10 AM12/20/17
to btstack-dev
Hi, 
Matthias

Thanks again for your answer.
I solved some of the problems that plagued me through your answer.
But STM32 sends HCI command 021000. It can't receive USB DONGLE's reply. On Ubuntu, sending command 021000 through hciconfig can get USB DONGLE's reply. Can you answer my doubts?
By the way, the USB dongle I used is CSR 8510A。
In the end, thank you again for your help.
Best
 lin

在 2017年12月19日星期二 UTC+8下午9:27:58,Matthias Ringwald写道:

lincic...@gmail.com

unread,
Dec 21, 2017, 7:35:48 AM12/21/17
to btstack-dev
Hi, 
Matthias
    I changed my driver and met Remote MTU 256 larger than outgoing buffer.
    If you are free, can you see my debug log(debug_log.txt)? In addition, one thing I care about. I send the HCI command hci_le_read_buffer_size read the buffer fetch size is zero, does the buffer need my own settings?


在 2017年12月20日星期三 UTC+8下午5:03:10,lincic...@gmail.com写道:
debug_log.txt

Matthias Ringwald

unread,
Dec 22, 2017, 4:06:58 AM12/22/17
to btsta...@googlegroups.com
Hi

With 021000, you probably refer to "Read Local Commands". In both logs, this command is not sent. Could you post a new log file that shows the part where it is send and what the CSR answers in the next few packets?

The other message " Remote MTU 256 larger than outgoing buffer, only using MTU = 48" is correct. BTstack uses log_info and log_error. This message is a log_info, just so you know what's going on.
You may increase the HCI_ACL_PAYLOAD_SIZE, see http://bluekitchen-gmbh.com/btstack/how_to/#configuration-in-btstack_configh to use a larger buffer.

best
 matthias
Reply all
Reply to author
Forward
0 new messages