LPC54608 SCTimer trigger the DMA

cancel
Showing results for 
Search instead for 
Did you mean: 

LPC54608 SCTimer trigger the DMA

502 Views
kaiyuewang
Contributor I

Hello,

I am using the SCTimer match mode to generate trigger for DMA on the board LPC54608. But it seems that there are problemes.

I use the PIO0_0 FUNC_4 as SCT0_GPI0, and the PIO0_2 FUNC_3 as SCT0_OUT0. And when I debug the project, the COUNT register doesn't change. And the SCT has never send the trigger to DMA.

Could anyone help me?

My code  is below (I am using the SDK for LPC54608):

static void GPIO_Init(void)
{
   CLOCK_EnableClock(kCLOCK_Gpio0);
   CLOCK_EnableClock(kCLOCK_Gpio1);

   //Define a digital output pin configuration,
   gpio_pin_config_t configOut =
   {
      kGPIO_DigitalOutput,
      0,
   };

   GPIO_PinInit(GPIO, SCT0_OUT0_PORT, SCT0_OUT0_PIN, &configOut);
   GPIO_WritePinOutput(GPIO, SCT0_OUT0_PORT, SCT0_OUT0_PIN, 0);

   IOCON_PinMuxSet(IOCON, SCT0_GPI0_PORT, SCT0_GPI0_PIN, IOCON_INPFILT_OFF |                                     IOCON_DIGITAL_EN);
   IOCON_PinMuxSet(IOCON, SCT0_OUT0_PORT, SCT0_OUT0_PIN, IOCON_FUNC3 | IOCON_INPFILT_OFF |                                     IOCON_DIGITAL_EN);

   gpio_pin_config_t configIn =
   {
      kGPIO_DigitalInput,
      0,
   };

   GPIO_PinInit(GPIO, SSEL_PORT, SSEL_PIN, &configIn);
   GPIO_PinInit(GPIO, SCT0_GPI0_PORT, SCT0_GPI0_PIN, &configIn);
   // GPIO_WritePinOutput(GPIO, SSEL_PORT, SSEL_PIN, 0);

}

Tags (1)
0 Kudos
2 Replies

66 Views
kaiyuewang
Contributor I

Sorry, I haven't finished. 

The code for the SCTimer:

static void SCTimer_Init(void)
{
   /* configure the input mux for the sct timer input0 from external pin*/
   INPUTMUX_Init(INPUTMUX);
   INPUTMUX_AttachSignal(INPUTMUX, 0U, kINPUTMUX_SctGpi0ToSct0);
   INPUTMUX_AttachSignal(INPUTMUX, 0U, kINPUTMUX_Sct0DmaReq0ToDma);

   sctimer_config_t sctimerInfo = {true, kSCTIMER_Input_ClockMode, kSCTIMER_Clock_On_Rise_Input_0, false, false, 0, 0, 0};
   /* Initialize SCTimer module */
   SCTIMER_Init(SCT0, &sctimerInfo);

   uint32_t eventCounterL = 0;
   /* Schedule a match event for SCT0 */
   SCTIMER_CreateAndScheduleEvent(SCT0, kSCTIMER_MatchEventOnly, MAT_VALUE, 0, kSCTIMER_Counter_L,
&eventCounterL);

   /* Reset Counter L when Counter L event occurs */
   SCTIMER_SetupCounterLimitAction(SCT0, kSCTIMER_Counter_L, eventCounterL);

   /* Toggle the output level */
   SCTIMER_SetupOutputToggleAction(SCT0, 0, eventCounterL);

   /* Generate a DMA request when Counter L event occurs */
   SCTIMER_SetupDmaTriggerAction(SCT0, 0, eventCounterL);

   /* Start the L counter */
   SCTIMER_StartTimer(SCT0, kSCTIMER_Counter_L);
}

0 Kudos

66 Views
soledad
NXP Employee
NXP Employee

Hi,

Please check the below document,

DMA Ping-Pong application 

I hope this helps,


Have a great day,
Soledad

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos