A rare DMA related issue when using DMA and radio (MAC)

Hi there!

I have found an issue when using DMA concurrently as using the radio. It is manifested in application code as random DMA transfer errors, the radio itself is not affected.
The root cause is the radio_mac rearming its channels, unfortunately it also rearms any (other) active DMA channels as well.

In the current SDK at github.com/pololu/wixel-sdk/lib … mac.c#L192
The code does a read-modify-write on the DMAARM register, this unfortunately means that other channels that are active will be rearmed as well.

The fix until a new library is release is to change the update to DMAARM register to write-only, that is

/** Start up the radio in the new state which was decided above. **/ switch(radioMacState) { case RADIO_MAC_STATE_RX: DMAARM = (1<<DMA_CHANNEL_RADIO); // Arm DMA channel. RFST = SRX; // Switch radio to RX. break; case RADIO_MAC_STATE_TX: DMAARM = (1<<DMA_CHANNEL_RADIO); // Arm DMA channel. RFST = STX; // Switch radio to TX. break; }


Hello, Mattias.

Thank you for the feedback. It looks like DMAARM |= (1<<1); compiles to a single orl instruction, but that instruction takes four cycles to complete and performs a read-modify-write operation. I have changed the Wixel SDK to use “=” when writing to DMAARM.

By the way, the links you posted are broken. The proper syntax for linking to a line on a Github file is:

github.com/pololu/wixel-sdk/blo … mac.c#L188

If you want your link to always point to the same thing, you should include a commit hash in it, like this:

github.com/pololu/wixel-sdk/blo … mac.c#L188


thanks for the feedback, both on the radio_mac issue and link posting.

did not though of : got part of the link, just wrote more or like how a compiler present file and line number :slight_smile:
I will fix.