This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Using 5 instances of SPI/I2C - nRF5340DK

Hello all,

I would like to know if it would be possible to simultaneously use 3 instances of I2C and 2 of I2C for the nRF5340DK. As stated in the data sheet, the application core can use at the same time 4 instances of the serial peripherals (UARTE/SPIM/SPIS/TWIM/TWIS). Considering the "extra" instance corresponding to SPIM4, even 5 instances would be possible.

Considering the following example configuration with 3x I2C (master) and 2x SPI (master):

  • TWIM0
  • TWIM1
  • TWIM2
  • SPIM3
  • SPIM4

A few questions arise:

  1. Is that configuration possible at all? What happens with UART? As far as I know, UARTE0 is enabled by default for both debugging and logging (e.g. with prinkt).

  2. If I disable the UART as follows, am I right to assume that I can then use SPIM0/SPIS0/TWIM0/TWIS0, as the base address for the serial peripheral instance 0 is now free?

    //overlay file
    &uart0 {
            status = "disabled";
    };
    


  3. What should the prj.conf look like? I just added CONFIG_DEBUG_OPTIMIZATIONS=y to be able to debug. Do I need to add some option to disable UART as well?

  4. What would we lose by disabling the UART? I understand that logging would be lost ( RTT could be used instead) but what happens with the debugging functionality? If the debugging functionality was also lost, I assume we should use something like an external JTAG (e.g. J-Link Plus)

Thanks in advance!!

  • Hi

    Is that configuration possible at all? What happens with UART? As far as I know, UARTE0 is enabled by default for both debugging and logging (e.g. with prinkt).

    This configuration is possible, yes, but it is true that you won't have any UART's available for the application core and will have to resort to other means for logging etc.

    If this was your actual configuration I would ask if you could combine some of the TWIM or SPIM interfaces into one (since I2C master and SPI master support multiple slaves on the same bus), but I assume it is more of a theoretical question?

    If I disable the UART as follows, am I right to assume that I can then use SPIM0/SPIS0/TWIM0/TWIS0, as the base address for the serial peripheral instance 0 is now free?

    That is correct. 

    What should the prj.conf look like? I just added CONFIG_DEBUG_OPTIMIZATIONS=y to be able to debug. Do I need to add some option to disable UART as well?

    In order to disable the serial driver, and ensure that the log interface uses the RTT backend instead of UART, you can add the following to your configuration file:

    CONFIG_SERIAL=n
    CONFIG_LOG=y
    CONFIG_LOG_BACKEND_RTT=y
    CONFIG_LOG_BACKEND_UART=n
    What would we lose by disabling the UART? I understand that logging would be lost ( RTT could be used instead) but what happens with the debugging functionality? If the debugging functionality was also lost, I assume we should use something like an external JTAG (e.g. J-Link Plus)

    For most projects all you lose is the logging. The SWD interface used for debugging and RTT is using dedicated pins (called SWDIO and SWDCLK in the pinout), and will always be available regardless of how many peripherals you are using. 

    Best regards
    Torbjørn

Related