<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: KV58 Encoder Edge Time Capture in Kinetis Microcontrollers</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/KV58-Encoder-Edge-Time-Capture/m-p/1626307#M64899</link>
    <description>&lt;P&gt;t appears that you've set up the FTM (FlexTimer Module) correctly, but you haven't mentioned how you're connecting the XBARA (Crossbar Switch) and configuring it.&lt;/P&gt;&lt;P&gt;To route the encoder signal through the XBARA and to the FTM input capture, you need to set up the XBARA as well. Here's an example of how to do that:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Enable the XBARA clock: Add the following line of code to enable the XBARA clock:&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;CLOCK_EnableClock(kCLOCK_XbarA);&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Configure the XBARA: Initialize the XBARA module with an appropriate function:&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;XBARA_Init(XBARA);&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Connect the input signal (Phase A) to an XBARA input: Use a function to connect the input signal (e.g., Phase A) to an XBARA input, such as XBARA_IN11:&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;XBARA_SetSignalsConnection(XBARA, kXBARA1_InputQdtimer1Trig01, kXBARA1_OutputXbOut11);&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Connect the XBARA output to the FTM1_CH1 input: Connect the XBARA output, such as XBARA_OUT42, to the FTM1_CH1 input:&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;XBARA_SetSignalsConnection(XBARA, kXBARA1_InputXbIn42, kXBARA1_OutputFtm1Ch1);&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Update the FTM1_init function to include the XBARA configuration:&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;static void FTM1_init(void) {&lt;/P&gt;&lt;P&gt;// Enable the XBARA clock&lt;/P&gt;&lt;P&gt;CLOCK_EnableClock(kCLOCK_XbarA);&lt;/P&gt;&lt;P&gt;// Initialize the XBARA module&lt;BR /&gt;XBARA_Init(XBARA);&lt;/P&gt;&lt;P&gt;// Connect the input signal (Phase A) to XBARA_IN11&lt;BR /&gt;XBARA_SetSignalsConnection(XBARA, kXBARA1_InputQdtimer1Trig01, kXBARA1_OutputXbOut11);&lt;/P&gt;&lt;P&gt;// Connect XBARA_OUT42 to FTM1_CH1 input&lt;BR /&gt;XBARA_SetSignalsConnection(XBARA, kXBARA1_InputXbIn42, kXBARA1_OutputFtm1Ch1);&lt;/P&gt;&lt;P&gt;// Initialize the FTM1 module with the given configuration&lt;BR /&gt;FTM_Init(FTM1_PERIPHERAL, &amp;amp;FTM1_config);&lt;/P&gt;&lt;P&gt;// Set the timer period&lt;BR /&gt;FTM_SetTimerPeriod(FTM1_PERIPHERAL, FTM1_TIMER_MODULO_VALUE);&lt;/P&gt;&lt;P&gt;// Setup the input capture&lt;BR /&gt;FTM_SetupInputCapture(FTM1_PERIPHERAL, kFTM_Chnl_1, kFTM_RiseAndFallEdge, 0);&lt;/P&gt;&lt;P&gt;// Start the timer&lt;BR /&gt;FTM_StartTimer(FTM1_PERIPHERAL, kFTM_SystemClock);&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;</description>
    <pubDate>Fri, 31 Mar 2023 22:28:06 GMT</pubDate>
    <dc:creator>giraffe508</dc:creator>
    <dc:date>2023-03-31T22:28:06Z</dc:date>
    <item>
      <title>KV58 Encoder Edge Time Capture</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/KV58-Encoder-Edge-Time-Capture/m-p/1626299#M64898</link>
      <description>&lt;P&gt;I am trying to setup the KV58 timer capture for encoder phase A.&lt;BR /&gt;I do not see any values in the CnV register.&lt;BR /&gt;I am following this post&amp;nbsp;&lt;A href="https://community.nxp.com/t5/Kinetis-Microcontrollers/KV5x-How-to-connect-the-encoder-inputs-to-a-general-purpose/m-p/564876" target="_blank" rel="noopener"&gt;https://community.nxp.com/t5/Kinetis-Microcontrollers/KV5x-How-to-connect-the-encoder-inputs-to-a-general-purpose/m-p/564876&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;I connected the XBARA11_IN to XBARA42_OUT I setup the timer with this code.&lt;BR /&gt;&lt;BR /&gt;const ftm_config_t FTM1_config = { &amp;nbsp; .prescale = kFTM_Prescale_Divide_8, &amp;nbsp; .faultMode = kFTM_Fault_Disable, &amp;nbsp; .faultFilterValue = 0, &amp;nbsp;.deadTimePrescale = kFTM_Deadtime_Prescale_1, &amp;nbsp; .deadTimeValue = 0, &amp;nbsp; .pwmSyncMode = kFTM_SoftwareTrigger, &amp;nbsp; .reloadPoints = 0, &amp;nbsp; .extTriggers = 0, &amp;nbsp; .chnlInitState = 0, &amp;nbsp; .chnlPolarity = 0, &amp;nbsp; .bdmMode = kFTM_BdmMode_3, &amp;nbsp; .useGlobalTimeBase = false };&lt;/P&gt;&lt;P&gt;static void FTM1_init(void) { &amp;nbsp; FTM_Init(FTM1_PERIPHERAL, &amp;amp;FTM1_config); &amp;nbsp; FTM_SetTimerPeriod(FTM1_PERIPHERAL, FTM1_TIMER_MODULO_VALUE); &amp;nbsp; FTM_SetupInputCapture(FTM1_PERIPHERAL, kFTM_Chnl_1, kFTM_RiseAndFallEdge, 0); &amp;nbsp; FTM_StartTimer(FTM1_PERIPHERAL, kFTM_SystemClock); }&lt;/P&gt;</description>
      <pubDate>Mon, 03 Apr 2023 16:20:08 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/KV58-Encoder-Edge-Time-Capture/m-p/1626299#M64898</guid>
      <dc:creator>nelson18</dc:creator>
      <dc:date>2023-04-03T16:20:08Z</dc:date>
    </item>
    <item>
      <title>Re: KV58 Encoder Edge Time Capture</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/KV58-Encoder-Edge-Time-Capture/m-p/1626307#M64899</link>
      <description>&lt;P&gt;t appears that you've set up the FTM (FlexTimer Module) correctly, but you haven't mentioned how you're connecting the XBARA (Crossbar Switch) and configuring it.&lt;/P&gt;&lt;P&gt;To route the encoder signal through the XBARA and to the FTM input capture, you need to set up the XBARA as well. Here's an example of how to do that:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Enable the XBARA clock: Add the following line of code to enable the XBARA clock:&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;CLOCK_EnableClock(kCLOCK_XbarA);&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Configure the XBARA: Initialize the XBARA module with an appropriate function:&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;XBARA_Init(XBARA);&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Connect the input signal (Phase A) to an XBARA input: Use a function to connect the input signal (e.g., Phase A) to an XBARA input, such as XBARA_IN11:&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;XBARA_SetSignalsConnection(XBARA, kXBARA1_InputQdtimer1Trig01, kXBARA1_OutputXbOut11);&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Connect the XBARA output to the FTM1_CH1 input: Connect the XBARA output, such as XBARA_OUT42, to the FTM1_CH1 input:&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;XBARA_SetSignalsConnection(XBARA, kXBARA1_InputXbIn42, kXBARA1_OutputFtm1Ch1);&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Update the FTM1_init function to include the XBARA configuration:&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;static void FTM1_init(void) {&lt;/P&gt;&lt;P&gt;// Enable the XBARA clock&lt;/P&gt;&lt;P&gt;CLOCK_EnableClock(kCLOCK_XbarA);&lt;/P&gt;&lt;P&gt;// Initialize the XBARA module&lt;BR /&gt;XBARA_Init(XBARA);&lt;/P&gt;&lt;P&gt;// Connect the input signal (Phase A) to XBARA_IN11&lt;BR /&gt;XBARA_SetSignalsConnection(XBARA, kXBARA1_InputQdtimer1Trig01, kXBARA1_OutputXbOut11);&lt;/P&gt;&lt;P&gt;// Connect XBARA_OUT42 to FTM1_CH1 input&lt;BR /&gt;XBARA_SetSignalsConnection(XBARA, kXBARA1_InputXbIn42, kXBARA1_OutputFtm1Ch1);&lt;/P&gt;&lt;P&gt;// Initialize the FTM1 module with the given configuration&lt;BR /&gt;FTM_Init(FTM1_PERIPHERAL, &amp;amp;FTM1_config);&lt;/P&gt;&lt;P&gt;// Set the timer period&lt;BR /&gt;FTM_SetTimerPeriod(FTM1_PERIPHERAL, FTM1_TIMER_MODULO_VALUE);&lt;/P&gt;&lt;P&gt;// Setup the input capture&lt;BR /&gt;FTM_SetupInputCapture(FTM1_PERIPHERAL, kFTM_Chnl_1, kFTM_RiseAndFallEdge, 0);&lt;/P&gt;&lt;P&gt;// Start the timer&lt;BR /&gt;FTM_StartTimer(FTM1_PERIPHERAL, kFTM_SystemClock);&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;</description>
      <pubDate>Fri, 31 Mar 2023 22:28:06 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/KV58-Encoder-Edge-Time-Capture/m-p/1626307#M64899</guid>
      <dc:creator>giraffe508</dc:creator>
      <dc:date>2023-03-31T22:28:06Z</dc:date>
    </item>
    <item>
      <title>Re: KV58 Encoder Edge Time Capture</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/KV58-Encoder-Edge-Time-Capture/m-p/1626308#M64900</link>
      <description>&lt;P&gt;Sorry, I failed to post what I had for XBARA&lt;BR /&gt;&lt;BR /&gt;This is what I had(lots setup by MCUespresso)&lt;BR /&gt;&lt;BR /&gt;The encoder is on Pin 71 which can be routed to XB_IN11&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;CLOCK_EnableClock&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;kCLOCK_XbarA&lt;/SPAN&gt;&lt;SPAN&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;BR /&gt;XBARA_Init(XBARA);&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;XBARA_SetSignalsConnection&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;XBARA&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt; &lt;SPAN&gt;kXBARA_InputXbarIn11&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt; &lt;SPAN&gt;kXBARA_OutputEncPhA&lt;/SPAN&gt;&lt;SPAN&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;XBARA_SetSignalsConnection&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;XBARA&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt; &lt;SPAN&gt;kXBARA_InputXbarIn11&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt; &lt;SPAN&gt;kXBARA_OutputHsadc1ATrig&lt;/SPAN&gt;&lt;SPAN&gt;);&amp;nbsp; &amp;lt;--- this is connected to FTM1 Ch1 signal XOR&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;Am I missing a connection somewhere? can the XBARA fanout to multiple outputs?&lt;/DIV&gt;</description>
      <pubDate>Mon, 03 Apr 2023 16:23:46 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/KV58-Encoder-Edge-Time-Capture/m-p/1626308#M64900</guid>
      <dc:creator>nelson18</dc:creator>
      <dc:date>2023-04-03T16:23:46Z</dc:date>
    </item>
    <item>
      <title>Re: KV58 Encoder Edge Time Capture</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/KV58-Encoder-Edge-Time-Capture/m-p/1627947#M64926</link>
      <description>&lt;P&gt;Hi I still have not resolved this&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;From reading your suggestions I feel I have adequately connected the XBARA_IN11 to the FTM1 Ch1 edge capture.&lt;BR /&gt;&lt;BR /&gt;Is it possible I have a conflict with some other device, I am using PIT Timers.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Is this the correct XBARA Output?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="nelson18_0-1680647050378.png" style="width: 711px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/217772i2C5342B9B42714D5/image-dimensions/711x16?v=v2" width="711" height="16" role="button" title="nelson18_0-1680647050378.png" alt="nelson18_0-1680647050378.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Is this not being setup through the fsl hal layer stuff?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="nelson18_0-1680650440244.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/217773iF27BFADE3F4CB296/image-size/medium?v=v2&amp;amp;px=400" role="button" title="nelson18_0-1680650440244.png" alt="nelson18_0-1680650440244.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Apr 2023 23:20:49 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/KV58-Encoder-Edge-Time-Capture/m-p/1627947#M64926</guid>
      <dc:creator>nelson18</dc:creator>
      <dc:date>2023-04-04T23:20:49Z</dc:date>
    </item>
  </channel>
</rss>

