EasyDMA

nRF54LM20A | nRF54LM20B Datasheet

Samples are written directly to RAM, meaning EasyDMA must be configured appropriately.

The address pointer for the EasyDMA channel is set in the SAMPLE.PTR register. If the destination address set in SAMPLE.PTR is not pointing to the Data RAM region, an EasyDMA transfer may result in a HardFault or RAM corruption. See Memory for more information about memory regions.

Note: The value programmed in SAMPLE.PTR register must be 32-bit aligned.

DMA transfer supports Stereo (left and right 16-bit samples) and Mono (left only) data transfer as configured in the OPERATION field of the MODE register. The samples are stored as little endian.

Table 2. DMA sample storage
MODE.OPERATION Bits per sample Result stored per RAM word Physical RAM allocated (32-bit words) Result boundary indexes in RAM Note
Stereo 32 (2x16) L+R ceil(SAMPLE.MAXCNT/2)

R0=[31:16]

L0=[15:0]

Default
Mono 16 2xL ceil(SAMPLE.MAXCNT/2)

L1=[31:16]

L0=[15:0]

The destination buffer in RAM consists of one block, where the size of the block is set in the SAMPLE.MAXCNT register. The sample format is number of bytes used by the samples that will be stored in the memory. The physical RAM allocated is always the following:

(RAM allocation, in bytes)=SAMPLE.MAXCNT * 2;

Sample mapping depends on MODE.OPERATION.

If OPERATION=Stereo, RAM will contain a succession of left and right samples.

If OPERATION=Mono, RAM will contain a succession of left only samples.

For a given value of SAMPLE.MAXCNT, the buffer in RAM can contain half the stereo sampling time as compared to the mono sampling time.

The PDM acquisition can be started by the START task, after the SAMPLE.PTR and SAMPLE.MAXCNT registers have been written. When PDM starts, it will take some time (tPDM,DATA) for the filters to generate valid data. Transients from the PDM microphone itself may also occur. The first few samples (typically around 50) can contain invalid values or transients. It is advised to discard the first few samples after a PDM start.

As soon as the STARTED event is received, the firmware can write the next SAMPLE.PTR value (this register is double-buffered), to ensure continuous operation.

When the buffer in RAM is full of samples, an END event is triggered. The firmware can start processing the data in the buffer. At the same time, PDM starts acquiring data into the new buffer pointed to by SAMPLE.PTR. It sends a new STARTED event, so that the firmware can update SAMPLE.PTR to the next buffer address.