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

Looking for the TWI eDMA example (possibly with PPI)

Hi,

I am looking for an example that uses the eDMA with the TWI in the 15.2 SDK on nRF52840.

My idea is to read out an external sensor using the TWI with as little processor involvement as possible. The sensor fills a buffer (this buffer is contained in the sensor) and is able to interrupt the processor when this buffer is filled to a certain level.  It should be possible for this interrupt to start a TWI read action through the PPI that reads the sensor data into a buffer using the eDMA right? Or is this not feasible?

I looked on the devZone and found similar questions but I did not find a specific link to an example using the 15.2 sdk version. I also tried grepping through the sdk but didn't really find anything useful.

Thanks in advance and best regards,

Michiel

Parents Reply Children
  • Hi,

    Will migrating to the nrfx_twi driver also allow me to read more then 255 bytes in one read operation? Because the nrf_drv_twi_rx function only allows for the read length to be an 8bit unsigned integer. So if I would like to read more then 255 bytes and use the eDMA is will have to migrate anyway right?

    Or is there a way to avoid migrating to the nrfx drivers for now and still combine the eDMA with TWI reads larger then 255 bytes?

    Best regards,

    Michiel

  • Yes, migrating to nrfx_twim driver will allow you to do transfers larger than 255 bytes on nRF52840. nRF52832 had a 8-bit limitation on the MAXCNT register, allowing only 255 byte transfers. This has been increased for all other nRF52 variants, as you can see in this overview table.

    The legacy TWI peripheral with the nrfx_twi driver can also be use for larger transfers on all nRF52 chip variants, but this requires the CPU to update the data for each byte being sent. 

    There is no way to use the legacy driver API for longer transfers than 255 bytes without modifying the driver and API.

Related