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

Configuring multiple UARTs on nRF5340DK (plus other serial interfaces)

I'm using the nRF5340 (currently nRF5340DK with custom hardware following shortly) and NCS 1.6.0. I'm working on a project that needs at least two UARTs and one SPI master interface, but I haven't been able to find an example to base this on and I can't seem to find the right combination of settings. It looks like there may also be considerations like shared resources between UART/SPI/TWI that must be configured correctly. I've also noticed the comment in v1.6.0/nrf/samples/CMakeLists.txt that says we can’t use UART1 because it’s used by the TF-M secure application. We can move debug logging from UART0 to RTT if needed to free up the UART0 resource. Is there an example that I've overlooked that clearly shows how to configure this? Or can someone explain what needs to be done? Configuring serial interfaces should be relatively straightforward but we just can't seem to get it right and I'm having a hard time tracking down what exactly is misconfigured.

If it matters, we may also need a separate configuration with one UART, one SPI master, and one TWI master. I'm hoping/assuming that will be straightforward once we see how to implement 2xUART and 1xSPI master but if there are any other tricky settings to know about if we need to replace one UART with a TWI master, I'd be interested in hearing about those settings.

Thanks.

Parents Reply Children
  • Sorry, I'm not sure how to reply in line without the nested quotes becoming a mess, so I'll try to make it clear what I'm responding to.

    • I'm using nRF5340DK 0.11.0 according to the sticker on the top of the board.
    • I think I had seen that thread you linked about UARTs on the nRF9160, but the nRF9160DK dts file already has two UARTs in it so it's easy to use both, but the nRF5340DK dts file only has one UART. >>> Actually while writing this I checked again, and it looks like a "arduino_serial: &uart1" was added to nrf5340_cpuapp_common.dts when I updated from NCS 1.5.1 to 1.6.0. So maybe that was part of my issue. But still generally what I don't have a clear answer on is what exactly do I need to put in an overlay file (and/or other settings files) to allow me to use a UART or other peripheral that is not defined in the dts files for the DK?
    • Regarding TF-M, I thought I read that TF-M was the default as of NCS 1.6.0 but I might've misunderstood.
    • Regarding my comment about needing a second configuration that uses TWI instead of a second UART, I just meant that we're working on two variations of this board and one might have UART, SPI, and TWI instead of UART, UART, and SPI, and I wondered if there were any other issues to consider with that second configuration.

    I've read through tutorials and blogs and documentation and watched videos on the Nordic Youtube channel and I understand conceptually what I'm supposed to do with dts files and overlays, but I still seem to be missing something. Are there corresponding changes I need to make to my prj.conf that I'm overlooking for example? I appreciate your detailed response and I apologize if my frustration comes through, but as a long time user of nRF52 and nRF5 SDK, the difficulty with something as simple as enabling a peripheral in this new SDK is discouraging.

Related