BTStack Master Porting Process STM32F765-CC264B Chip

224 views
Skip to first unread message

yavuz kağan topak

unread,
Dec 18, 2017, 5:47:37 AM12/18/17
to btstack-dev
Hi,

I wan to port btstack project for my stm32f765 and CC264B bluetooth chip. After reading the porting document, and apply all steps Keil compiler gives following link error:

 - Undefined symbols btstack_chipset_256x_lmp_subversion (referred from port.o)
 - Undefined symbols btstack_tlv_set_instance (referred from port.o)
 - Undefined symbols le_device_db_tlv_configure (referred from port.o)

After searching in the BTStack master folder I cannot find these function which gives compiling link error except prototypes. I think, I have missed some important
porting settings but re-check the port processes which I've done, I cannot find the solution.

Notes: 
 * Operating system Windows 7
 * Compiler: Keil
 * STM32f765 arm cortex M7 
 * Bluetooth chip: TI CC2564B

Can you help ? 

Best Regards, Thank you

Yavuz Kagan Topak

Matthias Ringwald

unread,
Dec 18, 2017, 5:57:28 AM12/18/17
to btsta...@googlegroups.com
Hi Yavuz

Looks like you're close.


On 18 Dec 2017, at 11:44, yavuz kağan topak <yavuz.ka...@gmail.com> wrote:

Hi,

I wan to port btstack project for my stm32f765 and CC264B bluetooth chip. After reading the porting document, and apply all steps Keil compiler gives following link error:

 - Undefined symbols btstack_chipset_256x_lmp_subversion (referred from port.o)

That's part of bluetooth_init_cc2564B_1.6_BT_Spec_4.1.c generated by chipset/cc256x/convert_bts_init_scripts.py

 - Undefined symbols btstack_tlv_set_instance (referred from port.o)
Just add src/btstack_tlv.c (that's a new, minor change)

 - Undefined symbols le_device_db_tlv_configure (referred from port.o)
Please add src/ble/le_device_db_tlv.c (or use le_device_db_memory.c for a first test)

Good luck! 
 Matthias

yavuz kağan topak

unread,
Dec 18, 2017, 7:14:11 AM12/18/17
to btstack-dev
Hi Mattihias,

After I have followed steps in your answer, I have solved the 2 link error problems thanks to you except
 
- "Undefined symbols btstack_tlv_set_instance (referred from port.o)"

 since I cannot find the btstack_tlv.c source file which is not exist btstack master folder or github. Where can i find btstack_tlv.c file?

Thank you for fast answering !
Best Regards

18 Aralık 2017 Pazartesi 13:57:28 UTC+3 tarihinde Matthias Ringwald yazdı:

Matthias Ringwald

unread,
Dec 18, 2017, 8:00:10 AM12/18/17
to btsta...@googlegroups.com
Hi

Oh.. looks like I've forgot the file. It's on master now.

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

yavuz kağan topak

unread,
Dec 19, 2017, 5:14:14 AM12/19/17
to btstack-dev
Hi,

After your answer I have checked the file "btstack_tlv.c" in the https://github.com/bluekitchen/btstack/tree/master/src link but still cannot found.

Can you send me a link that contains "btstack_tlv.c" file please ? 

Thanks for answering...

18 Aralık 2017 Pazartesi 16:00:10 UTC+3 tarihinde Matthias Ringwald yazdı:

Matthias Ringwald

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

Sorry. I forgot to push the commit. it's there now. 

Best
 matthias

yavuz kağan topak

unread,
Dec 19, 2017, 8:54:28 AM12/19/17
to btstack-dev
Hi Matthias,

Thank you very much, you're the best...

19 Aralık 2017 Salı 16:19:13 UTC+3 tarihinde Matthias Ringwald yazdı:

yavuz kağan topak

unread,
Dec 20, 2017, 2:23:22 AM12/20/17
to btstack-dev
Hi Matthias,

Finally, I have solved link error problem and following your steps in the link https://bluekitchen-gmbh.com/btstack-port-for-stm32-f4-discovery-board-with-cc256x/. But, If I use the steps in the above link bt_stack_main function only have prototype and compiler gives an error about that. To solve this, I have added gap_inquiry.c because btstack_main functions exist in this file. After that, I have compared the port.c and gap_inquiry.c files that causes the few question that I want to ask:

 1 - If I don't add gap_inquiry.c or other example source file, compiler gives an error about "btstack_main(int argc, const char **argv[])" function since
      there is only prototype definition of this function in port.c file. I am using CMSIS_RTOS in my project and this function have to be thread or not ?
 2 - For example, I have added gap_inquiry.c source file, and after closer look multiple static function definitions exist between port.c and gap_inquriy.c
      which is packet_handler function. The question I want to ask that which way can I follow the communicate CC2564B BT chip with BT_Stack library?

 3 - Is the port.c file enough for communicate the bluetooth chip without using btstack_main function ? 
      
Thank you...

19 Aralık 2017 Salı 16:19:13 UTC+3 tarihinde Matthias Ringwald yazdı:

Matthias Ringwald

unread,
Dec 21, 2017, 10:04:39 AM12/21/17
to btsta...@googlegroups.com
Hi

The idea with btstack_main is to provide examples that can be used with all BTstack ports without further modification. Port.c configure the hardware and provides the drivers to talk to the Bluetooth Controller, then it calls btstack_main() which represents the main application.

BTstack is single-threaded. If you use a RTOS, BTstack can run on a dedicated BTstack thread and all calls to BTstack APIs must be made from that thread.

As all APIs are asynchronous, the result to API calls are delivered via packet handlers. Therefore, there are one or more packet handler in each application or Bluetooth protocol layer.

Best
 Matthias 

yavuz kağan topak

unread,
Dec 22, 2017, 3:14:08 AM12/22/17
to btstack-dev
Hi,

Thank you for answer Matthias. 

Finally, I have achieved running the example gap_inquiry and spp_and_le_counter example yesterday. But, I have problem for spp_and_le_counter project that is;
my laptop and bluetooth chip were connected smoothly in first try. Somehow, If I try to disconnect and connect process respectively in the second time, I got the error message after this log in my project:

 hci.c: HCI_EVENT_LINK_KEY_REQUEST
 hci.c: responding to link key request
 
 HARD FAULT HANDLER...

This is the I understand from the above log: In this example, after first connection, project write the some device specific data into the stm32 flash and after the re-connect process, project try to read the device specific data from the flash and this gives an HARD FAULT ERROR. 

The question I want to ask, Is there any example in BTStack running without flash configuration ? Because, F4 to F7 implementation process was very hard for me. In order to understand the basic implementation of the bluetooth profiles easily, I want to implement more simple example about SPP interface.

Thank you...

Best

21 Aralık 2017 Perşembe 18:04:39 UTC+3 tarihinde Matthias Ringwald yazdı:

Matthias Ringwald

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

sounds good. You may use btstack_link_key_db.c instead of btstack_link_key_db_tlv.c to only store the keys in memory (until reset).
You would then replace btstack_link_key_db_tlv_get_instance with btstack_link_key_db_memory_instance

After that's working, you can go back and have a look at why it's failing. I guess single-stepping through the code in a debugger to get a link key from the TLV will tell you why it's crashing and maybe even how to fix it.

Best
 Matthias

yavuz kağan topak

unread,
Dec 25, 2017, 7:34:11 AM12/25/17
to btstack-dev
Hi,

Thank you very much Matthias. Under your guidance, I have learnt many things. After your answer, I have searched the file "btstack_link_key_db.c" in your github
master, but, I cannot find the source file except header file "btstack_link_key_db.h". Can you send me link that contains "btstack_link_key_db.c"? Maybe, you forgot the push this source file, accidently.

Thank you...

Best

22 Aralık 2017 Cuma 12:10:22 UTC+3 tarihinde Matthias Ringwald yazdı:

yavuz kağan topak

unread,
Dec 25, 2017, 7:39:18 AM12/25/17
to btstack-dev


22 Aralık 2017 Cuma 12:10:22 UTC+3 tarihinde Matthias Ringwald yazdı:
Hi

sounds good. You may use btstack_link_key_db.c instead of btstack_link_key_db_tlv.c to only store the keys in memory (until reset).
You would then replace btstack_link_key_db_tlv_get_instance with btstack_link_key_db_memory_instance

By the way, I have solved the problem that causes Hard Fault. This is not about in your code, just my personal inattention in porting implementation F4 to F7 :)

Matthias Ringwald

unread,
Dec 25, 2017, 8:50:08 AM12/25/17
to btsta...@googlegroups.com
Hi

Sorry, i wanted to suggest btstack_link_key_db_memory.c

Sent from my iPhone

yavuz kağan topak

unread,
Dec 26, 2017, 6:33:06 AM12/26/17
to btstack-dev
Hi,

I have used btstack_link_key_db_memory.c as you said, and this works smoothly. After that I have looked closely, there is file btstack_link_key_db_static.c where you have written this comment: 
Static Link Key implementation to use during development/porting:

Therefore, in order to learn link key implementation, I have used its function and connect my laptop. First, process has no problem, and I have added link key of my device that is coming from the log in btstack_link_key_db_static.c file: 

static const link_key_entry_t link_key_db[] = {
// Example enry
{ "11:22:33:44:55:66", "11223344556677889900112233445566", 1},
// Add new link keys here..
};

After compiling and flashing operation, the connection failed error is given. But, If I never add the link key above code section there isn't given an error for connection process. In addition, I have observed that link key of my device that I read from the log always change. I think there is a encryption process and this always changes.

In flash programming, the link key does not change, and there isno error for second connection.
In static programming, the link key always changes, why ? Can you help me ?

Thank You

Best

Yavuz




25 Aralık 2017 Pazartesi 16:50:08 UTC+3 tarihinde Matthias Ringwald yazdı:

yavuz kağan topak

unread,
Feb 1, 2018, 12:30:43 AM2/1/18
to btstack-dev
Hi,

I am trying to develop SPP in  multi-threaded environment. There is no error while connection process with my laptop.
But, if I disconnect and after that  using hci_power_control(HCI_POWER_OFF) function in order to shut down BT chip,
and re-open the classic scenario connection process is failed with my laptop.

The question is, Which function should I use in order to open and shut down the BT chip after disconnection process?

Thanks

Yavuz

25 Aralık 2017 Pazartesi 16:50:08 UTC+3 tarihinde Matthias Ringwald yazdı:

Matthias Ringwald

unread,
Feb 5, 2018, 4:21:58 PM2/5/18
to btsta...@googlegroups.com
Hi Yavuz

Power on/off is a full restart of the stack. If you just get disconnected, you don't need to reboot the stack. 

If you just want to re-connect to a previous device, have a look at what the code does in response to the 'HCI_STATE_WORKING' event.
If you really need to power off the module, e.g. because you need to save energy, please explain what's failing when starting up with hci_power_control(HCI_POWER_ON) again.

Best
 Matthias

yavuz kağan topak

unread,
Feb 12, 2018, 5:22:23 AM2/12/18
to btstack-dev
Hi Matthias,

I have solve the second connection problem by using your suggestion. There is no failing thanks to you. In order to obtain low power process, I need to work a little. Now, this process enough for me.

Thank you

Best
Yavuz

6 Şubat 2018 Salı 00:21:58 UTC+3 tarihinde Matthias Ringwald yazdı:
Reply all
Reply to author
Forward
0 new messages