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

nRF52840 Switching Between DMA and Normal Read (TWI)

I'm working from the https://github.com/Martinsbl/nrf5-mpu-examples/tree/sdk13/nrf52-mpu-easydma-using-gpiote-and-registers example and the DMA portion is working splendidly, but I also need to be able to put the MPU into a sleep mode, where it can wakeup the nRF52 on motion. This has all worked fine in the past, but I'm struggling to figure out what specifically I need to do to 'undo' the DMA setup, and get back to 'normal' (non-DMA) comms w/ the MPU.

It no longer seems like this work - specifically on the nRF52840 / SES combination.

  • Hi,

    What's the motivation of using TWIM + GPIOTE during sleep and disabling it when you wake up? It seems like your intention is to use it as an interrupt to wake up the CPU and then start collecting data from the MPU. If so, then a better method in terms of current consumption would be to use a interrupt line to wake up the CPU from sleep. Given that the MPU has that option. The TWIM peripheral will draw considerable current during sleep.

    regards

    Jared 

  • If you check the example - it's using DMA to collect data from the MPU at 500Hz - that all works brilliantly.  No CPU required.  But, after a period of no-motion, then I reconfigure the MPU for deep sleep / motion wakeup interrupt.  For that, I'm back to communicating directly w/ the MPU, where TWI/TWIM comms are needed.

  • Hi,

    If you want to free up the TWIM instance by disabling the PPI channel then you have to write 0 to the  NRF_PPI->CHEN channel. The PPI channel will then no longer be active. Note that the TWIM will still use EasyDMA, disabling the PPI + GPIOTE channel will only disable the automated transfer that is triggered by the GPIOTE event. 

    Sorry for the late answer. I've been out of office. 

    regards

    Jared 

Related