How to route QTMR output via XBAR to pin?

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

How to route QTMR output via XBAR to pin?

947 Views
bikenomad
Contributor III

I have a board on which I have to produce a simple PWM waveform on pin GPIO_AD_B1_09 on an MIMRT1021DAG5A.

This requires going through the XBAR.

I have successfully routed another pin through the XBAR to a QTMR input, but can't see any output on this pin with the following PWM code:

// Generating 22kHz PWM using TMR1 channel 1 to pin GPIO_AD_B1_09
// Want to connect TMR1.output1 to pin GPIO_AD_B1_09
// but need to do it through the XBAR
#define FAN_PWM_TIMER TMR1
#define FAN_PWM_TIMER_CHANNEL kQTMR_Channel_1
#define FAN_PWM_FREQUENCY 22000UL
#define FAN_TIMER_DIVIDED_CLOCK 1953125UL

void fan_pwm_initialize(void)
{
CLOCK_EnableClock(kCLOCK_Iomuxc);
CLOCK_EnableClock(kCLOCK_Xbar1);
XBARA_Init(XBARA);

IOMUXC_SetPinMux(IOMUXC_GPIO_AD_B1_09_XBAR1_INOUT13, 0);
IOMUXC_SetPinConfig(IOMUXC_GPIO_AD_B1_09_XBAR1_INOUT13, 0x1080);
IOMUXC_GPR->GPR6 = (IOMUXC_GPR->GPR6 & (~(IOMUXC_GPR_GPR6_IOMUXC_XBAR_DIR_SEL_13_MASK))) |
IOMUXC_GPR_GPR6_IOMUXC_XBAR_DIR_SEL_13(0x01U);

XBARA_SetSignalsConnection(XBARA, kXBARA1_InputQtimer1Tmr1, kXBARA1_OutputIomuxXbarInout13);

qtmr_config_t qtmrConfig = {
.debugMode = kQTMR_RunNormalInDebug,
.enableExternalForce = false,
.enableMasterMode = false,
.faultFilterCount = 0,
.faultFilterPeriod = 0,
.primarySource = kQTMR_ClockDivide_64, // 1.953 MHz clock
.secondarySource = kQTMR_Counter0InputPin,
};

QTMR_Init(FAN_PWM_TIMER, FAN_PWM_TIMER_CHANNEL, &qtmrConfig);
// start at 50% duty cycle
QTMR_SetupPwm(FAN_PWM_TIMER, FAN_PWM_TIMER_CHANNEL, FAN_PWM_FREQUENCY, 50, false, FAN_TIMER_DIVIDED_CLOCK);
QTMR_StartTimer(FAN_PWM_TIMER, FAN_PWM_TIMER_CHANNEL, kQTMR_PriSrcRiseEdge);
};

How can I make this work? I have looked at the TMR1 registers in a debugger and they look OK.

Labels (1)
0 Kudos
8 Replies

931 Views
jeremyzhou
NXP Employee
NXP Employee

Hi @bikenomad ,
Thank you for your interest in NXP Semiconductor products and for the opportunity to serve you.
After having a brief review of the above code, I've not found something wrong, so I guess the issue may be related to hardware.
Have a great day,
TIC

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

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
------------------------------------------------------------------------------

0 Kudos

925 Views
bikenomad
Contributor III

I have tried two EVK boards with the same result. My EVK boards are version A3, and I have checked to make sure that the pin GPIO_AD_B1_09 is in fact connected to J17/1.

Could you look a bit more closely?

 

0 Kudos

914 Views
jeremyzhou
NXP Employee
NXP Employee

Hi,
Thanks for your reply.
Whether you can upload the complete demo project that is able to replicate the phenomenon.
Have a great day,
TIC

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

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
------------------------------------------------------------------------------

0 Kudos

890 Views
bikenomad
Contributor III

I uploaded the project. Do you need any more information?

0 Kudos

871 Views
jeremyzhou
NXP Employee
NXP Employee

Hi,
Thanks for your reply.
I already replicate the phenomenon on MIMXRT1020-EVK, and now I'm still working on it.
Have a great day,
TIC

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

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
------------------------------------------------------------------------------

0 Kudos

816 Views
bikenomad
Contributor III

Any progress?

0 Kudos

907 Views
bikenomad
Contributor III

Project is attached.

0 Kudos

806 Views
jeremyzhou
NXP Employee
NXP Employee

Hi,
Sorry for replying late.
I created a new demo project that bases on the evkmimxrt1020_qtmr_inputcapture_outputpwm, then add the XBAR feature, now I can output the PWM via the GPIO_AD_B1_09.
Please check the attachment.
Have a great day,
TIC

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

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
------------------------------------------------------------------------------

0 Kudos