What is the difference between Event System and DMA ?
If both works without CPU intervention. What is main difference basically ?
In which case, which one do we prefer ?
What is the difference between Event System and DMA ?
If both works without CPU intervention. What is main difference basically ?
In which case, which one do we prefer ?
AIUI, "Events" - as the name suggests - are just events; ie, "something has happened"
So, a bit like interrupts.
For example, an Analog Comparator module could be configured to generate an event when the input signal rises above the compare threshold, which then triggers a Timer Counter module to capture the current count value for later use.
DMA is about transferring blocks of data.
https://microchipdeveloper.com/32arm:samd21-dmac-overview
which one do we prefer ?
whichever one suits the task at hand.
Note that Events & DMA can work together: a DMA transfer can be triggered on an Event, and/or can generate an Event when it completes
I would say that DMA is like an "event system" where the only possible action ("event user") is a memory transfer.
Events expand the concept to include other actions. An obvious example is periodically sampling an ADC - you have a (highly configurable) timer create an event that triggers the start of an ADC conversion, and the result of that is DMAed into memory, all without needing the CPU. (I guess the timer could in turn be controlled by an input pin event or Analog comparator event, for even more flexibility.)
It seems like a useful alternative to making all of the peripherals "smarter" - you could build periodic sampling into the ADC, but it probably wouldn't be as flexible. With events, you can tie relatively dumb peripherals together.