Trigger DMA with Signal at Input Pin

Status
Not open for further replies.

gfvalvo

Well-known member
Hi All.
Wondering if anyone can supply example code that will configure a Teensy 3.2 input pin to trigger a DMA operation. I see the flavor of how to do it in the datasheet, but I’m sure there are nuances that I’m missing. Starting with a known-good example and modifying it as needed sure would be easier.
Thanks.
 
Thanks.

After a lot of Googling, I found this:
https://developer.mbed.org/media/uploads/GregC/an5083-using_dma_for_pulse_counting.pdf
It's not exactly what I needed, but provided me with enough clues to write this code:
Code:
  // Configure to trigger DMA of falling edge of signal applied to Pin 2 
  SIM_SCGC5 |= SIM_SCGC5_PORTD;
  CORE_PIN2_CONFIG = PORT_PCR_MUX(1) | PORT_PCR_IRQC(2);
  SIM_SCGC6 |= SIM_SCGC6_DMAMUX;
  SIM_SCGC7 |= SIM_SCGC7_DMA;

  /* --------------------------------------
   *  Put dma.TDC setup code here
   --------------------------------------*/
  
  dma.triggerAtHardwareEvent(DMAMUX_SOURCE_PORTD);
  dma.enable();
This is working for me.
 
Status
Not open for further replies.
Back
Top