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

How to configure NRF52840 TWI (I2C) peripherals

Hello, everyone

I use NRF52840 to configure TWI to operate the sensor, but I don’t understand it.

Can the hardware TWI of 52840 be mapped to any IO?

Or is there a fixed IO with multiple multiplexing functions?

If it can be arbitrarily mapped and reused, how to use the TWI0 and TWI1 peripherals at the same time, if it is not arbitrarily mapped, which document describes the operation instructions of 52840 IO multiplexing?

thanks!

Best Regards!
Parents
  • Hi,

    Yes, the nRF52840 has a pin crossbar feature, allowing you to map the pins of the serial interfaces to any GPIO. This is from the TWIM chapter in the PS:

    "The GPIOs used for each two-wire interface line can be chosen from any GPIO on the device and are independently configurable. This enables great flexibility in device pinout and efficient use of board space and signal routing."

    That said, there is not all pins that are recommended for use with all serial peripheral pins. As mentioned in the Pin assignments, some GPIOs are marked as "Standard drive, low frequency IO only". You should avoid using these pins for pins that will handle high-frequency signals.

    The GPIOs are set in the PSEL.SCL and PSEL.SDA registers.

    Best regards,
    Jørgen

Reply
  • Hi,

    Yes, the nRF52840 has a pin crossbar feature, allowing you to map the pins of the serial interfaces to any GPIO. This is from the TWIM chapter in the PS:

    "The GPIOs used for each two-wire interface line can be chosen from any GPIO on the device and are independently configurable. This enables great flexibility in device pinout and efficient use of board space and signal routing."

    That said, there is not all pins that are recommended for use with all serial peripheral pins. As mentioned in the Pin assignments, some GPIOs are marked as "Standard drive, low frequency IO only". You should avoid using these pins for pins that will handle high-frequency signals.

    The GPIOs are set in the PSEL.SCL and PSEL.SDA registers.

    Best regards,
    Jørgen

Children
No Data
Related