How to configure adc_etc in rt1170?

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

How to configure adc_etc in rt1170?

Jump to solution
1,279 Views
JungleHuang
Contributor I

HI:NXP Technical support

I think I'm having difficulties with the configuration of ADC_ETC and would like to seek your help.I want to use ADC_ETC to measure the current of a BLDC motor.My motor driver chip is the TI DRV8316C.I configured my PWM in SignedCenterAligned mode.Referring to the example in the diagram below, I set the PWM to trigger output at the VAL0 value.

However, when I actually read the SOA current, I found that it was a fixed value. After troubleshooting, I discovered a phase difference between SOA and the PWM signal.JungleHuang_0-1730973569575.png

In fact, I did achieve the effect I wanted, as shown in the diagram below.

JungleHuang_1-1730973590457.jpeg

However, when I actually read the SOA current, I found that it was a fixed value. After troubleshooting, I discovered a phase difference between SOA and the PWM signal.

Currently, I am reading the ADC at position 1, but it should be read at position 2.

JungleHuang_2-1730973630830.jpeg

Referring to the Center Aligned PWM example diagram, I believe setting the PWM to trigger at the VAL1 value would be effective.So I modified my code.

I changed PWM_OutputTriggerEnable(PWM1, kPWM_Module_1, kPWM_ValueRegister_0, true); to PWM_OutputTriggerEnable(PWM1, kPWM_Module_1, kPWM_ValueRegister_1, true);.

But it didn't works.

I'm certain that the value of this register has been correctly modified.

JungleHuang_3-1730973703839.png

I don't know why this is happening, so I would like to seek your help. Thank you very much.

 

i.MX-RT1170 

 

 

Tags (2)
0 Kudos
Reply
1 Solution
1,205 Views
JungleHuang
Contributor I

Hi,

Thank you for your patient response.I have already resolved this issue.The key to the problem lies in the image below.

JungleHuang_0-1731049823870.png

Trigger 1 is activated when the counter matches VAL 1, VAL 3, or VAL 5 register.I should configure it to be triggered by Trigger 1.Now I can collect ADC values according to my requirements.
Thank you very much for your patient response. Have a wonderful day!

View solution in original post

0 Kudos
Reply
2 Replies
1,241 Views
_Leo_
NXP TechSupport
NXP TechSupport

Hi,

Thank you so much for your interest in our products and for using our community.

You can refer to the SDK examples evkbmimxrt1170_mc_bldc or evkbmimxrt1170_mc_pmsm_enc (v2.16.000).

Both examples perform the same eFlexPWM + ADC_ETC synchronization, almost equal to yours. The difference is that it uses a different compare value (val4) for ADC triggering.

_Leo__0-1731015334401.png

Documentation comes in the SDK examples:

_Leo__1-1731015343717.png

Hope it helps you.

Have a nice day!

0 Kudos
Reply
1,206 Views
JungleHuang
Contributor I

Hi,

Thank you for your patient response.I have already resolved this issue.The key to the problem lies in the image below.

JungleHuang_0-1731049823870.png

Trigger 1 is activated when the counter matches VAL 1, VAL 3, or VAL 5 register.I should configure it to be triggered by Trigger 1.Now I can collect ADC values according to my requirements.
Thank you very much for your patient response. Have a wonderful day!

0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-1990082%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EHow%20to%20configure%20adc_etc%20in%20rt1170%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1990082%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3E%3CSPAN%3EHI%EF%BC%9ANXP%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3ETechnical%20support%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EI%20think%20I'm%20having%20difficulties%20with%20the%20configuration%20of%20ADC_ETC%20and%20would%20like%20to%20seek%20your%20help.I%20want%20to%20use%20ADC_ETC%20to%20measure%20the%20current%20of%20a%20BLDC%20motor.My%20motor%20driver%20chip%20is%20the%20TI%20DRV8316C.I%20configured%20my%20PWM%20in%20SignedCenterAligned%20mode.Referring%20to%20the%20example%20in%20the%20diagram%20below%2C%20I%20set%20the%20PWM%20to%20trigger%20output%20at%20the%20VAL0%20value.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3EHowever%2C%20when%20I%20actually%20read%20the%20SOA%20current%2C%20I%20found%20that%20it%20was%20a%20fixed%20value.%20After%20troubleshooting%2C%20I%20discovered%20a%20phase%20difference%20between%20SOA%20and%20the%20PWM%20signal.%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22JungleHuang_0-1730973569575.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22JungleHuang_0-1730973569575.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F309206iB8C5EC14B2514ABB%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22JungleHuang_0-1730973569575.png%22%20alt%3D%22JungleHuang_0-1730973569575.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3EIn%20fact%2C%20I%20did%20achieve%20the%20effect%20I%20wanted%2C%20as%20shown%20in%20the%20diagram%20below.%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22JungleHuang_1-1730973590457.jpeg%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22JungleHuang_1-1730973590457.jpeg%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F309208i4D60F44089E421A4%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22JungleHuang_1-1730973590457.jpeg%22%20alt%3D%22JungleHuang_1-1730973590457.jpeg%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3EHowever%2C%20when%20I%20actually%20read%20the%20SOA%20current%2C%20I%20found%20that%20it%20was%20a%20fixed%20value.%20After%20troubleshooting%2C%20I%20discovered%20a%20phase%20difference%20between%20SOA%20and%20the%20PWM%20signal.%3C%2FP%3E%3CP%3ECurrently%2C%20I%20am%20reading%20the%20ADC%20at%20position%201%2C%20but%20it%20should%20be%20read%20at%20position%202.%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22JungleHuang_2-1730973630830.jpeg%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22JungleHuang_2-1730973630830.jpeg%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F309209iA222B375F5022097%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22JungleHuang_2-1730973630830.jpeg%22%20alt%3D%22JungleHuang_2-1730973630830.jpeg%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3EReferring%20to%20the%20Center%20Aligned%20PWM%20example%20diagram%2C%20I%20believe%20setting%20the%20PWM%20to%20trigger%20at%20the%20VAL1%20value%20would%20be%20effective.So%20I%20modified%20my%20code.%3C%2FP%3E%3CP%3EI%20changed%20PWM_OutputTriggerEnable(PWM1%2C%20kPWM_Module_1%2C%20kPWM_ValueRegister_0%2C%20true)%3B%20to%20PWM_OutputTriggerEnable(PWM1%2C%20kPWM_Module_1%2C%20kPWM_ValueRegister_1%2C%20true)%3B.%3C%2FP%3E%3CP%3EBut%20it%20didn't%20works.%3C%2FP%3E%3CP%3EI'm%20certain%20that%20the%20value%20of%20this%20register%20has%20been%20correctly%20modified.%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22JungleHuang_3-1730973703839.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22JungleHuang_3-1730973703839.png%22%20style%3D%22width%3A%20329px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F309210iE8F73EC4B3482CD2%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22JungleHuang_3-1730973703839.png%22%20alt%3D%22JungleHuang_3-1730973703839.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3EI%20don't%20know%20why%20this%20is%20happening%2C%20so%20I%20would%20like%20to%20seek%20your%20help.%20Thank%20you%20very%20much.%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fc-pwmxy87654%2Fi.MX-RT1170%2Fpd-p%2Fi.MX-RT1170%22%20class%3D%22lia-product-mention%22%20data-product%3D%22519-1%22%20target%3D%22_blank%22%3Ei.MX-RT1170%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1990859%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20How%20to%20configure%20adc_etc%20in%20rt1170%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1990859%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%2C%3C%2FP%3E%3CDIV%20class%3D%22%22%3E%3CDIV%20class%3D%22%22%3E%3CDIV%20class%3D%22%22%3E%3CDIV%20class%3D%22%22%3E%3CDIV%20class%3D%22%22%3E%3CDIV%20class%3D%22%22%3E%3CP%3EThank%20you%20for%20your%20patient%20response.I%20have%20already%20resolved%20this%20issue.The%20key%20to%20the%20problem%20lies%20in%20the%20image%20below.%3C%2FP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22JungleHuang_0-1731049823870.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22JungleHuang_0-1731049823870.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F309384iCE00C677236DE99C%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22JungleHuang_0-1731049823870.png%22%20alt%3D%22JungleHuang_0-1731049823870.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3CP%3ETrigger%201%20is%20activated%20when%20the%20counter%20matches%20VAL%201%2C%20VAL%203%2C%20or%20VAL%205%20register.I%20should%20configure%20it%20to%20be%20triggered%20by%20%3CSTRONG%3ETrigger%201%3C%2FSTRONG%3E.Now%20I%20can%20collect%20ADC%20values%20according%20to%20my%20requirements.%3CBR%20%2F%3EThank%20you%20very%20much%20for%20your%20patient%20response.%20Have%20a%20wonderful%20day!%3C%2FP%3E%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1990533%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20How%20to%20configure%20adc_etc%20in%20rt1170%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1990533%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%2C%3C%2FP%3E%0A%3CP%3EThank%20you%20so%20much%20for%20your%20interest%20in%20our%20products%20and%20for%20using%20our%20community.%3C%2FP%3E%0A%3CP%3EYou%20can%20refer%20to%20the%20SDK%20examples%20%3CEM%3Eevkbmimxrt1170_mc_bldc%3C%2FEM%3E%20or%20%3CEM%3Eevkbmimxrt1170_mc_pmsm_enc%3C%2FEM%3E%20(v2.16.000).%3C%2FP%3E%0A%3CP%3EBoth%20examples%20perform%20the%20same%20eFlexPWM%20%2B%20ADC_ETC%20synchronization%2C%20almost%20equal%20to%20yours.%20The%20difference%20is%20that%20it%20uses%20a%20different%20compare%20value%20(val4)%20for%20ADC%20triggering.%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22_Leo__0-1731015334401.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22_Leo__0-1731015334401.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F309289i12E935ABFB0EC466%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22_Leo__0-1731015334401.png%22%20alt%3D%22_Leo__0-1731015334401.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EDocumentation%20comes%20in%20the%20SDK%20examples%3A%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22_Leo__1-1731015343717.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22_Leo__1-1731015343717.png%22%20style%3D%22width%3A%20224px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F309290i38B83D0C97B8A75B%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22_Leo__1-1731015343717.png%22%20alt%3D%22_Leo__1-1731015343717.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EHope%20it%20helps%20you.%3C%2FP%3E%0A%3CP%3EHave%20a%20nice%20day!%3C%2FP%3E%3C%2FLINGO-BODY%3E