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

UART GPIO Configuration

Hi all,

I swear I've read every post under the sun regarding this, and tried so many different things from all of them that my project is probably slightly screwed now.

I am trying to change the UART1 bindings to RX on P0.11. Thats it. Thats all I want.

In my directory, I have two overlay files (identical). `nrf9160_pca10090.overlay` and `nrf9160_pca10090ns.overlay`. They have the following contents:

&uart1 {
	status = "okay";
	current-speed = <9600>;
	tx-pin = <10>;
	rx-pin = <11>;
	rts-pin = <0xFFFFFFFF>;
	cts-pin = <0xFFFFFFFF>;
};

In one article, I read that this also needs to be populated in the SPM. Initially, I made changes to the overlay file in the SPM sample, but this had no result. Instead, I've modified my CMakeLists.txt to serve this purpose, as below:

if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/spm.conf")
  set(spm_CONF_FILE
    prj.conf
    ${CMAKE_CURRENT_LIST_DIR}/spm.conf
  )
endif()

if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/mcuboot.conf")
  set(mcuboot_CONF_FILE
    prj.conf
    ${CMAKE_CURRENT_LIST_DIR}/mcuboot.conf
  )
endif()

if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${BOARD}.overlay")
  set(mcuboot_DTC_OVERLAY_FILE "${CMAKE_CURRENT_SOURCE_DIR}/${BOARD}.overlay")
  set(spm_DTC_OVERLAY_FILE "${CMAKE_CURRENT_SOURCE_DIR}/${BOARD}.overlay")
endif()


This is placed just below the `cmake_minimum_required` line and just above the `include(zephyr...boilerplate.cmake)` line.

My prj.conf has some lines added to it as per the UART sample.

CONFIG_SERIAL=y
CONFIG_TRUSTED_EXECUTION_NONSECURE=y
CONFIG_UART_INTERRUPT_DRIVEN=y
CONFIG_MAIN_STACK_SIZE=4096

Attempting to add `CONFIG_UART_1_NRF_UART=y` simply causes it to have a Kconfig error on import to segger, as well as `CONFIG_BOARD_PCA10090_UART1_ARDUINO` which I read elsewhere.

I know I'm going wrong in a number of places, but theres just so much variation in the resources provided on this forum, especially across long time periods.

Thanks in advance for your help!

Related