This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

nrf9160 prj.config issues

Hello,

I am working on a custom PCB with NRF9160. 

I have modified nrf9160 uart sample to add UART_1 and enable SPI_3 and everything is working fine.

Now I need to include I2C_3 but SES will not open project if I add I2C_3 to 'prj.config' Please see output below: 

Loading solution uart.emProject
Executing load commands
cmake -GNinja -DBOARD=nrf9160_pca10090 -DBOARD_DIR=C:/NRF91SDK/ncs/zephyr/boards/arm/nrf9160_pca10090 -DZEPHYR_TOOLCHAIN_VARIANT=gnuarmemb -DGNUARMEMB_TOOLCHAIN_PATH=C:/gnuarmemb/8 2018-q4-major -BC:/NRF91SDK/ncs/nrf/samples/nrf9160/uart/build -HC:/NRF91SDK/ncs/nrf/samples/nrf9160/uart -DDTC_OVERLAY_FILE=C:/NRF91SDK/ncs/nrf/samples/nrf9160/uart/nrf9160_pca10090.overlay
-- Found PythonInterp: C:/Python37/python.exe (found suitable version "3.7.2", minimum required is "3.4") 
-- Selected BOARD nrf9160_pca10090
Zephyr version: 1.13.99
Parsing Kconfig tree in C:/nRF91SDK/ncs/zephyr/Kconfig
Loading C:/NRF91SDK/ncs/nrf/samples/nrf9160/uart/build/zephyr/.config as base
-- Loading C:/NRF91SDK/ncs/zephyr/boards/arm/nrf9160_pca10090/nrf9160_pca10090.dts as base
-- Overlaying C:/nRF91SDK/ncs/zephyr/dts/common/common.dts
-- Overlaying C:/NRF91SDK/ncs/nrf/samples/nrf9160/uart/nrf9160_pca10090.overlay
nrf9160_pca10090.dts_compiled: Warning (unit_address_format): /soc/adc@0x4000e000: unit name should not have leading "0x"
nrf9160_pca10090.dts_compiled: Warning (unique_unit_address): /soc/uart@40008000: duplicate unit-address (also used in node /soc/i2c@40008000)
nrf9160_pca10090.dts_compiled: Warning (unique_unit_address): /soc/uart@40009000: duplicate unit-address (also used in node /soc/i2c@40009000)
nrf9160_pca10090.dts_compiled: Warning (unique_unit_address): /soc/uart@4000a000: duplicate unit-address (also used in node /soc/i2c@4000a000)
nrf9160_pca10090.dts_compiled: Warning (unique_unit_address): /soc/uart@4000b000: duplicate unit-address (also used in node /soc/i2c@4000b000)
nrf9160_pca10090.dts_compiled: Warning (unique_unit_address): /soc/uart@40008000: duplicate unit-address (also used in node /soc/spi@40008000)
nrf9160_pca10090.dts_compiled: Warning (unique_unit_address): /soc/i2c@40008000: duplicate unit-address (also used in node /soc/spi@40008000)
nrf9160_pca10090.dts_compiled: Warning (unique_unit_address): /soc/uart@40009000: duplicate unit-address (also used in node /soc/spi@40009000)
nrf9160_pca10090.dts_compiled: Warning (unique_unit_address): /soc/i2c@40009000: duplicate unit-address (also used in node /soc/spi@40009000)
nrf9160_pca10090.dts_compiled: Warning (unique_unit_address): /soc/uart@4000a000: duplicate unit-address (also used in node /soc/spi@4000a000)
nrf9160_pca10090.dts_compiled: Warning (unique_unit_address): /soc/i2c@4000a000: duplicate unit-address (also used in node /soc/spi@4000a000)
nrf9160_pca10090.dts_compiled: Warning (unique_unit_address): /soc/uart@4000b000: duplicate unit-address (also used in node /soc/spi@4000b000)
nrf9160_pca10090.dts_compiled: Warning (unique_unit_address): /soc/i2c@4000b000: duplicate unit-address (also used in node /soc/spi@4000b000)
nrf9160_pca10090.dts_compiled: Warning (unique_unit_address): /soc/clock@40005000: duplicate unit-address (also used in node /soc/power@40005000)
-- Cache files will be written to: C:\Users\ibrah\AppData\Local/.cache/zephyr
-- The C compiler identification is GNU 8.2.1
-- The CXX compiler identification is GNU 8.2.1
-- The ASM compiler identification is GNU
-- Found assembler: C:/gnuarmemb/8 2018-q4-major/bin/arm-none-eabi-gcc.exe
-- Performing Test toolchain_is_ok
-- Performing Test toolchain_is_ok - Success
CMake Warning (dev) at C:/NRF91SDK/ncs/zephyr/cmake/extensions.cmake:837 (target_link_libraries):
  Policy CMP0079 is not set: target_link_libraries allows use with targets in
  other directories.  Run "cmake --help-policy CMP0079" for policy details.
  Use the cmake_policy command to set the policy and suppress this warning.

  Target

    zephyr_interface

  is not created in this directory.  For compatibility with older versions of
  CMake, link library

    -mabi=aapcs

  will be looked up in the directory in which the target was created rather
  than in this calling directory.
Call Stack (most recent call first):
  C:/NRF91SDK/ncs/zephyr/cmake/extensions.cmake:1055 (target_link_libraries_ifdef)
  C:/NRF91SDK/ncs/zephyr/cmake/extensions.cmake:115 (target_ld_options)
  C:/NRF91SDK/ncs/zephyr/arch/arm/CMakeLists.txt:20 (zephyr_ld_options)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at C:/NRF91SDK/ncs/zephyr/cmake/extensions.cmake:837 (target_link_libraries):
  Policy CMP0079 is not set: target_link_libraries allows use with targets in
  other directories.  Run "cmake --help-policy CMP0079" for policy details.
  Use the cmake_policy command to set the policy and suppress this warning.

  Target

    zephyr_interface

  is not created in this directory.  For compatibility with older versions of
  CMake, link library

    -march=armv8-m.main+dsp

  will be looked up in the directory in which the target was created rather
  than in this calling directory.
Call Stack (most recent call first):
  C:/NRF91SDK/ncs/zephyr/cmake/extensions.cmake:1055 (target_link_libraries_ifdef)
  C:/NRF91SDK/ncs/zephyr/cmake/extensions.cmake:115 (target_ld_options)
  C:/NRF91SDK/ncs/zephyr/arch/arm/CMakeLists.txt:20 (zephyr_ld_options)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Error at C:/NRF91SDK/ncs/zephyr/CMakeLists.txt:678 (message):
  The Zephyr library 'drivers__i2c' was created without source files.  Empty
  (non-imported) libraries are not supported.  Either make sure that the
  library has the sources it should have, or make sure it is not created when
  it has no source files.


-- Configuring incomplete, errors occurred!
See also "C:/NRF91SDK/ncs/nrf/samples/nrf9160/uart/build/CMakeFiles/CMakeOutput.log".
See also "C:/NRF91SDK/ncs/nrf/samples/nrf9160/uart/build/CMakeFiles/CMakeError.log".
Project load failed
Reported error: solution load command failed (1)

my prj.config:

CONFIG_SERIAL=y
CONFIG_TRUSTED_EXECUTION_NONSECURE=y
CONFIG_UART_INTERRUPT_DRIVEN=y
CONFIG_UART_1_NRF_UARTE=y



# SPI
CONFIG_SPI=y
CONFIG_SPI_3=y
CONFIG_SPI_3_NRF_SPIM=y
CONFIG_SPI_3=y 
CONFIG_SPI_NRFX=y

# Enable I2C
CONFIG_I2C=y
CONFIG_I2C_3=y
CONFIG_I2C_3_NRF_TWIM=y
CONFIG_I2C_NRFX=y
CONFIG_I2C_INIT_PRIORITY=60

I tried using i2c_scanner sample and that worked but uart sample doesn't

Please help

Thank you

Parents
  • I found the solution but I have another related issue now.

    I was trying to use SPI_3 and I2C_3. this creates a conflics and prevents SES from loading the project.

    For some reason zephyr + nrf9160 doesn't like it when you have SPI_x and I2C_x. 

    Solution is  to change one I2C or SPI to SPI_x and I2C_y. (example I2C_2 and SPI_3).

    The issue is that all I2C and SPI pins can't be redefined from .overlay or .dts files.

    the only ports I can get to run are I2C_3 and SPI_3 but I can't run both at the same time.

    I changed SPI_3 to SPI_2 with these pins:

    &spi2 {
    status = "ok";
    sck-pin = <0>;
    mosi-pin = <30>;
    miso-pin = <2>;
    //ss-pin = <14>;
    spi-max-frequency = <4000000>;
    };

    When I printk pins locations I get:

    Value of NRF_SPIM2_NS->PSEL.MOSI: 13     <-----Should be 30
    Value of NRF_SPIM2_NS->PSEL.MISO: 18     <-----Should be 2

    I have the same issue when I use I2C_2. Pin locations cannot be redefined.

    Please help.

    Thank you 

Reply
  • I found the solution but I have another related issue now.

    I was trying to use SPI_3 and I2C_3. this creates a conflics and prevents SES from loading the project.

    For some reason zephyr + nrf9160 doesn't like it when you have SPI_x and I2C_x. 

    Solution is  to change one I2C or SPI to SPI_x and I2C_y. (example I2C_2 and SPI_3).

    The issue is that all I2C and SPI pins can't be redefined from .overlay or .dts files.

    the only ports I can get to run are I2C_3 and SPI_3 but I can't run both at the same time.

    I changed SPI_3 to SPI_2 with these pins:

    &spi2 {
    status = "ok";
    sck-pin = <0>;
    mosi-pin = <30>;
    miso-pin = <2>;
    //ss-pin = <14>;
    spi-max-frequency = <4000000>;
    };

    When I printk pins locations I get:

    Value of NRF_SPIM2_NS->PSEL.MOSI: 13     <-----Should be 30
    Value of NRF_SPIM2_NS->PSEL.MISO: 18     <-----Should be 2

    I have the same issue when I use I2C_2. Pin locations cannot be redefined.

    Please help.

    Thank you 

Children
  • I found a solution to this problem:

    Value of NRF_SPIM2_NS->PSEL.MOSI: 13     <-----Should be 30
    Value of NRF_SPIM2_NS->PSEL.MISO: 18     <-----Should be 2

    UART_2 from secure_boot was creaeting a conflict and restricted my from changing pins so I disabled UART_2.

    Now my pin selections are correct:

    Value of NRF_SPIM3_NS->PSEL.MOSI: 30
    Value of NRF_SPIM3_NS->PSEL.MISO: 2
    Value of NRF_TWIM2_NS->PSEL.SCL: 8
    Value of NRF_TWIM2_NS->PSEL.SDA: 9
    Value of NRF_TWIM2_NS->FREQUENCY: 26738688

    SPI_3 works and I2C_3 work but they cannot be enabled simultaneously. 

    I am currently using SPI_3 and I2C_2 and I can flash to device but device stops at:  

    " error = i2c_transfer(i2c_dev, &msgs[0], 1, i); "

    Please help if you have any idea. 

    Thank you

  • There is this line in this zephyr driver file "zephyr/drivers/spi/Kconfig.nrfx"

    # In Nordic SoCs, SPI and TWI peripherals with the same instance number
    # share certain resources and therefore cannot be used at the same time
    # (in nRF91 Series this limitation concerns UART peripherals as well).

    It's not mentioned in the datasheet afaik so it's tricky.

  • Problem is solved. There was an issue with conflicting instances as mentioned in earlier posts.

    I tried switching I2C2 and SPI3 to I2C3 and SPI2 again and for some reason it worked this time.

    I think I just know my way better around the SDK so I must have missed something before.

Related