AN3943 C code implementation

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

AN3943 C code implementation

5,565件の閲覧回数
garimella
Contributor I

My customer wants us to write direct C code to implement the ATO algorithms (without drivers provided by NXP) as described in the application note AN3943, using Kinetis-V MCUs. We have to develop code using floating point and then followed by fixed point and deliver to the customer. For the first version we were trying to understand Eq-10 and 11 (Page 6). We are not very sure where does it come from and how the term pi appears in the equation? And Secondly why was forward euler chosen over tustin's approach. Can we directly code the equation (for floating point) and get desirable results?

タグ(1)
0 件の賞賛
返信
6 返答(返信)

5,372件の閲覧回数
FelipeGarcia
NXP Employee
NXP Employee

Hello,

 

Pi on the equations 10 and 11 come from the sentence below:

 

The variables in the digital model need to be appropriately scaled to fit into the fractional range of –1 to 1

Using cos(piX) and -sin(piX) you can achieve this behavior.

Regarding your other questions, could you give me more details in how are you implementing the algorithms?

 

Regards,

Felipe

0 件の賞賛
返信

5,372件の閲覧回数
garimella
Contributor I

Hi

I have still questions regarding the coefficients K1d and K2d. Where do they come from. Why Ts and Pi get introduced into the equations.

Actually K1 and K2 should be as follows.

K1= w*w

K2= 2 * zeta/w

Secondly the article does not mention about the link between sampling rate, quantization and the tracking rate. Should we use 16 bit ADC? Can we use lower one. What is the max tracking rate?

Regarding implementation, I tried with ANSI C compiler and the equations work out well. I haven’t tried with TI MCU.

Regards

Visnhu

0 件の賞賛
返信

5,372件の閲覧回数
FelipeGarcia
NXP Employee
NXP Employee

Hi Vinshu,

 

K1d and K2d come from analyzing the block diagram in the digital domain. Eqn. 11 shows the equivalence you mention.

 

Regarding your your questions, the document implements a 16 bit ADC, please refer to chapter 5.1. Tracking rate will depend on your implementation.

 

Regards,

Felipe

0 件の賞賛
返信

5,372件の閲覧回数
garimella
Contributor I

Hi

The coefficients K1d and K2d are scaled by Ts and PI. The equation is not clear. Secondly What does it mean that tracking rate depends on “implementation”?

Regards

Vishnu

0 件の賞賛
返信

5,372件の閲覧回数
FelipeGarcia
NXP Employee
NXP Employee

Hi Vinshu,

 

Please check the attached application note where your questions are explained in detail in chapter 4.2.2.

 

Best regards,

Felipe

-------------------------------------------------------------------------------
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 件の賞賛
返信

5,372件の閲覧回数
garimella
Contributor I

Hi

Thanks

I got my queries answered.

Regards

Vishnu

0 件の賞賛
返信