Float point operations (trig too) don't work on K20D (FRDM K20D50M).

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

Float point operations (trig too) don't work on K20D (FRDM K20D50M).

519 Views
fabio_vila
Contributor I

When I have tried make an Sin Table on K20D using sin of "math.h" the execution program don't flow over it.

Ok. I decided not use the  "math.h", then I used const table of sin values. However when the program tries escale down the values of this table with float division and convert float to int again execution of program don't flow over casting int to float.

Piece of code:

    Motor.IncTabela = (float) 1000.0f / Motor.MaxSamples;     Motor.Div = (((long) MAXTABELA / Motor.VMod));          for (i=0, a=0; i < Motor.MaxSamples; i++, a += Motor.IncTabela ) {          r = SinT[(int)(a + 0.5f)];          r = r / Motor.Div;          r = Motor.DutyZero + r;          TabelaGerada[i] =  (uint16_t) r;      }

I yet tried increase stack pointer size from 1024 to 2048 but don't worked (i had some problem before on S08 PA).

Edit:

Have anybody here?

Disabling the FTM0 overflow interrupt the code runs perfectly.

0 Kudos
1 Reply

351 Views
Jorge_Gonzalez
NXP Employee
NXP Employee

Hello fabio:

We are sorry that your question did not receive an answer when posted. From your edit it seems you found a solution, but if you have doubts or need assistance please let us know.

Regards!

Jorge Gonzalez

0 Kudos