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

2 devices on a single TWI instance + PPI

Do you have any sample code that shows how to retrieve data via i2c from 2 different device addresses using PPI?

Parents
  • Hi, 

    This will only be possible to achieve if you have identical read and write buffer sizes for both devices. You will need to use the EasyDMA array list feature, and fill the array with alternating read and write commands for the two devices. You can then write the TASKS_START register to start a transfer to one device. When you trigger TASKS_START again, the RXD and TXD buffers will jump to the next buffer in the list (by adding the MAXCNT size to the buffer pointer).

    You can enable the EasyDMA list feature in the driver by setting the flag NRFX_TWIM_FLAG_TX_POSTINC/NRFX_TWIM_FLAG_RX_POSTINC, but you will have to reserve/fill the consecutive data in the RAM buffers manually. Unfortunately, we do not have any sample code apart from the code in the above linked TWIM peripheral documentation.

    Best regards,
    Jørgen

Reply
  • Hi, 

    This will only be possible to achieve if you have identical read and write buffer sizes for both devices. You will need to use the EasyDMA array list feature, and fill the array with alternating read and write commands for the two devices. You can then write the TASKS_START register to start a transfer to one device. When you trigger TASKS_START again, the RXD and TXD buffers will jump to the next buffer in the list (by adding the MAXCNT size to the buffer pointer).

    You can enable the EasyDMA list feature in the driver by setting the flag NRFX_TWIM_FLAG_TX_POSTINC/NRFX_TWIM_FLAG_RX_POSTINC, but you will have to reserve/fill the consecutive data in the RAM buffers manually. Unfortunately, we do not have any sample code apart from the code in the above linked TWIM peripheral documentation.

    Best regards,
    Jørgen

Children
Related