AN3943 C code implementation

cancel
Showing results for 
Search instead for 
Did you mean: 

AN3943 C code implementation

277 Views
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?

Tags (1)
0 Kudos
6 Replies

84 Views
FelipeGarcia
NXP TechSupport
NXP TechSupport

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 Kudos

84 Views
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 Kudos

84 Views
FelipeGarcia
NXP TechSupport
NXP TechSupport

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 Kudos

84 Views
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 Kudos

84 Views
FelipeGarcia
NXP TechSupport
NXP TechSupport

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 Kudos

84 Views
garimella
Contributor I

Hi

Thanks

I got my queries answered.

Regards

Vishnu

0 Kudos