Trigger the DMA by eMIOS periodically

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Trigger the DMA by eMIOS periodically

2,783 Views
Ayaz
Contributor IV

Hi,

I’ve been working with the S32K344 and previously used PIT to periodically trigger DMA transfers — specifically to move data from one buffer to another. This setup worked well.

Now, I’m trying to replace PIT with eMIOS to periodically trigger the DMAMUX, but I’m running into issues. I attempted to implement this using eMIOS in OPWMB mode to generate a periodic signal, expecting it to trigger the DMAMUX similarly to how PIT did. However, the DMA transfer doesn’t seem to be happening.

To help clarify my design and get support, I’ve created a minimal example project that replicates the setup. It includes:

  • eMIOS configured for periodic output
  • DMAMUX and DMA setup to transfer data on trigger
  • A simple buffer-to-buffer transfer

I’d really appreciate it if someone could take a look and help me identify what might be going wrong or suggest the correct configuration to make eMIOS trigger DMAMUX reliably.

0 Kudos
Reply
3 Replies

2,743 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

DMA trigger was not enabled on eMIOS channel completely. Add below code 

PetrS_0-1760514820816.png

BR, Petr

0 Kudos
Reply

2,733 Views
Ayaz
Contributor IV

Hi,
It’s working now—thanks for the info!

I need to trigger DMA periodically using eMIOS PWM. In my current setup, I’m using OPWMB mode with a 25 µs period. As I understand it, the DMA request is generated when the flag is set, which occurs at the end of the PWM period.

Could you please confirm:

  • In OPWMB mode, is the DMA request triggered at the trailing edge, i.e., when the timebase counter reloads at the end of the period?

Also, I’m considering whether OPWMT mode would be more precise than OPWMB for periodic DMA triggering.
For example, if I configure a timebase of 25 µs (e.g., 1000 ticks) and set the TRIGGR to activate at 1000 ticks, would OPWMT offer better control or timing accuracy?

I’d appreciate it if you could share some detailed insights or recommendations on which mode is best suited for periodic DMA triggering.

Thanks in advance!

0 Kudos
Reply

2,704 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

yes, the DMA request is generated when the flag is set. Flag setting time can vary depending mode used.
In OPWMB mode this is either on BS1 match (trailing edge) or both AS1/BS1 match (leading/trailing edge).
In OPWMT mode flag is set only at an AS2 match. An AS1, BS1, or BS2 match has no effect on the flag. So flag generation is independent on edge placement and can be freely set over PWM period. 

BR, Petr

0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-2185837%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ETrigger%20the%20DMA%20by%20eMIOS%20periodically%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2185837%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%2C%3C%2FP%3E%3CP%3EI%E2%80%99ve%20been%20working%20with%20the%20S32K344%20and%20previously%20used%20%3CSTRONG%3EPIT%20to%20periodically%20trigger%20DMA%3C%2FSTRONG%3E%20transfers%20%E2%80%94%20specifically%20to%20move%20data%20from%20one%20buffer%20to%20another.%20This%20setup%20worked%20well.%3C%2FP%3E%3CP%3ENow%2C%20I%E2%80%99m%20trying%20to%20%3CSTRONG%3Ereplace%20PIT%20with%20eMIOS%3C%2FSTRONG%3E%20to%20periodically%20trigger%20the%20%3CSTRONG%3EDMAMUX%3C%2FSTRONG%3E%2C%20but%20I%E2%80%99m%20running%20into%20issues.%20I%20attempted%20to%20implement%20this%20using%20eMIOS%20in%20OPWMB%20mode%20to%20generate%20a%20periodic%20signal%2C%20expecting%20it%20to%20trigger%20the%20DMAMUX%20similarly%20to%20how%20PIT%20did.%20However%2C%20the%20DMA%20transfer%20doesn%E2%80%99t%20seem%20to%20be%20happening.%3C%2FP%3E%3CP%3ETo%20help%20clarify%20my%20design%20and%20get%20support%2C%20I%E2%80%99ve%20created%20a%20%3CSTRONG%3Eminimal%20example%20project%3C%2FSTRONG%3E%20that%20replicates%20the%20setup.%20It%20includes%3A%3C%2FP%3E%3CUL%3E%3CLI%3EeMIOS%20configured%20for%20periodic%20output%3C%2FLI%3E%3CLI%3EDMAMUX%20and%20DMA%20setup%20to%20transfer%20data%20on%20trigger%3C%2FLI%3E%3CLI%3EA%20simple%20buffer-to-buffer%20transfer%3C%2FLI%3E%3C%2FUL%3E%3CP%3EI%E2%80%99d%20really%20appreciate%20it%20if%20someone%20could%20take%20a%20look%20and%20help%20me%20identify%20what%20might%20be%20going%20wrong%20or%20suggest%20the%20correct%20configuration%20to%20make%20eMIOS%20trigger%20DMAMUX%20reliably.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2187251%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20Trigger%20the%20DMA%20by%20eMIOS%20periodically%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2187251%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%2C%3C%2FP%3E%0A%3CP%3E%3CSPAN%3Eyes%2C%20the%20DMA%20request%20is%20generated%20when%20the%26nbsp%3B%3C%2FSPAN%3Eflag%20is%20set.%20Flag%20setting%20time%20can%20vary%20depending%20mode%20used.%3CBR%20%2F%3EIn%20OPWMB%20mode%20this%20is%20either%20on%20BS1%20match%20(trailing%20edge)%20or%20both%20AS1%2FBS1%20match%20(leading%2Ftrailing%20edge).%3CBR%20%2F%3EIn%20OPWMT%20mode%20flag%20is%20set%20only%20at%20an%20AS2%20match.%20An%20AS1%2C%20BS1%2C%20or%20BS2%20match%20has%20no%20effect%20on%20the%20flag.%20So%20flag%20generation%20is%20independent%20on%20edge%20placement%20and%20can%20be%20freely%20set%20over%20PWM%20period.%26nbsp%3B%3C%2FP%3E%0A%3CP%3EBR%2C%20Petr%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2186741%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20Trigger%20the%20DMA%20by%20eMIOS%20periodically%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2186741%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%2C%3CBR%20%2F%3EIt%E2%80%99s%20working%20now%E2%80%94thanks%20for%20the%20info!%3C%2FP%3E%3CP%3EI%20need%20to%20trigger%20DMA%20periodically%20using%20%3CSTRONG%3EeMIOS%20PWM%3C%2FSTRONG%3E.%20In%20my%20current%20setup%2C%20I%E2%80%99m%20using%20%3CSTRONG%3EOPWMB%20mode%3C%2FSTRONG%3E%20with%20a%20%3CSTRONG%3E25%20%C2%B5s%20period%3C%2FSTRONG%3E.%20As%20I%20understand%20it%2C%20the%20DMA%20request%20is%20generated%20when%20the%20%3CSTRONG%3Eflag%20is%20set%3C%2FSTRONG%3E%2C%20which%20occurs%20at%20the%20%3CSTRONG%3Eend%20of%20the%20PWM%20period%3C%2FSTRONG%3E.%3C%2FP%3E%3CP%3ECould%20you%20please%20confirm%3A%3C%2FP%3E%3CUL%3E%3CLI%3EIn%20%3CSTRONG%3EOPWMB%20mode%3C%2FSTRONG%3E%2C%20is%20the%20DMA%20request%20triggered%20at%20the%20%3CSTRONG%3Etrailing%20edge%3C%2FSTRONG%3E%2C%20i.e.%2C%20when%20the%20timebase%20counter%20reloads%20at%20the%20end%20of%20the%20period%3F%3C%2FLI%3E%3C%2FUL%3E%3CP%3EAlso%2C%20I%E2%80%99m%20considering%20whether%20%3CSTRONG%3EOPWMT%20mode%3C%2FSTRONG%3E%20would%20be%20more%20precise%20than%20%3CSTRONG%3EOPWMB%3C%2FSTRONG%3E%20for%20periodic%20DMA%20triggering.%3CBR%20%2F%3EFor%20example%2C%20if%20I%20configure%20a%20timebase%20of%20%3CSTRONG%3E25%20%C2%B5s%20(e.g.%2C%201000%20ticks)%3C%2FSTRONG%3E%20and%20set%20the%20%3CSTRONG%3ETRIGGR%3C%2FSTRONG%3E%20to%20activate%20at%201000%20ticks%2C%20would%20%3CSTRONG%3EOPWMT%3C%2FSTRONG%3E%20offer%20better%20control%20or%20timing%20accuracy%3F%3C%2FP%3E%3CP%3EI%E2%80%99d%20appreciate%20it%20if%20you%20could%20share%20some%20%3CSTRONG%3Edetailed%20insights%20or%20recommendations%3C%2FSTRONG%3E%20on%20which%20mode%20is%20best%20suited%20for%20periodic%20DMA%20triggering.%3C%2FP%3E%3CP%3EThanks%20in%20advance!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2186412%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20Trigger%20the%20DMA%20by%20eMIOS%20periodically%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2186412%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%2C%3C%2FP%3E%0A%3CP%3EDMA%20trigger%20was%20not%20enabled%20on%20eMIOS%20channel%20completely.%20Add%20below%20code%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22PetrS_0-1760514820816.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22PetrS_0-1760514820816.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F360851i4AADCEA9000358B3%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22PetrS_0-1760514820816.png%22%20alt%3D%22PetrS_0-1760514820816.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EBR%2C%20Petr%3C%2FP%3E%3C%2FLINGO-BODY%3E