simple gpio to control external FEM in NCS 2.7.0 & nrf5340


Hi Nordic team,

I am facing an issue about using simple gpio to control external FEM(custom FEM model) in NCS 2.7.0 & nrf5340.

Here is background:
1. Our project is using nRF5340, and based on NCS version before 2.7.0
2. For the network core, we copied NCS 2.6.1\zephyr\samples\bluetooth\hci_ipc, and modified a bit of code in oder to support simple gpio to control external FEM. by adding       macros and functions below:

CONFIG_MPSL_FEM=y

CONFIG_MPSL_FEM_POWER_MODEL=y

CONFIG_MPSL_FEM_SIMPLE_GPIO=y

CONFIG_MPSL_FEM_DEVICE_CONFIG_254=n

mpsl_fem_power_model_to_use_get()

model_fetch()

model_init()

3. it works fine on NCS 2.6.1, but it failed when I migrated it to NCS to 2.7.0 (still use 'no sysbuild', so net core child image is built from zephyr\samples\bluetooth\hci_ipc ). 
    The netcore always gets BUS Fault and crashes when app core wants to set RF power. see the UART log from net core

[00:00:16.316,131] ^[[0m<inf> hci_ipc: Sent message of 12 bytes.^[[0m
[00:00:16.319,763] ^[[0m<inf> hci_ipc: Received message of 6 bytes.^[[0m
[00:00:16.320,068] ^[[0m<inf> hci_ipc: Sent message of 7 bytes.^[[0m
[00:00:16.340,515] ^[[0m<inf> hci_ipc: Received message of 8 bytes.^[[0m
[00:00:16.340,606] ^[[1;31m<err> os: ***** BUS FAULT *****^[[0m
[00:00:16.340,637] ^[[1;31m<err> os:   Precise data bus error^[[0m
[00:00:16.340,637] ^[[1;31m<err> os:   BFAR Address: 0x1^[[0m
[00:00:16.340,667] ^[[1;31m<err> os: r0/a1:  0x0000000d  r1/a2:  0x80000000  r2/a3:  0x00000001^[[0m
[00:00:16.340,728] ^[[1;31m<err> os: r3/a4:  0x00000000 r12/ip:  0x0101ea1d r14/lr:  0x0101d1c9^[[0m
[00:00:16.340,728] ^[[1;31m<err> os:  xpsr:  0x81004400^[[0m
[00:00:16.340,728] ^[[1;31m<err> os: Faulting instruction address (r15/pc): 0x0101d1d4^[[0m
[00:00:16.340,789] ^[[1;31m<err> os: >>> ZEPHYR FATAL ERROR 25: Unknown error on CPU 0^[[0m
[00:00:16.340,820] ^[[1;31m<err> os: Current thread: 0x21002210 (HCI ipc TX)^[[0m
[00:00:16.439,147] ^[[1;31m<err> os: Halting system^[[0m


In oder to simplify the problem, I tried the NCS sample code under C:\ncs\v2.7.0\zephyr\samples\bluetooth\hci_pwr_ctrl on 5340DK, because in this sample, application code is also sending HCI cmd to net core to get/set RF power.  I observed lots of errors about the HCI command sending thru IPC  in function bt_hci_cmd_send_sync(),

Below is the UART log printed out from 5340DK app core:

*** Booting nRF Connect SDK v2.7.0-5cb85570ca43 ***
*** Using Zephyr OS v3.6.99-100befc70c74 ***
Starting Dynamic Tx Power Beacon Demo
Get Tx power level ->[00:00:00.445,922] <wrn> bt_hci_core: bt_hci_cmd_send_sync: command opcode 0x0c03 timeout with err 0
--- 10 messages dropped ---
[00:00:00.451,751] <wrn> bt_hci_core: bt_hci_cmd_send_sync: command opcode 0x2018 timeout with err 0
[00:00:00.452,362] <wrn> bt_hci_core: bt_hci_cmd_send_sync: command opcode 0x2018 timeout with err 0
[00:00:00.454,895] <wrn> bt_hci_core: bt_hci_cmd_send_sync: command opcode 0x0c33 timeout with err 0
[00:00:00.455,291] <wrn> bt_hci_core: bt_hci_cmd_send_sync: command opcode 0x0c31 timeout with err 0
[00:00:00.455,657] <wrn> bt_hci_core: bt_hci_cmd_send_sync: command opcode 0x2003 timeout with err 0
[00:00:00.456,024] <wrn> bt_hci_core: bt_hci_cmd_send_sync: command opcode 0x2002 timeout with err 0
[00:00:00.456,390] <wrn> bt_hci_core: bt_hci_cmd_send_sync: command opcode 0x201c timeout with err 0
[00:00:00.456,756] <wrn> bt_hci_core: bt_hci_cmd_send_sync: command opcode 0x202f timeout with err 0
[00:00:00.457,122] <wrn> bt_hci_core: bt_hci_cmd_send_sync: command opcode 0x2024 timeout with err 0
[00:00:00.457,519] <wrn> bt_hci_core: bt_hci_cmd_send_sync: command opcode 0x2001 timeout with err 0
[00:00:00.457,885] <wrn> bt_hci_core: bt_hci_cmd_send_sync: command opcode 0x0c01 timeout with err 0
[00:00:00.458,251] <wrn> bt_hci_core: bt_hci_cmd_send_sync: command opcode 0xfc01 timeout with err 0
[00:00:00.458,282] <inf> bt_hci_core: HW Platform: Nordic Semiconductor (0x0002)
[00:00:00.458,312] <inf> bt_hci_core: HW Variant: nRF53x (0x0003)
[00:00:00.458,312] <inf> bt_hci_core: Firmware: Standard Bluetooth controller (0x00) Version 214.51162 Build 1926957230
[00:00:00.458,709] <wrn> bt_hci_core: bt_hci_cmd_send_sync: command opcode 0xfc02 timeout with err 0
[00:00:00.459,106] <wrn> bt_hci_core: bt_hci_cmd_send_sync: command opcode 0x1009 timeout with err 0
[00:00:00.459,472] <wrn> bt_hci_core: bt_hci_cmd_send_sync: command opcode 0xfc09 timeout with err 0
[00:00:00.459,869] <wrn> bt_hci_core: bt_hci_cmd_send_sync: command opcode 0x2005 timeout with err 0
[00:00:00.460,021] <inf> bt_hci_core: Identity: F2:D1:8F:D5:69:8A (random)
[00:00:00.460,052] <inf> bt_hci_core: HCI: version 5.4 (0x0d) revision 0x21fb, manufacturer 0x0059
[00:00:00.460,083] <inf> bt_hci_core: LMP: version 5.4 (0x0d) subver 0x21fb
Bluetooth initialized
[00:00:00.460,540] <wrn> bt_hci_core: bt_hci_cmd_send_sync: command opcode 0x2006 timeout with err 0
[00:00:00.460,968] <wrn> bt_hci_core: bt_hci_cmd_send_sync: command opcode 0x2008 timeout with err 0
[00:00:00.461,364] <wrn> bt_hci_core: bt_hci_cmd_send_sync: command opcode 0x2009 timeout with err 0
[00:00:00.461,914] <wrn> bt_hci_core: bt_hci_cmd_send_sync: command opcode 0x200a timeout with err 0
Dynamic Tx power Beacon started
Set Tx power level to 4
[00:00:05.446,838] <wrn> bt_hci_core: bt_hci_cmd_send_sync: command opcode 0xfc0e timeout with err 0
[00:00:05.446,868] <wrn> bt_hci_core: opcode 0xfc0e status 0x01
Set Tx power err: -5 reason 0x00
Get Tx power level -> [00:00:10.447,357] <wrn> bt_hci_core: bt_hci_cmd_send_sync: command opcode 0xfc0f timeout with err 0
[00:00:10.447,387] <wrn> bt_hci_core: opcode 0xfc0f status 0x01
Read Tx power err: -5 reason 0x00
TXP = -1
Set Tx power level to 0
[00:00:10.447,814] <wrn> bt_hci_core: bt_hci_cmd_send_sync: command opcode 0xfc0e timeout with err 0
[00:00:10.447,814] <wrn> bt_hci_core: opcode 0xfc0e status 0x01
Set Tx power err: -5 reason 0x00
Get Tx power level -> [00:00:15.448,364] <wrn> bt_hci_core: bt_hci_cmd_send_sync: command opcode 0xfc0f timeout with err 0
[00:00:15.448,364] <wrn> bt_hci_core: opcode 0xfc0f status 0x01
Read Tx power err: -5 reason 0x00
TXP = -1
Set Tx power level to -3
[00:00:15.448,791] <wrn> bt_hci_core: bt_hci_cmd_send_sync: command opcode 0xfc0e timeout with err 0
[00:00:15.448,822] <wrn> bt_hci_core: opcode 0xfc0e status 0x01
Set Tx power err: -5 reason 0x00
Get Tx power level -> [00:00:20.449,310] <wrn> bt_hci_core: bt_hci_cmd_send_sync: command opcode 0xfc0f timeout with err 0
[00:00:20.449,340] <wrn> bt_hci_core: opcode 0xfc0f status 0x01
Read Tx power err: -5 reason 0x00
TXP = -1
Set Tx power level to -8
[00:00:20.449,829] <wrn> bt_hci_core: bt_hci_cmd_send_sync: command opcode 0xfc0e timeout with err 0
[00:00:20.449,829] <wrn> bt_hci_core: opcode 0xfc0e status 0x01
Set Tx power err: -5 reason 0x00


Note: I used 'No sysbuild' in VsCode when building this sample so that net core child image is built from zephyr\samples\bluetooth\hci_ipc

Can you look at this issue?
If you need any more info, please let me know.

Thanks

Parents
  • In oder to simplify the problem, I tried the NCS sample code under C:\ncs\v2.7.0\zephyr\samples\bluetooth\hci_pwr_ctrl on 5340DK, because in this sample, application code is also sending HCI cmd to net core to get/set RF power

    Did you make any changes to the sample before testing it?

    Regards,
    Sigurd Hellesvik

  • No, I did not change anything, it is the AS-IS sample code

  • The sample seems to work with Sysbuild and the following changes:

    sysbuild.conf:

    SB_CONFIG_NETCORE_HCI_IPC=y
    

    Copied sysbuild/hci_rpmsg.conf -> sysbuild/hci_ipc.conf

    Perhaps you need to rename the file similarly for child_image/ without sysbuild?

    My logs:

    *** Booting nRF Connect SDK v2.7.0-5cb85570ca43 ***
    *** Using Zephyr OS v3.6.99-100befc70c74 ***
    Starting Dynamic Tx Power Beacon Demo
    Get Tx power level ->-> default TXP = 0
    [00:00:00.425,262] <inf> bt_hci_core: HW Platform: Nordic Semiconductor (0x0002)
    [00:00:00.425,292] <inf> bt_hci_core: HW Variant: nRF53x (0x0003)
    [00:00:00.425,323] <inf> bt_hci_core: Firmware: Standard Bluetooth controller (0x00) Version 214.51162 Build 1926957230
    [00:00:00.426,971] <inf> bt_hci_core: Identity: C2:E3:54:B9:1D:F0 (random)
    [00:00:00.427,001] <inf> bt_hci_core: HCI: version 5.4 (0x0d) revision 0x21fb, manufacturer 0x0059
    [00:00:00.427,032] <inf> bt_hci_core: LMP: version 5.4 (0x0d) subver 0x21fb
    Bluetooth initialized
    Dynamic Tx power Beacon started
    Set Tx power level to 4
    Actual Tx Power: 3
    Get Tx power level -> TXP = 3
    Set Tx power level to 0
    Actual Tx Power: 0
    Get Tx power level -> TXP = 0
    Set Tx power level to -3
    Actual Tx Power: -3
    Get Tx power level -> TXP = -3
    Set Tx power level to -8
    Actual Tx Power: -8
    Get Tx power level -> TXP = -8
    Set Tx power level to -15
    Actual Tx Power: -16
    Get Tx power level -> TXP = -16
    Set Tx power level to -18
    Actual Tx Power: -20
    Get Tx power level -> TXP = -20
    Set Tx power level to -23
    Actual Tx Power: -40
    

  • Shouldn't we able to get this to work without sysbuild when using NCS 2.7?

    Also, did you enable CONFIG_LOG=y and CONFIG_BT_LOG_LEVEL_DBG=y  so as to be able to see the warnings lincoln-lu showed in his log?

Reply Children
No Data
Related