Porting to v1.6

21 views
Skip to first unread message

Gawie de Vos

unread,
Feb 12, 2024, 8:58:53 AMFeb 12
to btstack-dev
Hi

We are evaluating btstack for our new project. We are using ATWILC3000 from Microchip with a STM32U5 processor.  We already use the ATWILC1000, which is wifi only, with great success.

Microchip supplied a LE_Transparent example, which uses btstack, as part of their support for ATWILC3000. We ported this example to our board, running the STM32U5 processor and it worked as expected. I am not sure of the version of btstack that shipped with this example, but it looks very old, i.e. pre 2020. 

We would like to evaluate the latest version of btstack and therefore we upgraded the btstack source to the latest version - v1.6 as found on your GIT repository. Unfortunately, we are not able to get it working. 

We use uart comms between the processor and ATWILC3000. We are quite confident that this is working as it was working with the old version of btstack and it was kept unchanged.

We can see that all the initialisation commands and starting up routines of the ATWILC3000 are done correctly over uart comms. We can also see that the runloop is called every second. We kept our implementation of the LE_Transparent example exactly the same as what worked with the old version, but it looks like the btstack is not starting up. My guess is that we need to adapt the LE_Transparent impletation a bit to comply with v1.6 - not sure?

That said, we then tried one of your examples - we picked the gat_counter.c example. The result was the same - we can configure the ATWILC3000, but the btstack is not starting.

Our experience with bluetooth as well as with btstack integration, are still very limited and we might just make a simple novice mistake in starting btstack. 

Any help will be highly appreciated.

Thanks,
Gawie

PS I also tried Microchip as they the LE_Transparent demo, but it now two weeks already... no response.  

Gawie de Vos

unread,
Feb 13, 2024, 7:52:32 AMFeb 13
to btsta...@googlegroups.com
Hi

I did some further digging to give you more information into what can be going wrong with my LE_Transparent example.

I wasn't seeing any debug output, so I add the required hci_dump_init(hci_dump_embedded_stdout_get_instance())  call. 
See attached for file called LE_Transparent_V1_6_btstack_HCIdump_DebugLog_enabled.txt. 
By enabling HCI dump, I now can see my BLE device as one of the discovery peripherals in the LightBlue main screen. This was not happening when I had HCI dump NOT enabled. Weird.

Nevertheless, I saw this “att_db.c.247: ATT DB version differs, please regenerate .h from .gatt file or update att_db_util.c” debug output and did some investigating.
Unfortunately, I do not have the .gatt for the example from Microchip. But, it looks like I just have to add 1," to the beginning of the profiledata array - unsure about this?.
Doing this, got rid of the log message, but I still cannot connect.

I then tried your Gatt_counter example, but with the same result. See attached for file called Gatt_counter_V1_6_btstack_HCIdump_enabled.txt for debug output.

Also see attached for my btstack_config.h file.
LE_Transparent_V1_6_btstack_HCIdump_DebugLog_enabled.txt
Gatt_counter_V1_6_btstack_HCIdump_enabled.txt
btstack_config.h

Matthias Ringwald

unread,
Feb 13, 2024, 8:49:02 AMFeb 13
to btsta...@googlegroups.com
Hi Gawie

Thanks for providing the HCI traces. You can convert the text version with the tool btstack/tool/create_packet_log.py to get a .pklg which can be opened in Wireshark.

It would be good to have the original .gatt file for 'LE_Transparent" to be able to regenerate the profile data in the .h file. The generator in btstack/tool/compile_gatt.py more or less copies the contents of the .gatt file into the .h file, so
if you just use the commented CSV lines, you are pretty close.

Anyway, there should be no relevant changes from 1.4 to the current version w.r.t. to these examples.

In the log, BTstack sends a HCI LE Read Remote Feature which is not supported by the WILC3000. I'm not sure if that's causing the problem, but we have updated the code to first check to only send the command if it's supported.
Could you switch to the lastest version of BTstack on the develop branch and re-try the GATT Counter example and post the HCI trace?

Best regards
Matthias
> --
> 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 view this discussion on the web visit https://groups.google.com/d/msgid/btstack-dev/91778910-7E7C-49EA-A282-A5B02FBABE62%40hex.co.za.
> <LE_Transparent_V1_6_btstack_HCIdump_DebugLog_enabled.txt>
> --
> 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 view this discussion on the web visit https://groups.google.com/d/msgid/btstack-dev/91778910-7E7C-49EA-A282-A5B02FBABE62%40hex.co.za.
> <Gatt_counter_V1_6_btstack_HCIdump_enabled.txt>
> --
> 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 view this discussion on the web visit https://groups.google.com/d/msgid/btstack-dev/91778910-7E7C-49EA-A282-A5B02FBABE62%40hex.co.za.
> <btstack_config.h>
> --
> 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 view this discussion on the web visit https://groups.google.com/d/msgid/btstack-dev/91778910-7E7C-49EA-A282-A5B02FBABE62%40hex.co.za.

Gawie de Vos

unread,
Feb 13, 2024, 11:05:16 AMFeb 13
to btsta...@googlegroups.com
Hi Matthias

Thank you for your feedback and support.

I have pulled your development branch - the last commit was "hci: send le read remote features only if supported and if iso streams are enabled”.

I build and run the GATT Counter example with your latest sources, but unfortunately I am still getting the same issue.

See attached for the HCI Trace.

Se also a copy of my ble_transparent.h file. I am trying to work it back to a .gatt file, but I am a bit stuck.

Thanks,
Gawie

Gatt_counter_V_dev_btstack_HCIdump_enabled.txt
Gatt_counter_V_dev_btstack_HCIdump_enabled.pklg
ble_transparent.h

Matthias Ringwald

unread,
Feb 13, 2024, 11:20:16 AMFeb 13
to btsta...@googlegroups.com
Hi Gawie

Please check if you have commit 4639b1e or newer. I forgot to push after sending my previous email. in your log, the HCI LE Read Remote Features is still send, so you probably are on fa4b4d2.
Sorry, please try again with 4639b1e.

Best
Matthias
> --
> 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 view this discussion on the web visit https://groups.google.com/d/msgid/btstack-dev/8ED66394-0536-4390-89DD-F162E95BDA56%40hex.co.za.
> <Gatt_counter_V_dev_btstack_HCIdump_enabled.txt>
> --
> 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 view this discussion on the web visit https://groups.google.com/d/msgid/btstack-dev/8ED66394-0536-4390-89DD-F162E95BDA56%40hex.co.za.
> <Gatt_counter_V_dev_btstack_HCIdump_enabled.pklg>
> --
> 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 view this discussion on the web visit https://groups.google.com/d/msgid/btstack-dev/8ED66394-0536-4390-89DD-F162E95BDA56%40hex.co.za.
> <ble_transparent.h>
>> To view this discussion on the web visit https://groups.google.com/d/msgid/btstack-dev/F459BA67-EA91-4AA9-9F59-CD8463011A29%40gmail.com.
>
>
>
> --
> 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 view this discussion on the web visit https://groups.google.com/d/msgid/btstack-dev/8ED66394-0536-4390-89DD-F162E95BDA56%40hex.co.za.

Gawie de Vos

unread,
Feb 13, 2024, 11:31:51 AMFeb 13
to btsta...@googlegroups.com
Hi Matthias

I just check and I am on the latest commit  -4639b1e4.

I checked the changes and I saw that I have to have ENABLE_LE_ISOCHRONOUS_STREAMS defined for it to be included.

#ifdef ENABLE_LE_ISOCHRONOUS_STREAMS

    // workaround: PAST doesn't work without LE Read Remote Features on PacketCraft Controller with LMP 568B

    if (hci_command_supported(SUPPORTED_HCI_COMMAND_LE_READ_REMOTE_FEATURES)){

        conn->gap_connection_tasks = GAP_CONNECTION_TASK_LE_READ_REMOTE_FEATURES;

    }

#endif


Is this something that I need to define in my config file?

Thanks,
Gawie


-- 
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.

Matthias Ringwald

unread,
Feb 13, 2024, 11:34:17 AMFeb 13
to btsta...@googlegroups.com
Hi Gawie

No, you don't need to add ENABLE_LE_ISOCHRONOUS_STREAMS as it's only supported by very new Controllers.
Without it, and without support for LE Read Remote Feature, BTstack should not send this command to the WILC3000.

Please snd a HCI trace that shows that the command isn't send to check what happens after that.

Best
Matthias
> To view this discussion on the web visit https://groups.google.com/d/msgid/btstack-dev/992466A7-352E-4B2F-A4AE-04A350B82CF4%40hex.co.za.

Gawie de Vos

unread,
Feb 13, 2024, 11:58:08 AMFeb 13
to btsta...@googlegroups.com
Hi Matthias

See attached

Gatt_counter_V_dev_btstack_HCIdump_enabled.txt
Gatt_counter_V_dev_btstack_HCIdump_enabled.pklg

Matthias Ringwald

unread,
Feb 13, 2024, 12:05:44 PMFeb 13
to btsta...@googlegroups.com
HI Gawie

Ok, the command isn't sent, but it doesn't seem to be the problem either.
In the log, I can see an incoming LE connection. Then the remote device sends an ATT MTU Exchange, which is answered by BTstack as expected with the same value.
If that's a remote LE / GATT application, it should send some ATT requests to discover your devices GATT database, but doesn't, no idea why not.

Best idea: please try different remote devices to see if they send ATT queries and/or reboot them.
If you can, please also re-try with the older version of BTstack that worked and also post the HCI trace.

Best regards
Matthias


> On 13 Feb 2024, at 17:57, 'Gawie de Vos' via btstack-dev <btsta...@googlegroups.com> wrote:
>
> Hi Matthias
>
> See attached
>
> --
> 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 view this discussion on the web visit https://groups.google.com/d/msgid/btstack-dev/C16B656B-C94E-4887-9E37-E0DB5AA69716%40hex.co.za.
> <Gatt_counter_V_dev_btstack_HCIdump_enabled.txt><Gatt_counter_V_dev_btstack_HCIdump_enabled.pklg>
>
> Sorry, thought I had the latest in my source folder.
>> To view this discussion on the web visit https://groups.google.com/d/msgid/btstack-dev/562E0B62-23F7-4734-A8AF-A68AFC618958%40gmail.com.
>
> --
> 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 view this discussion on the web visit https://groups.google.com/d/msgid/btstack-dev/C16B656B-C94E-4887-9E37-E0DB5AA69716%40hex.co.za.

Gawie de Vos

unread,
Feb 14, 2024, 2:37:04 AMFeb 14
to btsta...@googlegroups.com
Hi Matthias

I found my issue! When I tried to HCI dump logs with the old version of btstack, I could not get my LE service to work correctly. I also saw something similar when run V1.6 without HCI dump. Also, you mentioned that the remote device should send some ATT requestes, which we are not seeing. 
That made me realise that I might have some other issue. It turns our that my hardware cannot handle the higher baudrates - running at 115200 instead of 230400 solved my issue. See attached for HCI dump file.

I could also get my LE_Transparent example to work correctly with btstack.

Thank you for your help, even if the issue was not in your stack. We have some hardware to check out.

Much appreciated!

Regards,
Gawie

Gatt_counter_V_dev_btstack_HCIdump_enabled_115200_noflow.pklg

Matthias Ringwald

unread,
Feb 14, 2024, 9:09:50 AMFeb 14
to btsta...@googlegroups.com
Hi Gawie

I'm glad you got it working. In general, BTstack uses the CTS/RTS Hardware Flow Control of the Controller, which should avoid any kind of overrun. A quick look into the WILC3000 suggests that it supports RTS/CTS as well.
If possible and not already the case, please enable hardware flow control

Best regards
Matthias
> --
> 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 view this discussion on the web visit https://groups.google.com/d/msgid/btstack-dev/3EF3C5CD-F909-47ED-BFEA-6B55ACFA6D99%40hex.co.za.
> <Gatt_counter_V_dev_btstack_HCIdump_enabled_115200_noflow.pklg>
>> To view this discussion on the web visit https://groups.google.com/d/msgid/btstack-dev/49FA53BB-1A8B-4878-AABD-C789153CA0CE%40gmail.com.
>
>
>
> --
> 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 view this discussion on the web visit https://groups.google.com/d/msgid/btstack-dev/3EF3C5CD-F909-47ED-BFEA-6B55ACFA6D99%40hex.co.za.

Gawie de Vos

unread,
Feb 14, 2024, 10:05:36 AMFeb 14
to btsta...@googlegroups.com
Hi Matthias

Thanks for highlighting the importance of CTS/RTS flow control. Our first generation hardware did not have CTS RTS flow control, but we have added that on the version that I am working with now.

I have successfully tested your GATT counter example using 115200 baud with CTS/RTS flow control. We will investigate why our hardware do not allow us to work at higher baudrates.

Thanks again for your support.

Regards,
Gawie

-- 
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.
Reply all
Reply to author
Forward
0 new messages