<?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 LPC55 Problem to sync ADC with SCT in LPC Microcontrollers</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC55-Problem-to-sync-ADC-with-SCT/m-p/1532349#M50324</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have a custom board with a LPC5516JBD100. I am using MCUXpresso v11.5.1 with SDK v2.11.0.&lt;/P&gt;&lt;P&gt;My board control a DC motor and need to measure the current on the motor, so I want to synchronize ADC with SCT. The motor is turning one side with SCT0_4 (PIO0_23) and on the other side with SCT0_5 (PIO0_26).&lt;/P&gt;&lt;P&gt;The synchronisation is working with SCT0_4 but not for SCT0_5. Here is my code:&lt;/P&gt;&lt;P&gt;int Init_FTM0(void)&lt;BR /&gt;{&lt;BR /&gt;sctimer_config_t sctimerInfo;&lt;BR /&gt;sctimer_pwm_signal_param_t pwmParam;&lt;BR /&gt;uint32_t sctimerClock = SCTIMER_CLK_FREQ;&lt;/P&gt;&lt;P&gt;SCTIMER_GetDefaultConfig(&amp;amp;sctimerInfo);&lt;BR /&gt;sctimerInfo.enableCounterUnify = true;&lt;BR /&gt;sctimerInfo.clockMode = kSCTIMER_Input_ClockMode;&lt;BR /&gt;sctimerInfo.clockSelect = kSCTIMER_Clock_On_Rise_Input_7;&lt;/P&gt;&lt;P&gt;// Initialize SCTimer module&lt;BR /&gt;SCTIMER_Init(SCT0, &amp;amp;sctimerInfo);&lt;/P&gt;&lt;P&gt;// Configure PWM params with frequency 20kHZ from output&lt;BR /&gt;pwmParam.output = SCTIMER_MOT1; // SCT0_4&lt;BR /&gt;pwmParam.level = kSCTIMER_HighTrue;&lt;BR /&gt;pwmParam.dutyCyclePercent = 0;&lt;BR /&gt;if (SCTIMER_SetupPwm(SCT0, &amp;amp;pwmParam, kSCTIMER_EdgeAlignedPwm, PWM_FREQ, sctimerClock, &amp;amp;eventOutputMot1) == kStatus_Fail)&lt;BR /&gt;{&lt;BR /&gt;return -1;&lt;BR /&gt;}&lt;BR /&gt;if ( pwmParam.dutyCyclePercent == 0 )&lt;BR /&gt;SCT0-&amp;gt;OUT[SCTIMER_MOT1].SET = 0;&lt;/P&gt;&lt;P&gt;pwmParam.output = SCTIMER_MOT2; // SCT0_5&lt;BR /&gt;pwmParam.level = kSCTIMER_HighTrue;&lt;BR /&gt;pwmParam.dutyCyclePercent = 20;&lt;BR /&gt;if (SCTIMER_SetupPwm(SCT0, &amp;amp;pwmParam, kSCTIMER_EdgeAlignedPwm, PWM_FREQ, sctimerClock, &amp;amp;eventOutputMot2) == kStatus_Fail)&lt;BR /&gt;{&lt;BR /&gt;return -1;&lt;BR /&gt;}&lt;BR /&gt;if ( pwmParam.dutyCyclePercent == 0 )&lt;BR /&gt;SCT0-&amp;gt;OUT[SCTIMER_MOT2].SET = 0;&lt;/P&gt;&lt;P&gt;pwmParam.output = SCTIMER_LED; // SCT0_1&lt;BR /&gt;pwmParam.level = kSCTIMER_HighTrue;&lt;BR /&gt;pwmParam.dutyCyclePercent = 0;&lt;BR /&gt;if (SCTIMER_SetupPwm(SCT0, &amp;amp;pwmParam, kSCTIMER_EdgeAlignedPwm, PWM_FREQ, sctimerClock, &amp;amp;eventOutputLED) == kStatus_Fail)&lt;BR /&gt;{&lt;BR /&gt;return -1;&lt;BR /&gt;}&lt;BR /&gt;if ( pwmParam.dutyCyclePercent == 0 )&lt;BR /&gt;SCT0-&amp;gt;OUT[SCTIMER_LED].SET = 0;&lt;/P&gt;&lt;P&gt;SCT0-&amp;gt;EVEN = 0xFFFF; // Enable all event&lt;/P&gt;&lt;P&gt;// Start the 32-bit unify timer&lt;BR /&gt;SCTIMER_StartTimer(SCT0, kSCTIMER_Counter_U);&lt;/P&gt;&lt;P&gt;return 0;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;void adc_init(void)&lt;BR /&gt;{&lt;BR /&gt;lpadc_config_t mLpadcConfigStruct;&lt;BR /&gt;lpadc_conv_trigger_config_t mLpadcTriggerConfigStruct;&lt;BR /&gt;lpadc_conv_command_config_t mLpadcCommandConfigStruct;&lt;/P&gt;&lt;P&gt;// Disable LDOGPADC power down&lt;BR /&gt;POWER_DisablePD(kPDRUNCFG_PD_LDOGPADC);&lt;/P&gt;&lt;P&gt;ANACTRL_Init(ANACTRL);&lt;BR /&gt;ANACTRL_EnableVref1V(ANACTRL, true);&lt;/P&gt;&lt;P&gt;LPADC_GetDefaultConfig(&amp;amp;mLpadcConfigStruct);&lt;BR /&gt;mLpadcConfigStruct.enableAnalogPreliminary = true;&lt;BR /&gt;mLpadcConfigStruct.referenceVoltageSource = kLPADC_ReferenceVoltageAlt3; // VREFP&lt;BR /&gt;mLpadcConfigStruct.conversionAverageMode = kLPADC_ConversionAverage32;&lt;/P&gt;&lt;P&gt;LPADC_Init(LPADC_BASE, &amp;amp;mLpadcConfigStruct);&lt;/P&gt;&lt;P&gt;// Request offset calibration&lt;BR /&gt;LPADC_DoOffsetCalibration(LPADC_BASE);&lt;BR /&gt;// Request gain calibration&lt;BR /&gt;LPADC_DoAutoCalibration(LPADC_BASE);&lt;/P&gt;&lt;P&gt;// Set conversion CMD configuration for Imot Sens1 and Sens2&lt;BR /&gt;LPADC_GetDefaultConvCommandConfig(&amp;amp;mLpadcCommandConfigStruct);&lt;BR /&gt;mLpadcCommandConfigStruct.channelNumber = LPADC_IMOT_CHANNEL; // 0U = 8U - 8 (channel B)&lt;BR /&gt;mLpadcCommandConfigStruct.sampleChannelMode = kLPADC_SampleChannelSingleEndSideB;&lt;BR /&gt;#if defined(LPADC_USE_HIGH_RESOLUTION) &amp;amp;&amp;amp; LPADC_USE_HIGH_RESOLUTION&lt;BR /&gt;mLpadcCommandConfigStruct.conversionResolutionMode = kLPADC_ConversionResolutionHigh;&lt;BR /&gt;#endif /* DEMO_LPADC_USE_HIGH_RESOLUTION */&lt;BR /&gt;//mLpadcCommandConfigStruct.hardwareAverageMode = kLPADC_HardwareAverageCount32;&lt;BR /&gt;#if defined(FSL_FEATURE_LPADC_HAS_CMDH_WAIT_TRIG) &amp;amp;&amp;amp; FSL_FEATURE_LPADC_HAS_CMDH_WAIT_TRIG&lt;BR /&gt;mLpadcCommandConfigStruct.enableWaitTrigger = true;&lt;BR /&gt;#endif /* FSL_FEATURE_LPADC_HAS_CMDH_WAIT_TRIG */&lt;BR /&gt;LPADC_SetConvCommandConfig(LPADC_BASE, TRIGGER_I_MOT_S1, &amp;amp;mLpadcCommandConfigStruct);&lt;BR /&gt;LPADC_SetConvCommandConfig(LPADC_BASE, TRIGGER_I_MOT_S2, &amp;amp;mLpadcCommandConfigStruct);&lt;BR /&gt;// Set trigger configuration for Imot Sens1&lt;BR /&gt;LPADC_GetDefaultConvTriggerConfig(&amp;amp;mLpadcTriggerConfigStruct);&lt;BR /&gt;mLpadcTriggerConfigStruct.targetCommandId = TRIGGER_I_MOT_S1;&lt;BR /&gt;mLpadcTriggerConfigStruct.delayPower = 2U;&lt;BR /&gt;mLpadcTriggerConfigStruct.enableHardwareTrigger = true;&lt;BR /&gt;mLpadcTriggerConfigStruct.priority = 1; // lower priority&lt;BR /&gt;LPADC_SetConvTriggerConfig(LPADC_BASE, 2U, &amp;amp;mLpadcTriggerConfigStruct); // SCT0-4 = 2U&lt;BR /&gt;// Set trigger configuration for Imot Sens2&lt;BR /&gt;mLpadcTriggerConfigStruct.targetCommandId = TRIGGER_I_MOT_S2;&lt;BR /&gt;LPADC_SetConvTriggerConfig(LPADC_BASE, 3U, &amp;amp;mLpadcTriggerConfigStruct); // SCT0-5 = 3U&lt;/P&gt;&lt;P&gt;// Set conversion CMD configuration for FORCE&lt;BR /&gt;mLpadcCommandConfigStruct.channelNumber = LPADC_FORCE_CHANNEL;&lt;BR /&gt;mLpadcCommandConfigStruct.sampleChannelMode = kLPADC_SampleChannelSingleEndSideB;&lt;BR /&gt;#if defined(FSL_FEATURE_LPADC_HAS_CMDH_WAIT_TRIG) &amp;amp;&amp;amp; FSL_FEATURE_LPADC_HAS_CMDH_WAIT_TRIG&lt;BR /&gt;mLpadcCommandConfigStruct.enableWaitTrigger = false;&lt;BR /&gt;#endif /* FSL_FEATURE_LPADC_HAS_CMDH_WAIT_TRIG */&lt;BR /&gt;LPADC_SetConvCommandConfig(LPADC_BASE, TRIGGER_FORCE, &amp;amp;mLpadcCommandConfigStruct);&lt;BR /&gt;// Set trigger configuration for Force&lt;BR /&gt;mLpadcTriggerConfigStruct.targetCommandId = TRIGGER_FORCE;&lt;BR /&gt;mLpadcTriggerConfigStruct.delayPower = 0U;&lt;BR /&gt;mLpadcTriggerConfigStruct.enableHardwareTrigger = false;&lt;BR /&gt;mLpadcTriggerConfigStruct.priority = 0;&lt;BR /&gt;LPADC_SetConvTriggerConfig(LPADC_BASE, TRIGGER_FORCE, &amp;amp;mLpadcTriggerConfigStruct);&lt;/P&gt;&lt;P&gt;// Set conversion CMD configuration for 24V&lt;BR /&gt;mLpadcCommandConfigStruct.channelNumber = LPADC_24V_CHANNEL;&lt;BR /&gt;mLpadcCommandConfigStruct.sampleChannelMode = kLPADC_SampleChannelSingleEndSideA;&lt;BR /&gt;LPADC_SetConvCommandConfig(LPADC_BASE, TRIGGER_24V, &amp;amp;mLpadcCommandConfigStruct);&lt;BR /&gt;// Set trigger configuration for 24V&lt;BR /&gt;mLpadcTriggerConfigStruct.targetCommandId = TRIGGER_24V;&lt;BR /&gt;LPADC_SetConvTriggerConfig(LPADC_BASE, TRIGGER_24V, &amp;amp;mLpadcTriggerConfigStruct);&lt;/P&gt;&lt;P&gt;// Set conversion CMD configuration for ANA IN&lt;BR /&gt;mLpadcCommandConfigStruct.channelNumber = LPADC_ANAIN_CHANNEL;&lt;BR /&gt;mLpadcCommandConfigStruct.sampleChannelMode = kLPADC_SampleChannelSingleEndSideB;&lt;BR /&gt;LPADC_SetConvCommandConfig(LPADC_BASE, TRIGGER_E_ANA_IN, &amp;amp;mLpadcCommandConfigStruct);&lt;BR /&gt;// Set trigger configuration for 24V&lt;BR /&gt;mLpadcTriggerConfigStruct.targetCommandId = TRIGGER_E_ANA_IN;&lt;BR /&gt;LPADC_SetConvTriggerConfig(LPADC_BASE, TRIGGER_E_ANA_IN, &amp;amp;mLpadcTriggerConfigStruct);&lt;/P&gt;&lt;P&gt;// Enable the watermark interrupt&lt;BR /&gt;LPADC_EnableInterrupts(LPADC_BASE, kLPADC_FIFO0WatermarkInterruptEnable);&lt;BR /&gt;EnableIRQ(LPADC_IRQn);&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;And I am reading the value:&lt;/P&gt;&lt;P&gt;if ( PWM_TRACTION != 0 )&lt;BR /&gt;{&lt;BR /&gt;//LPADC_DoSoftwareTrigger(LPADC_BASE, 1U &amp;lt;&amp;lt; TRIGGER_I_MOT_S1);&lt;BR /&gt;while (!g_LpadcConversionCompletedFlag)&lt;BR /&gt;{&lt;BR /&gt;}&lt;BR /&gt;IMot_A = (float)((g_LpadcResultConfigStruct.convValue) &amp;gt;&amp;gt; g_LpadcResultShift) * GAIN_I_MOT_A_PTS;&lt;BR /&gt;g_LpadcConversionCompletedFlag = false;&lt;BR /&gt;}&lt;BR /&gt;else if ( PWM_RETURN != 0 )&lt;BR /&gt;{&lt;BR /&gt;//LPADC_DoSoftwareTrigger(LPADC_BASE, 1U &amp;lt;&amp;lt; TRIGGER_I_MOT_S2);&lt;BR /&gt;while (!g_LpadcConversionCompletedFlag )&lt;BR /&gt;{&lt;BR /&gt;}&lt;BR /&gt;IMot_A = (float)((g_LpadcResultConfigStruct.convValue) &amp;gt;&amp;gt; g_LpadcResultShift) * GAIN_I_MOT_A_PTS;&lt;BR /&gt;g_LpadcConversionCompletedFlag = false;&lt;BR /&gt;}&lt;BR /&gt;else&lt;BR /&gt;IMot_A = 0;&lt;/P&gt;&lt;P&gt;Can you help please, I have done several test but I don't succeed to synchronise with SCT0_5.&lt;/P&gt;&lt;P&gt;Cheers.&lt;/P&gt;&lt;P&gt;Cédric&lt;/P&gt;</description>
    <pubDate>Tue, 04 Oct 2022 21:48:35 GMT</pubDate>
    <dc:creator>Secad</dc:creator>
    <dc:date>2022-10-04T21:48:35Z</dc:date>
    <item>
      <title>LPC55 Problem to sync ADC with SCT</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC55-Problem-to-sync-ADC-with-SCT/m-p/1532349#M50324</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have a custom board with a LPC5516JBD100. I am using MCUXpresso v11.5.1 with SDK v2.11.0.&lt;/P&gt;&lt;P&gt;My board control a DC motor and need to measure the current on the motor, so I want to synchronize ADC with SCT. The motor is turning one side with SCT0_4 (PIO0_23) and on the other side with SCT0_5 (PIO0_26).&lt;/P&gt;&lt;P&gt;The synchronisation is working with SCT0_4 but not for SCT0_5. Here is my code:&lt;/P&gt;&lt;P&gt;int Init_FTM0(void)&lt;BR /&gt;{&lt;BR /&gt;sctimer_config_t sctimerInfo;&lt;BR /&gt;sctimer_pwm_signal_param_t pwmParam;&lt;BR /&gt;uint32_t sctimerClock = SCTIMER_CLK_FREQ;&lt;/P&gt;&lt;P&gt;SCTIMER_GetDefaultConfig(&amp;amp;sctimerInfo);&lt;BR /&gt;sctimerInfo.enableCounterUnify = true;&lt;BR /&gt;sctimerInfo.clockMode = kSCTIMER_Input_ClockMode;&lt;BR /&gt;sctimerInfo.clockSelect = kSCTIMER_Clock_On_Rise_Input_7;&lt;/P&gt;&lt;P&gt;// Initialize SCTimer module&lt;BR /&gt;SCTIMER_Init(SCT0, &amp;amp;sctimerInfo);&lt;/P&gt;&lt;P&gt;// Configure PWM params with frequency 20kHZ from output&lt;BR /&gt;pwmParam.output = SCTIMER_MOT1; // SCT0_4&lt;BR /&gt;pwmParam.level = kSCTIMER_HighTrue;&lt;BR /&gt;pwmParam.dutyCyclePercent = 0;&lt;BR /&gt;if (SCTIMER_SetupPwm(SCT0, &amp;amp;pwmParam, kSCTIMER_EdgeAlignedPwm, PWM_FREQ, sctimerClock, &amp;amp;eventOutputMot1) == kStatus_Fail)&lt;BR /&gt;{&lt;BR /&gt;return -1;&lt;BR /&gt;}&lt;BR /&gt;if ( pwmParam.dutyCyclePercent == 0 )&lt;BR /&gt;SCT0-&amp;gt;OUT[SCTIMER_MOT1].SET = 0;&lt;/P&gt;&lt;P&gt;pwmParam.output = SCTIMER_MOT2; // SCT0_5&lt;BR /&gt;pwmParam.level = kSCTIMER_HighTrue;&lt;BR /&gt;pwmParam.dutyCyclePercent = 20;&lt;BR /&gt;if (SCTIMER_SetupPwm(SCT0, &amp;amp;pwmParam, kSCTIMER_EdgeAlignedPwm, PWM_FREQ, sctimerClock, &amp;amp;eventOutputMot2) == kStatus_Fail)&lt;BR /&gt;{&lt;BR /&gt;return -1;&lt;BR /&gt;}&lt;BR /&gt;if ( pwmParam.dutyCyclePercent == 0 )&lt;BR /&gt;SCT0-&amp;gt;OUT[SCTIMER_MOT2].SET = 0;&lt;/P&gt;&lt;P&gt;pwmParam.output = SCTIMER_LED; // SCT0_1&lt;BR /&gt;pwmParam.level = kSCTIMER_HighTrue;&lt;BR /&gt;pwmParam.dutyCyclePercent = 0;&lt;BR /&gt;if (SCTIMER_SetupPwm(SCT0, &amp;amp;pwmParam, kSCTIMER_EdgeAlignedPwm, PWM_FREQ, sctimerClock, &amp;amp;eventOutputLED) == kStatus_Fail)&lt;BR /&gt;{&lt;BR /&gt;return -1;&lt;BR /&gt;}&lt;BR /&gt;if ( pwmParam.dutyCyclePercent == 0 )&lt;BR /&gt;SCT0-&amp;gt;OUT[SCTIMER_LED].SET = 0;&lt;/P&gt;&lt;P&gt;SCT0-&amp;gt;EVEN = 0xFFFF; // Enable all event&lt;/P&gt;&lt;P&gt;// Start the 32-bit unify timer&lt;BR /&gt;SCTIMER_StartTimer(SCT0, kSCTIMER_Counter_U);&lt;/P&gt;&lt;P&gt;return 0;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;void adc_init(void)&lt;BR /&gt;{&lt;BR /&gt;lpadc_config_t mLpadcConfigStruct;&lt;BR /&gt;lpadc_conv_trigger_config_t mLpadcTriggerConfigStruct;&lt;BR /&gt;lpadc_conv_command_config_t mLpadcCommandConfigStruct;&lt;/P&gt;&lt;P&gt;// Disable LDOGPADC power down&lt;BR /&gt;POWER_DisablePD(kPDRUNCFG_PD_LDOGPADC);&lt;/P&gt;&lt;P&gt;ANACTRL_Init(ANACTRL);&lt;BR /&gt;ANACTRL_EnableVref1V(ANACTRL, true);&lt;/P&gt;&lt;P&gt;LPADC_GetDefaultConfig(&amp;amp;mLpadcConfigStruct);&lt;BR /&gt;mLpadcConfigStruct.enableAnalogPreliminary = true;&lt;BR /&gt;mLpadcConfigStruct.referenceVoltageSource = kLPADC_ReferenceVoltageAlt3; // VREFP&lt;BR /&gt;mLpadcConfigStruct.conversionAverageMode = kLPADC_ConversionAverage32;&lt;/P&gt;&lt;P&gt;LPADC_Init(LPADC_BASE, &amp;amp;mLpadcConfigStruct);&lt;/P&gt;&lt;P&gt;// Request offset calibration&lt;BR /&gt;LPADC_DoOffsetCalibration(LPADC_BASE);&lt;BR /&gt;// Request gain calibration&lt;BR /&gt;LPADC_DoAutoCalibration(LPADC_BASE);&lt;/P&gt;&lt;P&gt;// Set conversion CMD configuration for Imot Sens1 and Sens2&lt;BR /&gt;LPADC_GetDefaultConvCommandConfig(&amp;amp;mLpadcCommandConfigStruct);&lt;BR /&gt;mLpadcCommandConfigStruct.channelNumber = LPADC_IMOT_CHANNEL; // 0U = 8U - 8 (channel B)&lt;BR /&gt;mLpadcCommandConfigStruct.sampleChannelMode = kLPADC_SampleChannelSingleEndSideB;&lt;BR /&gt;#if defined(LPADC_USE_HIGH_RESOLUTION) &amp;amp;&amp;amp; LPADC_USE_HIGH_RESOLUTION&lt;BR /&gt;mLpadcCommandConfigStruct.conversionResolutionMode = kLPADC_ConversionResolutionHigh;&lt;BR /&gt;#endif /* DEMO_LPADC_USE_HIGH_RESOLUTION */&lt;BR /&gt;//mLpadcCommandConfigStruct.hardwareAverageMode = kLPADC_HardwareAverageCount32;&lt;BR /&gt;#if defined(FSL_FEATURE_LPADC_HAS_CMDH_WAIT_TRIG) &amp;amp;&amp;amp; FSL_FEATURE_LPADC_HAS_CMDH_WAIT_TRIG&lt;BR /&gt;mLpadcCommandConfigStruct.enableWaitTrigger = true;&lt;BR /&gt;#endif /* FSL_FEATURE_LPADC_HAS_CMDH_WAIT_TRIG */&lt;BR /&gt;LPADC_SetConvCommandConfig(LPADC_BASE, TRIGGER_I_MOT_S1, &amp;amp;mLpadcCommandConfigStruct);&lt;BR /&gt;LPADC_SetConvCommandConfig(LPADC_BASE, TRIGGER_I_MOT_S2, &amp;amp;mLpadcCommandConfigStruct);&lt;BR /&gt;// Set trigger configuration for Imot Sens1&lt;BR /&gt;LPADC_GetDefaultConvTriggerConfig(&amp;amp;mLpadcTriggerConfigStruct);&lt;BR /&gt;mLpadcTriggerConfigStruct.targetCommandId = TRIGGER_I_MOT_S1;&lt;BR /&gt;mLpadcTriggerConfigStruct.delayPower = 2U;&lt;BR /&gt;mLpadcTriggerConfigStruct.enableHardwareTrigger = true;&lt;BR /&gt;mLpadcTriggerConfigStruct.priority = 1; // lower priority&lt;BR /&gt;LPADC_SetConvTriggerConfig(LPADC_BASE, 2U, &amp;amp;mLpadcTriggerConfigStruct); // SCT0-4 = 2U&lt;BR /&gt;// Set trigger configuration for Imot Sens2&lt;BR /&gt;mLpadcTriggerConfigStruct.targetCommandId = TRIGGER_I_MOT_S2;&lt;BR /&gt;LPADC_SetConvTriggerConfig(LPADC_BASE, 3U, &amp;amp;mLpadcTriggerConfigStruct); // SCT0-5 = 3U&lt;/P&gt;&lt;P&gt;// Set conversion CMD configuration for FORCE&lt;BR /&gt;mLpadcCommandConfigStruct.channelNumber = LPADC_FORCE_CHANNEL;&lt;BR /&gt;mLpadcCommandConfigStruct.sampleChannelMode = kLPADC_SampleChannelSingleEndSideB;&lt;BR /&gt;#if defined(FSL_FEATURE_LPADC_HAS_CMDH_WAIT_TRIG) &amp;amp;&amp;amp; FSL_FEATURE_LPADC_HAS_CMDH_WAIT_TRIG&lt;BR /&gt;mLpadcCommandConfigStruct.enableWaitTrigger = false;&lt;BR /&gt;#endif /* FSL_FEATURE_LPADC_HAS_CMDH_WAIT_TRIG */&lt;BR /&gt;LPADC_SetConvCommandConfig(LPADC_BASE, TRIGGER_FORCE, &amp;amp;mLpadcCommandConfigStruct);&lt;BR /&gt;// Set trigger configuration for Force&lt;BR /&gt;mLpadcTriggerConfigStruct.targetCommandId = TRIGGER_FORCE;&lt;BR /&gt;mLpadcTriggerConfigStruct.delayPower = 0U;&lt;BR /&gt;mLpadcTriggerConfigStruct.enableHardwareTrigger = false;&lt;BR /&gt;mLpadcTriggerConfigStruct.priority = 0;&lt;BR /&gt;LPADC_SetConvTriggerConfig(LPADC_BASE, TRIGGER_FORCE, &amp;amp;mLpadcTriggerConfigStruct);&lt;/P&gt;&lt;P&gt;// Set conversion CMD configuration for 24V&lt;BR /&gt;mLpadcCommandConfigStruct.channelNumber = LPADC_24V_CHANNEL;&lt;BR /&gt;mLpadcCommandConfigStruct.sampleChannelMode = kLPADC_SampleChannelSingleEndSideA;&lt;BR /&gt;LPADC_SetConvCommandConfig(LPADC_BASE, TRIGGER_24V, &amp;amp;mLpadcCommandConfigStruct);&lt;BR /&gt;// Set trigger configuration for 24V&lt;BR /&gt;mLpadcTriggerConfigStruct.targetCommandId = TRIGGER_24V;&lt;BR /&gt;LPADC_SetConvTriggerConfig(LPADC_BASE, TRIGGER_24V, &amp;amp;mLpadcTriggerConfigStruct);&lt;/P&gt;&lt;P&gt;// Set conversion CMD configuration for ANA IN&lt;BR /&gt;mLpadcCommandConfigStruct.channelNumber = LPADC_ANAIN_CHANNEL;&lt;BR /&gt;mLpadcCommandConfigStruct.sampleChannelMode = kLPADC_SampleChannelSingleEndSideB;&lt;BR /&gt;LPADC_SetConvCommandConfig(LPADC_BASE, TRIGGER_E_ANA_IN, &amp;amp;mLpadcCommandConfigStruct);&lt;BR /&gt;// Set trigger configuration for 24V&lt;BR /&gt;mLpadcTriggerConfigStruct.targetCommandId = TRIGGER_E_ANA_IN;&lt;BR /&gt;LPADC_SetConvTriggerConfig(LPADC_BASE, TRIGGER_E_ANA_IN, &amp;amp;mLpadcTriggerConfigStruct);&lt;/P&gt;&lt;P&gt;// Enable the watermark interrupt&lt;BR /&gt;LPADC_EnableInterrupts(LPADC_BASE, kLPADC_FIFO0WatermarkInterruptEnable);&lt;BR /&gt;EnableIRQ(LPADC_IRQn);&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;And I am reading the value:&lt;/P&gt;&lt;P&gt;if ( PWM_TRACTION != 0 )&lt;BR /&gt;{&lt;BR /&gt;//LPADC_DoSoftwareTrigger(LPADC_BASE, 1U &amp;lt;&amp;lt; TRIGGER_I_MOT_S1);&lt;BR /&gt;while (!g_LpadcConversionCompletedFlag)&lt;BR /&gt;{&lt;BR /&gt;}&lt;BR /&gt;IMot_A = (float)((g_LpadcResultConfigStruct.convValue) &amp;gt;&amp;gt; g_LpadcResultShift) * GAIN_I_MOT_A_PTS;&lt;BR /&gt;g_LpadcConversionCompletedFlag = false;&lt;BR /&gt;}&lt;BR /&gt;else if ( PWM_RETURN != 0 )&lt;BR /&gt;{&lt;BR /&gt;//LPADC_DoSoftwareTrigger(LPADC_BASE, 1U &amp;lt;&amp;lt; TRIGGER_I_MOT_S2);&lt;BR /&gt;while (!g_LpadcConversionCompletedFlag )&lt;BR /&gt;{&lt;BR /&gt;}&lt;BR /&gt;IMot_A = (float)((g_LpadcResultConfigStruct.convValue) &amp;gt;&amp;gt; g_LpadcResultShift) * GAIN_I_MOT_A_PTS;&lt;BR /&gt;g_LpadcConversionCompletedFlag = false;&lt;BR /&gt;}&lt;BR /&gt;else&lt;BR /&gt;IMot_A = 0;&lt;/P&gt;&lt;P&gt;Can you help please, I have done several test but I don't succeed to synchronise with SCT0_5.&lt;/P&gt;&lt;P&gt;Cheers.&lt;/P&gt;&lt;P&gt;Cédric&lt;/P&gt;</description>
      <pubDate>Tue, 04 Oct 2022 21:48:35 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC55-Problem-to-sync-ADC-with-SCT/m-p/1532349#M50324</guid>
      <dc:creator>Secad</dc:creator>
      <dc:date>2022-10-04T21:48:35Z</dc:date>
    </item>
    <item>
      <title>Re: LPC55 Problem to sync ADC with SCT</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC55-Problem-to-sync-ADC-with-SCT/m-p/1534053#M50349</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/201329"&gt;@Secad&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;Thank you so much for your interest in our products and for using our community.&lt;/P&gt;
&lt;P&gt;I am sorry to inform you that so far we do not have that specific example code with SCTimer and ADC are synchronization.&lt;/P&gt;
&lt;P&gt;However you can use the SDK example &lt;EM&gt;lpcxpresso55s69_mc_pmsm_core0&lt;/EM&gt; version v2.12.0 for reference. In that example, the SCTimer and ADC are synchronized via a trigger from SCTimer sct0_output[9]. For more details you can consult the user guide &lt;A href="https://www.nxp.com/docs/en/user-guide/PMSMLPC55S69EVK.pdf" target="_blank" rel="noopener"&gt;MCUXpresso SDK 3-Phase PMSM Control (LPC) (rev0)&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;Hope it helps you.&lt;/P&gt;
&lt;P&gt;Have a nice day!&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Leonardo&lt;/P&gt;</description>
      <pubDate>Fri, 07 Oct 2022 18:23:36 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC55-Problem-to-sync-ADC-with-SCT/m-p/1534053#M50349</guid>
      <dc:creator>_Leo_</dc:creator>
      <dc:date>2022-10-07T18:23:36Z</dc:date>
    </item>
    <item>
      <title>Re: LPC55 Problem to sync ADC with SCT</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC55-Problem-to-sync-ADC-with-SCT/m-p/1692037#M53568</link>
      <description>&lt;P&gt;Hey there, I'm currently facing a similar issue and was wondering if you were able to find a solution for it. It's quite challenging, and the absence of examples is not making it any easier. Your insights would be greatly appreciated! Thanks in advance!&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jul 2023 08:09:10 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC55-Problem-to-sync-ADC-with-SCT/m-p/1692037#M53568</guid>
      <dc:creator>lukas01</dc:creator>
      <dc:date>2023-07-25T08:09:10Z</dc:date>
    </item>
    <item>
      <title>Re: LPC55 Problem to sync ADC with SCT</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC55-Problem-to-sync-ADC-with-SCT/m-p/1692132#M53576</link>
      <description>&lt;P&gt;Hi Lukas01,&lt;/P&gt;&lt;P&gt;I don't succeed to solve this problem. I succeed to synchronise one ADC input with one SCT (example code in the question for NXP) but I don't succeed to synchronise one ADC input with 2 SCT.&lt;/P&gt;&lt;P&gt;Finally, I haven't used the SCT synchronisation but the accuracy on the current measurement is less good. As I haven't any other pin available on the microcontroler, so I have modified my current filtering function to have a mean value and I compute the peak current value with the ADC value and the PWM value.&lt;/P&gt;&lt;P&gt;If you have ADC input available pin, you can try to connect your current measurement to 2 different ADC input and synchronise one ADC input to the first PWM and the other ADC to the second PWM.&lt;/P&gt;&lt;P&gt;Cheers.&lt;/P&gt;&lt;P&gt;Cédric&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jul 2023 09:13:51 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC55-Problem-to-sync-ADC-with-SCT/m-p/1692132#M53576</guid>
      <dc:creator>Secad</dc:creator>
      <dc:date>2023-07-25T09:13:51Z</dc:date>
    </item>
  </channel>
</rss>

