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

nRF52 TWI easyDMA feature

Hi,

I want to know that if the TWI easyDMA in nRF52 can help in achieving this task:

  • we want to read from TWI each 10msec based on a timer interrupt and write the values in an array, e.g., A

  • meanwhile we want to transfer an array, e.g., B. Assume we can choose between non-connectable advertising or being in a connection.

Is this possible? Normally we should wait for the reading to finish, and then transmit in the 10msec window. Can DMA help in eliminating this sequence?

Thanks!

Parents
  • Hi,

    I guess it's not EasyDMA (alone) but rather PPI (see the description here). It should be possible to launch TWI transfer upon Timer end event (all that purely in HW without need to wake or interrupt CPU) but still you will probably need some management in your app. I did similar with PWM and SPI just by using NRF drivers from SDK 10/11 (they use EasyDMA and I've used two rotating 128-byte buffers to keep the PWM continuous, you are limited to 255B for single transfer on SPI and TWI anyway). It worked with interrupts at 1ms range, so 10ms shouldn't be a problem.

    Cheers Jan

  • You are not getting better answer then "yes it could work" because 1) you won't get it until you code quick demo and try it and 2) your requirements aren't precise enough (e.g. to code that demo) anyway. Luckily you know what exactly you want so it should be easy to get there with PPI and TWI (with EasyDMA) examples from SDK. I suppose you need to have some tolerance/threshold on that 10ms timer and based on that you can assess resulting demo. Just to be clear: with Nordic stack once there is some scheduled radio event it will get always priority and delays all application SW processing. In case you wouldn't be able to achieve your goal with PPI and "cached" TWI transaction handled autonomously by EasyDMA then you would only need custom stack (very very costly) or some "cache and forward" auxilary MCU (this is easy and even relatively cheap).

    Cheers Jan

Reply
  • You are not getting better answer then "yes it could work" because 1) you won't get it until you code quick demo and try it and 2) your requirements aren't precise enough (e.g. to code that demo) anyway. Luckily you know what exactly you want so it should be easy to get there with PPI and TWI (with EasyDMA) examples from SDK. I suppose you need to have some tolerance/threshold on that 10ms timer and based on that you can assess resulting demo. Just to be clear: with Nordic stack once there is some scheduled radio event it will get always priority and delays all application SW processing. In case you wouldn't be able to achieve your goal with PPI and "cached" TWI transaction handled autonomously by EasyDMA then you would only need custom stack (very very costly) or some "cache and forward" auxilary MCU (this is easy and even relatively cheap).

    Cheers Jan

Children
No Data
Related