DA14580,Linux HCI / Bluez

13 posts / 0 new
Last post
spectrum
Offline
Last seen:5 years 9 months ago
加入:2015-03-11 18:26
DA14580,Linux HCI / Bluez

Dear all,

i am trying to port da14581 patch RAM code to da14580, that have different ROM content.

So, here whai i did until now:

1. Started from DA14581_HCI_Release_v.3.110.2.12 package for da14581
2. On the uVision project i applied DA14580 scatter file from DA1458x_SDK_3.0.6
3. On the uVision project i applied "rom_symdef" as per DA14580 apps into DA1458x_SDK_3.0.6
4.使用Patched HCiatTach加载,我可以正确上传固件
5. I can compile without errors. After FW is uploaded and executed, there is no HCI reply, so hciattach times out.
6.实际上,代码执行锁定到“RWIP_INIT”,如下所示:

#ifdef RADIO_580
iq_trim_from_otp();
# endif

/ *
************************************************************************************
* BLE initialization
************************************************************************************
*/

init_pwr_and_clk_ble();
//诊断();

// rf_init(&rwip_rf);
// SetBits32(BLE_RADIOCNTL1_REG, XRFSEL, 3);

#if UNCALIBRATED_AT_FAB
SetBits16(BANDGAP_REG, BGR_TRIM, 0x0); // trim RET Bandgap
SetBits16(BANDGAP_REG, LDO_RET_TRIM, 0xA); // trim RET LDO
SetWord16(RF_LNA_CTRL1_REG, 0x24E);
SetWord16(RF_LNA_CTRL2_REG, 0x26);
SetWord16(RF_LNA_CTRL3_REG, 0x7);
SetWord16(RF_VCO_CTRL_REG, 0x1);
SetBits16(CLK_16M_REG, RC16M_TRIM, 0xA);
# endif

// Initialize BLE stack
NVIC_ClearPendingIRQ(BLE_SLP_IRQn);
NVIC_ClearPendingIRQ(BLE_EVENT_IRQn);
NVIC_ClearPendingIRQ(BLE_RF_DIAG_IRQn);
NVIC_ClearPendingIRQ(BLE_RX_IRQn);
NVIC_ClearPendingIRQ(BLE_CRYPT_IRQn);
NVIC_ClearPendingIRQ(BLE_FINETGTIM_IRQn);
nvic_clearpendingirq(ble_grosstgtim_irqn);
nvic_clearpendingirq(ble_wakeup_lp_irqn);

>>> rwip_init(error);

#if((ble_app_present == 0 || ble_integrate_host_gtl == 1)&& ble_host_present)
patch_gtl_task();
# endif// #if (BLE_APP_PRESENT == 0 || BLE_INTEGRATED_HOST_GTL == 1)

Every help is appreciated.
最好的祝福,
angelo

spectrum
Offline
Last seen:5 years 9 months ago
加入:2015-03-11 18:26
I share my progresses,

I share my progresses, hopefully they can be useful for someone, and maybe dialog can support me a bit on this.

Actually, i see debugging over uart, that all the code executes in the arch_main.c main loop.
召唤后

#if(ble_hcic_itf)
// In split mode, initialize the HCI
hci_init(rwip_eif_get(RWIP_EIF_HCIC));
# endif//BLE_HCIC_ITF

in rwble.c , i cannot use uart anymore for debugging, since it's controlled from the HCI layer.
So code executes, but there is no reply to first HCI commands sent to the module
在FW更新之后。
HCI part is only available currently as object.
By scope i see FW is sent, justafter the CRC OK id displayed, i see linux sending the first HCI command, 4 bytes on TX line, and from module side only some ack bits after each bite received.

JE_Dialog
Offline
Last seen:6 hours 29 min ago
Staff
加入:2013-12-05 14:02
在那里,我们知道了

在那里,我们知道了issue related to Blue Z... "The reason is that BlueZ sends some HCI commands for standard and not BLE controller and this gets our device mixed up".. We are looking into a patch, but this is some weeks away right now. BR JE_Dialog

spectrum
Offline
Last seen:5 years 9 months ago
加入:2015-03-11 18:26
Hi, good to know, i am

Hi, good to know, i am progressing, if i succed i can publish the patch then.

What i have seen is:
使用示波器,我看到有一个UART回复,但是2个字节,0x04和0x10。这就是当前HCIATTACH未显示任何内容并超时的原因,因为HCIATTACH.C READ_HCI_EVENT()期望其他字节,至少3(字节3是Params Count)。

So i modified hciattach to see what the return code is: i get

bash-3.2# .hciattach ttymxc1 dialog 115200
Downloading hci-firmware.bin...
CRC OK (cd).
Sending HCI reset before starting conversation...
Dialog custom protocol: EVT_HARDWARE_ERROR

硬件错误。代码是否可能是DA14581并检查某些产品ID,或者我的模块可能损坏?与此同时,我在另一个板上测试。

spectrum
Offline
Last seen:5 years 9 months ago
加入:2015-03-11 18:26
好吧,HW错误只是到期

好吧,HW Error只是由于全局“错误”变量无初始化。
Seems i can send HCI messages if queued from main loop app, but HCI thread / module itself is not replying to any message i send.

This seems to be related to the different ROM kernel code of da14580.

spectrum
Offline
Last seen:5 years 9 months ago
加入:2015-03-11 18:26
Hi all,

Hi all,
progressed again.
- still with a mix of da14580, da14581 code (DA14581_HCI_Release_v.3.110.2.12) and SDK 3.0, c file / scatter file mix, and keeping da14580 symdefs
- also, i replaced some uart functions from uart.c driver
- also, i added HCI tasks in the last part of the jump table, that was not defined for da14580
- also, for misterious reasons still to clarify, i had to "uart_flow_off_func" before the main loop in arch_main.c function.

bash-3.2# ./start.sh
Downloading hci-firmware.bin...
CRC OK (90).
Sending HCI reset before starting conversation...
resp:03 0C

===============================================
HCI ver: Bluetooth Core Spec 4.0 (0x06)
警告:模块的制造商不是对话框半导体(0x0060)!!!yabo国际娱乐
HCI revision : 0x0706
Module LMP version : 0x06
Module LMP sub-version : 0x0706
设备设置完整
bash-3.2# hciconfig
hci0: Type: BR/EDR Bus: UART
BD Address: 00:13:43:0D:09:83 ACL MTU: 0:0 SCO MTU: 0:0
DOWN
RX bytes:64 acl:0 sco:0 events:5 errors:0
TX bytes:20 acl:0 sco:0 commands:5 errors:0

But still there are some issues powering on:

bash-3.2#hciconfig hci0向上
Bluetooth: hci0 command 0x1003 tx timeout
Bluetooth: hci0 command 0x1001 tx timeout
Bluetooth: hci0 command 0x1009 tx timeout
Can't init device hci0: Connection timed out (110)

Maybe i am now facing the issue you mentioned above ?
将继续下周。

重新获得

spectrum
Offline
Last seen:5 years 9 months ago
加入:2015-03-11 18:26
Still a step forward,

Still a step forward,
i solved some uart flow control issues and actually communication is correct.

But seems the firmware is actually not replying correctly to "Read Class of Device " command,
奇怪的MTU值读为0。

bash-3.2# Bluetooth monitor ver 5.14
= New Index: 00:13:43:0D:09:83 (BR/EDR,UART,hci0) [hci0] 0.657956

bash-3.2#hciconfig hci0向上
< HCI Command: Read Local Supported Fea.. (0x04|0x0003) plen 0 [hci0] 8.186353
> HCI Event: Command Complete (0x0e) plen 12 [hci0] 8.672730
阅读本地支持的功能(0x04 | 0x0003)NCMD 10
Status: Success (0x00)
特点:0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
< HCI Command: Read Local Version Infor.. (0x04|0x0001) plen 0 [hci0] 8.672877
> HCI Event: Command Complete (0x0e) plen 12 [hci0] 8.677712
Read Local Version Information (0x04|0x0001) ncmd 10
Status: Success (0x00)
HCI version: Bluetooth 4.0 (0x06) - Revision 1798 (0x0706)
LMP version: Bluetooth 4.0 (0x06) - Subversion 1798 (0x0706)
Manufacturer: RivieraWaves S.A.S (96)
> HCI事件:命令完成(0x0E)PLEN 10 [HCI0] 8.682438
Read BD ADDR (0x04|0x0009) ncmd 10
Status: Success (0x00)
地址:00:13:43:0D:09:83(Matsushita电子元件(欧洲)GmbH)
> HCI Event: Command Complete (0x0e) plen 11 [hci0] 8.687327
读取缓冲区大小(0x04 | 0x0005)NCMD 10
Status: Success (0x00)
ACL MTU:0 ACL MAX数据包:0
SCO MTU: 0 SCO max packet: 0
< HCI Command: Read Class of Device (0x03|0x0023) plen 0 [hci0] 8.687407
> HCI Event: Command Complete (0x0e) plen 4 [hci0] 8.691511
Read Class of Device (0x03|0x0023) ncmd 10
Status: Unknown HCI Command (0x01)

其他一些信息:

bash-3.2# cd blue/
bash-3.2# ./start.sh
Downloading hci-firmware.bin...
CRC OK(18)。
Sending HCI reset before starting conversation...
resp:03 0C

===============================================
HCI ver: Bluetooth Core Spec 4.0 (0x06)
Manufacturer: RivieraWaves SAS(0x0060)
HCI revision : 0x0706
Module LMP version : 0x06
Module LMP sub-version : 0x0706
设备设置完整

bash-3.2#hciconfig hci0向上
无法init设备hci0:无效的请求代码(56)

bash-3.2# dmesg | grep Blue
[ 0.312654] Bluetooth: Core ver 2.16
[ 0.312693] Bluetooth: HCI device and connection manager initialized
[0.312705]蓝牙:HCI套接字层初始化
[ 0.312716] Bluetooth: L2CAP socket layer initialized
[ 0.312737] Bluetooth: SCO socket layer initialized
[ 3.675536] Bluetooth: HCI UART driver ver 2.2
[ 3.678705] Bluetooth: HCI H4 protocol initialized
[ 3.682216] Bluetooth: HCI BCSP protocol initialized
[ 3.685916] Bluetooth: HCILL protocol initialized
[ 4.653492] Bluetooth: RFCOMM TTY layer initialized
[ 4.657130] Bluetooth: RFCOMM socket layer initialized
[4.660993]蓝牙:RFCOMM VER 1.11
[ 4.663465] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[4.667507]蓝牙:BNEP过滤器:协议组播
[ 4.671459] Bluetooth: BNEP socket layer initialized
[ 4.675154] Bluetooth: HIDP (Human Interface Emulation) ver 1.2
[ 4.679800] Bluetooth: HIDP socket layer initialized

bash-3.2# hciconfig -a
hci0: Type: BR/EDR Bus: UART
BD Address: 00:13:43:0D:09:83 ACL MTU: 0:0 SCO MTU: 0:0
DOWN
RX bytes:640 acl:0 sco:0 events:50 errors:0
TX bytes:200 acl:0 sco:0 commands:50 errors:0
特点:0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
Packet type: DM1 DH1 HV1
Link policy:
Link mode: SLAVE ACCEPT

bash-3.2#hciconfig hci0向上
无法init设备hci0:无效的请求代码(56)

spectrum
Offline
Last seen:5 years 9 months ago
加入:2015-03-11 18:26
Ok, seems at least main

Ok, seems at least main features now work.

bash-3.2# hciconfig -a
hci0: Type: BR/EDR Bus: UART
BD地址:00:13:43:0D:09:83 ACL MTU:27:18 SCO MTU:0:0
UP RUNNING
RX bytes:339 acl:0 sco:0 events:37 errors:0
TX bytes:370 acl:0 sco:0 commands:37 errors:0
Features: 0x00 0x00 0x00 0x00 0x60 0x00 0x00 0x00
Packet type: DM1 DH1 HV1
Link policy:
Link mode: SLAVE ACCEPT

bash-3.2# hciconfig hci0 leadv

And i see the module detected from cell phone.

sbourahla
Offline
Last seen:5 years 5 months ago
Expert
加入:2015-02-25 09:51
Hello spectrum,

Hello spectrum,

I am interesting by how you fixed your problem, I try to do the same but actually it doesn't work.

BR

spectrum
Offline
Last seen:5 years 9 months ago
加入:2015-03-11 18:26
嗨Sbourahla,

嗨Sbourahla,
i did many changes to original "DA14581_HCI_Release_v.3.110.2.12" package, ending up with a PAN1740 compatible fw.
I am looking now into licence things, let's see if i can share the uVision project.
I would also do some more tests before sharing it.

Best regards
Angelo

spectrum
Offline
Last seen:5 years 9 months ago
加入:2015-03-11 18:26
Hi,

Hi,
well after some testings seems there are at least some connections issues:

$ sudo gatttool -b 00:13:43:0D:09:83 -I
[00:13:43:0D:09:83] [Le]>连接
Attempting to connect to 00:13:43:0D:09:83
[00:13:43:0D:09:83][LE]> < HCI Command: LE Create Connection (0x08|0x000d) plen 25 [hci0] 8.243814
扫描间隔:60.000毫秒(0x0060)
扫描窗口:30.000毫秒(0x0030)
Filter policy: White list is not used (0x00)
Peer address type: Public (0x00)
Peer address: 00:13:43:0D:09:83 (Matsushita Electronic Components (Europe) GmbH)
Own address type: Public (0x00)
Min connection interval: 50.00 msec (0x0028)
Max connection interval: 70.00 msec (0x0038)
Connection latency: 0x0000
监督超时:420毫秒(0x002a)
Min connection length: 0.000 msec (0x0000)
Max connection length: 0.000 msec (0x0000)
> HCI Event: Command Status (0x0f) plen 4 [hci0] 8.248374
LE Create Connection (0x08|0x000d) ncmd 1
Status: Success (0x00)
> HCI Event: LE Meta Event (0x3e) plen 19 [hci0] 15.921321
LE Connection Complete (0x01)
Status: Success (0x00)
手柄:72
Role: Master (0x00)
Peer address type: Public (0x00)
Connection successful
[00:13:43:0D:09:83][LE]> Peer address: 00:13:43:0D:09:83 (Matsushita Electronic Components (Europe) GmbH)
Connection interval: 70.00 msec (0x0038)
Connection latency: 0.00 msec (0x0000)
监督超时:420毫秒(0x002a)
Master clock accuracy: 0x00
@ Device Connected: 00:13:43:0D:09:83 (1) flags 0x0000
> HCI Event: Disconnect Complete (0x05) plen 4 [hci0] 16.411320
Status: Success (0x00)
手柄:72
Reason: Connection Timeout (0x08)
@ Device Disconnected: 00:13:43:0D:09:83 (1) reason 1

Seems the final disconnection arrives after a time near to the supervisor timeout.

Now i don't know if this is an issue visible also on da14581 or if it can be something related to my modified firmware.
Is there anyone with HCI on da14581 working properly ?

Regards
angelo

spectrum
Offline
Last seen:5 years 9 months ago
加入:2015-03-11 18:26
Hi,

Hi,
i share the code i have at this point. Still connection is not working properly, disconnection happen just after the connection succeed.

https://github.com/spectrum70/pan1740-firmware.

Best regards
Angelo

JE_Dialog
Offline
Last seen:6 hours 29 min ago
Staff
加入:2013-12-05 14:02
Hi Spectrum, we have

你好,我们有客户使用HCI成功ly on DA14581 with external MPU. We have an internal project working on a Blue-Z implementation as we speak (3rd party is working on this for us).

Do you have a 14581 set-up to test ? you could re-build your image for 14581 and test.

BR JE_Dialog