Flow of the Code:
Read more- The DMA (Direct Memory Access) process is initiated by a timer in this setup. The timer records the number of ticks, which is stored in a register. This value, representing the number of ticks, is then compared to the value in the CC (Compare Count) register. When the number of ticks matches the CC register value, an interrupt or trigger is generated. The tick duration can be adjusted by changing prescalers or modifying the clock source.
- The PPI (Peripheral Peripheral Interface) module can be thought of as a configurable connection between two peripherals. In this system, the timer's interrupt is fed as the input event to the PPI, which serves as the starting point for the PPI to execute a specific task and, if necessary, fork the process. A development board provides a range of supported events to which the PPI can be connected, with one of these being the timer event. The task and fork operations must be supported by the board. In this particular case, the task was to initiate the SAADC (Successive Approximation Analog-to-Digital Converter) task, and the fork was to trigger the SAADC to commence the conversion process.
- Once the SAADC receives a trigger from the PPI, it converts the analog signal from that particular moment into a corresponding digital value. This digital value is then stored in a memory buffer of the specified size. The DMA (EasyDMA) takes care of transferring these values into memory without the need for CPU intervention. Once all the data transfer is complete, the CPU is notified.
- Storing values in a buffer, especially when sampling at a high rate, can potentially lead to data loss when the buffer is full and needs to be processed. To mitigate this issue, a ping pong buffer strategy is employed. One buffer is filled with sampled values and being processed while incoming high data rate samples are stored in the other buffer. Once the second buffer is full and in the process of being handled, new data samples are stored in the first buffer. This process alternates, ensuring continuous data capture.
- Comparing the system's performance with and without DMA on the Arduino Nano BLE 33, it was observed that the setup without DMA drew approximately 4.73 uA of current, while with DMA, it consumed about 4.6 uA of current. This demonstrates that DMA indeed consumes less current. However, it's noteworthy that the readings of current for different examples were relatively similar for both setups, likely because the DMA controller, like many external modules, draws a somewhat higher current. The key advantage of DMA is its ability to transfer data to memory more efficiently and swiftly while using less overall power.









Comments