x bar connection for input capture module in imxrt

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

x bar connection for input capture module in imxrt

2,154 Views
senthilnathan_n
Contributor I

Currently i want to perform the input capture operation hence i want to connect the XBAR. please let me how to connect the xbar for input capture  

Labels (1)
0 Kudos
6 Replies

1,815 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Do you have any updated information recently?

Actually, you don't need to use the XBARA DMA, you can ues the XBARA at first, whether it works OK on your side or not?

Have a great day,
Kerry

 

-------------------------------------------------------------------------------
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

1,815 Views
senthilnathan_n
Contributor I

Thanks for your feedback, Please find my code below : as you suggested not used DAM , i have used simple example which is available imxrt input capture:

But still input capture is not working   :means no ISR observed

Please find the function sequence 

==========================

    Step 1: XBARA_Init(XBARA1);
    Step2 :XBARA_SetSignalsConnection(XBARA1, kXBARA1_InputIomuxXbarInout16, kXBARA1_OutputQtimer3Tmr0Input);
    Step3 :QTMR_InputCapture();

===============================

Is there any issues in the sequence ?

Note : Hardware level everything is okay

#define BOARD_QTMR_BASEADDR TMR3
#define BOARD_QTMR_INPUT_CAPTURE_CHANNEL kQTMR_Channel_0
#define BOARD_QTMR_PWM_CHANNEL kQTMR_Channel_1
#define QTMR_CounterInputPin kQTMR_Counter0InputPin


#define QTMR_IRQ_ID TMR3_IRQn
#define QTMR_IRQ_HANDLER TMR3_IRQHandler

/* Get source clock for QTMR driver */
#define QTMR_SOURCE_CLOCK CLOCK_GetFreq(kCLOCK_IpgClk)

static void BOARD_InitSensorInputPins(void);
static void QTMR_InputCapture(void);
volatile bool qtmrIsrFlag = false;
bool TestTacho = false;
uint8_t TachoCount = 0;
bool TestSppedo = false;
uint8_t SppedoCount = 0;

volatile bool xbaraIsrFlag = false;

static void QTMR_InputCapture(void)
{
    qtmr_config_t qtmrConfig;
    uint32_t counterClock = 0;
    uint32_t timeCapt     = 0;
    uint32_t count        = 0;
    
     QTMR_GetDefaultConfig(&qtmrConfig);

    /* Init the first channel to use the IP Bus clock div by 8 */
    qtmrConfig.primarySource = kQTMR_ClockDivide_8;
    QTMR_Init(BOARD_QTMR_BASEADDR, BOARD_QTMR_INPUT_CAPTURE_CHANNEL, &qtmrConfig);

    /* Setup the input capture */
    QTMR_SetupInputCapture(BOARD_QTMR_BASEADDR, BOARD_QTMR_INPUT_CAPTURE_CHANNEL, QTMR_CounterInputPin, false, true,
                           kQTMR_RisingEdge);

    /* Enable at the NVIC */
    EnableIRQ(QTMR_IRQ_ID);

    /* Enable timer compare interrupt */
    QTMR_EnableInterrupts(BOARD_QTMR_BASEADDR, BOARD_QTMR_INPUT_CAPTURE_CHANNEL, kQTMR_EdgeInterruptEnable);

    /* Start the input channel to count on rising edge of the primary source clock */
    QTMR_StartTimer(BOARD_QTMR_BASEADDR, BOARD_QTMR_INPUT_CAPTURE_CHANNEL, kQTMR_PriSrcRiseEdge);

    counterClock = QTMR_SOURCE_CLOCK / 8000;
                           
}


void XBAR_Configuration(void)
{
   
    XBARA_Init(XBARA1);
    XBARA_SetSignalsConnection(XBARA1, kXBARA1_InputIomuxXbarInout16, kXBARA1_OutputQtimer3Tmr0Input);
    QTMR_InputCapture();

 
}


void QTMR_IRQ_HANDLER(void)
{
    /* Clear interrupt flag.*/
    QTMR_ClearStatusFlags(TMR4, kQTMR_Channel_1, kQTMR_EdgeFlag);
    qtmrIsrFlag = true;
    
}

0 Kudos

1,815 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi senthilnathan nagarajan,

  Share me your whole project which reproduce the problem.

Please also tell me what the RT chip and board you are using?

  When I have time, I will help you to check the details, I think there should some code problems, in theroy, the XBRA should work.


Have a great day,
Kerry

-------------------------------------------------------------------------------
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

1,815 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi senthilnathan nagarajan ,

  Could you tell me why you want to connect the xbr to the input capture? Please let me know you detail application.

  Please also let me know, which timer module you want to realize the capture function.

  Actually, all the xbr input pins can be find in the RT1050 reference manual, chapter 3.5 XBAR Resource Assignments.


Have a great day,
Kerry

-------------------------------------------------------------------------------
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

1,815 Views
senthilnathan_n
Contributor I

Hello Kerry,

 

  Thanks for your quick feedback : From my use case .AD_B0_02 want to use as input capture, i want to capture the every raising edge of external pulse which appears in AD_B0_02 pin.

in normal scenario non of the QTIMER is not connected with AD_B0_02 pin, if i want to use AD_B0_02 pin as input capture the only option is XBAR.

hence i am trying to connect AD_B0_02 with QTIMER by using XBAR options.

I am new to the XBAR hence i don't have idea about XBAR connection for AD_B0_02 pint for input capture.

Please find the my implementation below :

#define DEMO_XBARA_USER_CHANNEL_INPUT kXBARB2_InputQtimer4Tmr1Output

/**< QTIMER4_TMR1_OUTPUT output assigned to XBARB2_IN17 input. */

#define DEMO_XBARA_USER_CHANNEL_OUTPUT kXBARA1_OutputDmaChMuxReq30

/* Configure the XBAR signal connections */
    XBARA_SetSignalsConnection(DEMO_XBARA_BASEADDR, DEMO_XBARA_USER_CHANNEL_INPUT, DEMO_XBARA_USER_CHANNEL_OUTPUT);

void XBAR_Configuration(void)
{
    xbara_control_config_t xbaraConfig;

    /* Init XBAR module. */
    XBARA_Init(DEMO_XBARA_BASEADDR);  

    /* Configure the XBAR signal connections */
    XBARA_SetSignalsConnection(DEMO_XBARA_BASEADDR, DEMO_XBARA_USER_CHANNEL_INPUT, DEMO_XBARA_USER_CHANNEL_OUTPUT);

 

    /* Configure the XBARA interrupt */
    xbaraConfig.activeEdge  = kXBARA_EdgeRising;
    xbaraConfig.requestType = kXBARA_RequestInterruptEnalbe;
    XBARA_SetOutputSignalConfig(DEMO_XBARA_BASEADDR, DEMO_XBARA_USER_CHANNEL_OUTPUT, &xbaraConfig);

    /* Enable at the NVIC. */
    EnableIRQ(DEMO_XBARA_IRQ_ID);
}

Please provide your suggestion

addition two mode question : how the output are chosen : DEMO_XBARA_USER_CHANNEL_OUTPUT kXBARA1_OutputDmaChMuxReq30 ,XBARA1_OUT0 output assigned to DMA_CH_MUX_REQ30?

0 Kudos

1,815 Views
kerryzhou
NXP TechSupport
NXP TechSupport

It's very strange, my reply to this post is been migrated to a new discussion post, then I just copy it back to your post:

Hi  senthilnathan nagarajan,

   Thanks a lot for your description, now I understand your background now.

   You want to QTIMER4_timer1 channel as the input capture function, and the input capture pin is GPIO_AD_B0_02, but the QTIMER doesn't have that pin as the input capture pin. So you want to use the XBAR module to connect GPIO_AD_B0_02 pin as the capture input pin.

  OK, actually, you can use XBARA1 module.

input: IOMUX_XBAR_INOUT16 XBAR1_IN16

ouput: XBAR1_OUT99 QTIMER4_TIMER1

Please check these information:

pastedImage_1.png

pastedImage_2.png

XBAR1_IN16 is the GPIO_AD_B0_02, alt1.

But this signal share the same IO as XBARA_OUT, you need to configure teh IOMUXC_GRP_GRP6 to set the input.

I have checked it, the default mode is the input mode, so you can use it directly.

Now, you need to add these codes:

1. Pinmux.c, add these code

  IOMUXC_SetPinMux(
      IOMUXC_GPIO_AD_B0_02_XBAR1_INOUT16,    /* GPIO_AD_B1_01 is configured as QTIMER3_TIMER1 */
      0U);                                    /* Software Input On Field: Input Path is determined by functionality */

  IOMUXC_SetPinConfig(
      IOMUXC_GPIO_AD_B0_02_XBAR1_INOUT16,        /* GPIO_AD_B0_12 PAD functional properties : */
      0x10B0u);                               /* Slew Rate Field: Slow Slew Rate

 

2. main code add the xbra function

    XBARA_Init(XBARA1);
    XBARA_SetSignalsConnection(XBARA1, kXBARA1_InputIomuxXbarInout16, kXBARA1_OutputQtimer4Tmr1Input);

 

3. Add your QTIMER4 timer1 capture function.

 

Please test it on your side.

If you still have questions about it, please kindly let me know.


Have a great day,
Kerry

 

-------------------------------------------------------------------------------
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