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

  • Can you do this with 2 TWI instances?
    In other words, can I have device 1 in TWI0 and device 2 in TWI1 and use EasyDMA + PPI, so I can do the direct transfer from each device without CPU intervention with, let's say, each device having a MAXCNT = 4096 bytes?

    if not, what would be the ideal solution for collecting large chunks of data from 2 devices using TWI simultaneously without CPU intervention?

Reply Children
No Data
Related