1
NXPTM M522XX, KINETIS and i.MX RT / Generate output clock with KL03Z
« on: August 25, 2016, 10:04:52 PM »
Hi all,
I'd like to generate an internal clock from the KL03 and output the signal through a GPIO pin. Specifically I need a clock between 6 and 12MHz, which I'd like to use to drive an FPGA. I tried with the PWM modules, but it seems I can't go above 4MHz, and I'm not even sure this is the best approach. Is there a way to output directly to a pin one of the internal KL03 clocks?
Below is the code I'm currently using for the PWM approach that gives 4MHz output on PB11.
Thank you,
Enrico
I'd like to generate an internal clock from the KL03 and output the signal through a GPIO pin. Specifically I need a clock between 6 and 12MHz, which I'd like to use to drive an FPGA. I tried with the PWM modules, but it seems I can't go above 4MHz, and I'm not even sure this is the best approach. Is there a way to output directly to a pin one of the internal KL03 clocks?
Below is the code I'm currently using for the PWM approach that gives 4MHz output on PB11.
Code: [Select]
PWM_INTERRUPT_SETUP pwm_setup;
pwm_setup.int_type = PWM_INTERRUPT;
pwm_setup.pwm_mode = (PWM_SYS_CLK | PWM_PRESCALER_1); // clock PWM timer from the IRC48M clock with /1 pre-scaler
pwm_setup.int_handler = 0; // no user interrupt call-back or DMA on PWM cycle
pwm_setup.pwm_frequency = PWM_TIMER_US_DELAY(TIMER_FREQUENCY_VALUE(500000), 8);
pwm_setup.pwm_value = _PWM_PERCENT(50, pwm_setup.pwm_frequency); // 50% PWM (high/low)
pwm_setup.pwm_reference = (_TIMER_0 | 0); // timer module 0, channel 0
fnConfigureInterrupt((void *)&pwm_setup); // enter configuration
Thank you,
Enrico