BLE no compatible with SPI

Hi, in our project we use nRF5340 to control some externanal peripherals as flash mem through SPI and also we need BLE comunication.

The case is if whe allow the config for the BLE the sistems fall down.

And if set the BLE config in "n" works fine.

This is al the prj.config:

#
# Copyright (c) 2022 Nordic Semiconductor ASA
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#
CONFIG_WIFI=y
CONFIG_WIFI_NRF700X=y
CONFIG_NET_L2_WIFI_MGMT=y
CONFIG_HEAP_MEM_POOL_SIZE=25000

CONFIG_NET_PKT_RX_COUNT=1
CONFIG_NET_PKT_TX_COUNT=1

# System settings
CONFIG_NEWLIB_LIBC=y
CONFIG_NEWLIB_LIBC_NANO=n

# Networking
CONFIG_NETWORKING=y
CONFIG_NET_L2_ETHERNET=y
# TODO: Debug why DHCP is needed to scan
CONFIG_NET_DHCPV4=y
CONFIG_NET_IPV4=y
CONFIG_NET_UDP=y
CONFIG_INIT_STACKS=y

# Memories
CONFIG_MAIN_STACK_SIZE=8192
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096
CONFIG_NET_TX_STACK_SIZE=4096
CONFIG_NET_RX_STACK_SIZE=4096

# Debugging
CONFIG_STACK_SENTINEL=y
CONFIG_DEBUG_COREDUMP=y
CONFIG_DEBUG_COREDUMP_BACKEND_LOGGING=y
CONFIG_DEBUG_COREDUMP_MEMORY_DUMP_MIN=y

# Logging
CONFIG_LOG=y
CONFIG_PRINTK=y

# Peripherals
CONFIG_GPIO=y
CONFIG_ADC=y
CONFIG_ADC_ASYNC=y
CONFIG_ADC_NRFX_SAADC=y
CONFIG_PINCTRL=y

# I2C
CONFIG_I2C=y
CONFIG_NRFX_TWIM1=y

# SPI
CONFIG_SPI=y
CONFIG_NRFX_SPIM3=y

# UARTE
CONFIG_NRFX_UARTE0=y
CONFIG_NRFX_UARTE2=y

# Reboot
CONFIG_REBOOT=y

# BLE configuration
CONFIG_BT=y
CONFIG_SETTINGS=y
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_GATT_DYNAMIC_DB=y
CONFIG_BT_DEVICE_NAME="name"
CONFIG_BT_L2CAP_TX_MTU=252
CONFIG_BT_BUF_ACL_TX_SIZE=251
CONFIG_BT_BUF_ACL_RX_SIZE=502

# USB
CONFIG_USB_DEVICE_STACK=y
CONFIG_USB_DEVICE_PRODUCT="name"
CONFIG_USB_DEVICE_PID=0x0009
CONFIG_LOG=y
CONFIG_USB_DRIVER_LOG_LEVEL_ERR=y
CONFIG_USB_DEVICE_LOOPBACK=y
CONFIG_USB_DEVICE_LOG_LEVEL_ERR=y
CONFIG_USB_DEVICE_INITIALIZE_AT_BOOT=n

# Low Power
CONFIG_PM_DEVICE=y
CONFIG_POWEROFF=y

#NFC Tag pins as GPIO
CONFIG_NFCT_PINS_AS_GPIOS=y

Why doesn't work the system with this configuration when is set "y" in "CONFIG_BT"?

Thanks in advance, regards.

Parents
  • To add more info when CONFIG_BLE=y the signal  the CLK works but MOSI doesn't send nothing.

    If I set CONFIG_BLE=n I can see in MOSI the command to read status register on the flash mem.

  • Hello,

    Sorry for the late reply. 

    What board are you building for? And what pin are you using for your MOSI?

    I see an nrf5340dk_nrf5340_cpuapp.overlay, but I was not able to build the project in NCS v2.5.0 for the nrf5340dk_nrf5340_cpuapp:

    C:\nordic\SDKs\ncs\my_projects\2.5.0\cust\WallyMainBoard>west build -b nrf5340dk_nrf5340_cpuapp -d _build
    -- west build: generating a build system
    Loading Zephyr default modules (Zephyr base).
    -- Application: C:/nordic/SDKs/ncs/my_projects/2.5.0/cust/WallyMainBoard
    -- CMake version: 3.20.5
    -- Using NCS Toolchain 2.5.20231017.848171396279 for building. (C:/nordic/SDKs/ncs/toolchains/c57af46cb7/cmake)
    CMake Deprecation Warning at C:/nordic/SDKs/ncs/v2.5.0/zephyr/cmake/modules/FindDeprecated.cmake:121 (message):
      'PYTHON_PREFER' variable is deprecated.  Please use Python3_EXECUTABLE
      instead.
    Call Stack (most recent call first):
      C:/nordic/SDKs/ncs/v2.5.0/zephyr/cmake/modules/python.cmake:16 (find_package)
      C:/nordic/SDKs/ncs/v2.5.0/zephyr/cmake/modules/zephyr_default.cmake:129 (include)
      C:/nordic/SDKs/ncs/v2.5.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include)
      C:/nordic/SDKs/ncs/v2.5.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:92 (include_boilerplate)
      CMakeLists.txt:9 (find_package)
    
    
    -- Found Python3: C:/nordic/SDKs/ncs/toolchains/c57af46cb7/opt/bin/python.exe (found suitable version "3.8.2", minimum required is "3.8") found components: Interpreter
    -- Cache files will be written to: C:/nordic/SDKs/ncs/v2.5.0/zephyr/.cache
    -- Zephyr version: 3.4.99 (C:/nordic/SDKs/ncs/v2.5.0/zephyr)
    -- Found west (found suitable version "1.1.0", minimum required is "0.14.0")
    -- Board: nrf5340dk_nrf5340_cpuapp
    -- Found host-tools: zephyr 0.16.1 (C:/nordic/SDKs/ncs/toolchains/c57af46cb7/opt/zephyr-sdk)
    -- Found toolchain: zephyr 0.16.1 (C:/nordic/SDKs/ncs/toolchains/c57af46cb7/opt/zephyr-sdk)
    -- Found Dtc: C:/nordic/SDKs/ncs/toolchains/c57af46cb7/opt/bin/dtc.exe (found suitable version "1.4.7", minimum required is "1.4.6")
    -- Found BOARD.dts: C:/nordic/SDKs/ncs/v2.5.0/zephyr/boards/arm/nrf5340dk_nrf5340/nrf5340dk_nrf5340_cpuapp.dts
    -- Found devicetree overlay: C:/nordic/SDKs/ncs/my_projects/2.5.0/cust/WallyMainBoard/nrf5340dk_nrf5340_cpuapp.overlay
    devicetree error: 'pinctrl-0' is marked as required in 'properties:' in C:/nordic/SDKs/ncs/v2.5.0/zephyr/dts/bindings\spi\nordic,nrf-spim.yaml, but does not appear in <Node /soc/peripheral@50000000/spi@c000 in 'C:/nordic/SDKs/ncs/v2.5.0/zephyr/misc/empty_file.c'>
    -- In: C:/nordic/SDKs/ncs/my_projects/2.5.0/cust/WallyMainBoard/_build/zephyr, command: C:/nordic/SDKs/ncs/toolchains/c57af46cb7/opt/bin/python.exe;C:/nordic/SDKs/ncs/v2.5.0/zephyr/scripts/dts/gen_defines.py;--dts;C:/nordic/SDKs/ncs/my_projects/2.5.0/cust/WallyMainBoard/_build/zephyr/zephyr.dts.pre;--dtc-flags;'-Wno-unique_unit_address_if_enabled';--bindings-dirs;C:/nordic/SDKs/ncs/v2.5.0/nrf/dts/bindings;C:/nordic/SDKs/ncs/v2.5.0/zephyr/dts/bindings;--header-out;C:/nordic/SDKs/ncs/my_projects/2.5.0/cust/WallyMainBoard/_build/zephyr/include/generated/devicetree_generated.h.new;--dts-out;C:/nordic/SDKs/ncs/my_projects/2.5.0/cust/WallyMainBoard/_build/zephyr/zephyr.dts.new;--edt-pickle-out;C:/nordic/SDKs/ncs/my_projects/2.5.0/cust/WallyMainBoard/_build/zephyr/edt.pickle;--vendor-prefixes;C:/nordic/SDKs/ncs/v2.5.0/nrf/dts/bindings/vendor-prefixes.txt;--vendor-prefixes;C:/nordic/SDKs/ncs/v2.5.0/zephyr/dts/bindings/vendor-prefixes.txt
    CMake Error at C:/nordic/SDKs/ncs/v2.5.0/zephyr/cmake/modules/dts.cmake:279 (message):
      gen_defines.py failed with return code: 1
    Call Stack (most recent call first):
      C:/nordic/SDKs/ncs/v2.5.0/zephyr/cmake/modules/zephyr_default.cmake:129 (include)
      C:/nordic/SDKs/ncs/v2.5.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include)
      C:/nordic/SDKs/ncs/v2.5.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:92 (include_boilerplate)
      CMakeLists.txt:9 (find_package)
    
    
    -- Configuring incomplete, errors occurred!
    ←[91mFATAL ERROR: command exited with status 1: 'C:\nordic\SDKs\ncs\toolchains\c57af46cb7\opt\bin\cmake.EXE' -DWEST_PYTHON=C:/nordic/SDKs/ncs/toolchains/c57af46cb7/opt/bin/python.exe '-BC:\nordic\SDKs\ncs\my_projects\2.5.0\cust\WallyMainBoard\_build' -GNinja -DBOARD=nrf5340dk_nrf5340_cpuapp '-SC:\nordic\SDKs\ncs\my_projects\2.5.0\cust\WallyMainBoard'
    ←[0m

    But I was able to build for the nrf7002dk_nrf5340_cpuapp (but be aware that the nrf5340dk_nrf5340_cpuapp.overlay is not included when building for the nrf7002dk_nrf5340_cpuapp).

    Anyway, now assuming that you are building for the nrf7002dk_nrf5340_cpuapp, and it looks like you are trying to use MOSI pin P1.05, and it fails when enabling bluetooth, this is likely because the network core is enabled, and then, the pin P1.05 is used by the network core's UART (if you look on the back of the DK, it is listed as an RTS pin (flow control in UART). 

    Actually, you will run into a similar issue if you were to build for the nRF5340dk_nrf5340_cpuapp if you try to add the 7002 Evaluation Kit, so there is an overlay file that disables the GPIO forwarding to the network core for this:

    https://github.com/nrfconnect/sdk-nrf/blob/v2.5.0/boards/shields/nrf7002ek/boards/nrf5340dk_nrf5340_cpuapp.overlay

    Try to create your own overlay file called nrf7002dk_nrf5340_cpuapp.overlay, and include the last part of that overlay file into it:

    &gpio_fwd {
    	status = "disabled";
    };

    This will disable the pin forwarding that is initially set up in v2.5.0\nrf\boards\arm\nrf7002dk_nrf5340\nrf5340_cpuapp_common.dts on line 92:

    	gpio_fwd: nrf-gpio-forwarder {
    		compatible = "nordic,nrf-gpio-forwarder";
    		status = "okay";
    		uart {
    			gpios = <&gpio1 1 0>, <&gpio1 0 0>, <&gpio1 5 0>, <&gpio1 4 0>;
    		};
    	};

    Since you disable the UART gpios on the network core, you can also disable the logging on the network core, by adding a folder called "child_image", and inside that, add a file called hci_rpmsg.conf. This will be added to your network core's configuration. In it, add:

    CONFIG_LOG=n
    CONFIG_SERIAL=n
    CONFIG_BOOT_BANNER=n

    Give that a go, and let me know if it doesn't work.

    Best regards,

    Edvin

Reply
  • Hello,

    Sorry for the late reply. 

    What board are you building for? And what pin are you using for your MOSI?

    I see an nrf5340dk_nrf5340_cpuapp.overlay, but I was not able to build the project in NCS v2.5.0 for the nrf5340dk_nrf5340_cpuapp:

    C:\nordic\SDKs\ncs\my_projects\2.5.0\cust\WallyMainBoard>west build -b nrf5340dk_nrf5340_cpuapp -d _build
    -- west build: generating a build system
    Loading Zephyr default modules (Zephyr base).
    -- Application: C:/nordic/SDKs/ncs/my_projects/2.5.0/cust/WallyMainBoard
    -- CMake version: 3.20.5
    -- Using NCS Toolchain 2.5.20231017.848171396279 for building. (C:/nordic/SDKs/ncs/toolchains/c57af46cb7/cmake)
    CMake Deprecation Warning at C:/nordic/SDKs/ncs/v2.5.0/zephyr/cmake/modules/FindDeprecated.cmake:121 (message):
      'PYTHON_PREFER' variable is deprecated.  Please use Python3_EXECUTABLE
      instead.
    Call Stack (most recent call first):
      C:/nordic/SDKs/ncs/v2.5.0/zephyr/cmake/modules/python.cmake:16 (find_package)
      C:/nordic/SDKs/ncs/v2.5.0/zephyr/cmake/modules/zephyr_default.cmake:129 (include)
      C:/nordic/SDKs/ncs/v2.5.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include)
      C:/nordic/SDKs/ncs/v2.5.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:92 (include_boilerplate)
      CMakeLists.txt:9 (find_package)
    
    
    -- Found Python3: C:/nordic/SDKs/ncs/toolchains/c57af46cb7/opt/bin/python.exe (found suitable version "3.8.2", minimum required is "3.8") found components: Interpreter
    -- Cache files will be written to: C:/nordic/SDKs/ncs/v2.5.0/zephyr/.cache
    -- Zephyr version: 3.4.99 (C:/nordic/SDKs/ncs/v2.5.0/zephyr)
    -- Found west (found suitable version "1.1.0", minimum required is "0.14.0")
    -- Board: nrf5340dk_nrf5340_cpuapp
    -- Found host-tools: zephyr 0.16.1 (C:/nordic/SDKs/ncs/toolchains/c57af46cb7/opt/zephyr-sdk)
    -- Found toolchain: zephyr 0.16.1 (C:/nordic/SDKs/ncs/toolchains/c57af46cb7/opt/zephyr-sdk)
    -- Found Dtc: C:/nordic/SDKs/ncs/toolchains/c57af46cb7/opt/bin/dtc.exe (found suitable version "1.4.7", minimum required is "1.4.6")
    -- Found BOARD.dts: C:/nordic/SDKs/ncs/v2.5.0/zephyr/boards/arm/nrf5340dk_nrf5340/nrf5340dk_nrf5340_cpuapp.dts
    -- Found devicetree overlay: C:/nordic/SDKs/ncs/my_projects/2.5.0/cust/WallyMainBoard/nrf5340dk_nrf5340_cpuapp.overlay
    devicetree error: 'pinctrl-0' is marked as required in 'properties:' in C:/nordic/SDKs/ncs/v2.5.0/zephyr/dts/bindings\spi\nordic,nrf-spim.yaml, but does not appear in <Node /soc/peripheral@50000000/spi@c000 in 'C:/nordic/SDKs/ncs/v2.5.0/zephyr/misc/empty_file.c'>
    -- In: C:/nordic/SDKs/ncs/my_projects/2.5.0/cust/WallyMainBoard/_build/zephyr, command: C:/nordic/SDKs/ncs/toolchains/c57af46cb7/opt/bin/python.exe;C:/nordic/SDKs/ncs/v2.5.0/zephyr/scripts/dts/gen_defines.py;--dts;C:/nordic/SDKs/ncs/my_projects/2.5.0/cust/WallyMainBoard/_build/zephyr/zephyr.dts.pre;--dtc-flags;'-Wno-unique_unit_address_if_enabled';--bindings-dirs;C:/nordic/SDKs/ncs/v2.5.0/nrf/dts/bindings;C:/nordic/SDKs/ncs/v2.5.0/zephyr/dts/bindings;--header-out;C:/nordic/SDKs/ncs/my_projects/2.5.0/cust/WallyMainBoard/_build/zephyr/include/generated/devicetree_generated.h.new;--dts-out;C:/nordic/SDKs/ncs/my_projects/2.5.0/cust/WallyMainBoard/_build/zephyr/zephyr.dts.new;--edt-pickle-out;C:/nordic/SDKs/ncs/my_projects/2.5.0/cust/WallyMainBoard/_build/zephyr/edt.pickle;--vendor-prefixes;C:/nordic/SDKs/ncs/v2.5.0/nrf/dts/bindings/vendor-prefixes.txt;--vendor-prefixes;C:/nordic/SDKs/ncs/v2.5.0/zephyr/dts/bindings/vendor-prefixes.txt
    CMake Error at C:/nordic/SDKs/ncs/v2.5.0/zephyr/cmake/modules/dts.cmake:279 (message):
      gen_defines.py failed with return code: 1
    Call Stack (most recent call first):
      C:/nordic/SDKs/ncs/v2.5.0/zephyr/cmake/modules/zephyr_default.cmake:129 (include)
      C:/nordic/SDKs/ncs/v2.5.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include)
      C:/nordic/SDKs/ncs/v2.5.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:92 (include_boilerplate)
      CMakeLists.txt:9 (find_package)
    
    
    -- Configuring incomplete, errors occurred!
    ←[91mFATAL ERROR: command exited with status 1: 'C:\nordic\SDKs\ncs\toolchains\c57af46cb7\opt\bin\cmake.EXE' -DWEST_PYTHON=C:/nordic/SDKs/ncs/toolchains/c57af46cb7/opt/bin/python.exe '-BC:\nordic\SDKs\ncs\my_projects\2.5.0\cust\WallyMainBoard\_build' -GNinja -DBOARD=nrf5340dk_nrf5340_cpuapp '-SC:\nordic\SDKs\ncs\my_projects\2.5.0\cust\WallyMainBoard'
    ←[0m

    But I was able to build for the nrf7002dk_nrf5340_cpuapp (but be aware that the nrf5340dk_nrf5340_cpuapp.overlay is not included when building for the nrf7002dk_nrf5340_cpuapp).

    Anyway, now assuming that you are building for the nrf7002dk_nrf5340_cpuapp, and it looks like you are trying to use MOSI pin P1.05, and it fails when enabling bluetooth, this is likely because the network core is enabled, and then, the pin P1.05 is used by the network core's UART (if you look on the back of the DK, it is listed as an RTS pin (flow control in UART). 

    Actually, you will run into a similar issue if you were to build for the nRF5340dk_nrf5340_cpuapp if you try to add the 7002 Evaluation Kit, so there is an overlay file that disables the GPIO forwarding to the network core for this:

    https://github.com/nrfconnect/sdk-nrf/blob/v2.5.0/boards/shields/nrf7002ek/boards/nrf5340dk_nrf5340_cpuapp.overlay

    Try to create your own overlay file called nrf7002dk_nrf5340_cpuapp.overlay, and include the last part of that overlay file into it:

    &gpio_fwd {
    	status = "disabled";
    };

    This will disable the pin forwarding that is initially set up in v2.5.0\nrf\boards\arm\nrf7002dk_nrf5340\nrf5340_cpuapp_common.dts on line 92:

    	gpio_fwd: nrf-gpio-forwarder {
    		compatible = "nordic,nrf-gpio-forwarder";
    		status = "okay";
    		uart {
    			gpios = <&gpio1 1 0>, <&gpio1 0 0>, <&gpio1 5 0>, <&gpio1 4 0>;
    		};
    	};

    Since you disable the UART gpios on the network core, you can also disable the logging on the network core, by adding a folder called "child_image", and inside that, add a file called hci_rpmsg.conf. This will be added to your network core's configuration. In it, add:

    CONFIG_LOG=n
    CONFIG_SERIAL=n
    CONFIG_BOOT_BANNER=n

    Give that a go, and let me know if it doesn't work.

    Best regards,

    Edvin

Children
Related