This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Cortex M3 or M4?

Other Parts Discussed in Thread: LM3S6965

Hello guys, 

 

That's the deal.. I am working on a project wich uses a lots of floating point cauculations, like PID controls, and etc.

As I am using the LM3S6965, I am wondering how much I could improve the performance if I start to use LM4F232?

 

  • Adriano Bittar said:
    lots of floating point cauculations, like PID controls

    PID controls don't have to be floating-point.

    Perhaps you could also look into whether & how much you could improve performance by using integer (or fixed-point) calculations...

  • Well, 

     

    The problem is that the application I am running needs the precision of a floating point,

    and the data I receive are float and the PID gains are float number.

     

  • Adriano Bittar said:

    Well, 

     

    The problem is that the application I am running needs the precision of a floating point,

    and the data I receive are float and the PID gains are float number.

     

    Floating point precision is usually not very good, but the advantage of floating point is the large dynamic range and ease of use. From wikipedia (http://en.wikipedia.org/wiki/Floating_point):

    Wikipedia said:

    when stored in the same space, floating-point numbers achieve their greater range at the expense of precision.

    Trust me, you can write your PID algorithm using integers. I have done so many times.

     

    Matt

  • Indeed!

    In an integer, all the bits contribute to the precision;

     With floating points, you sacrifice some bits to represent the exponent.

  • Ok, then.

    Thank you guys.

    But what about the other parts?

    Because I am doing a controller for a small aircraft, and the Inercial Measurement gives me the data in Float, and I have to do some calculations, 

    and send data to the ground station ( normally in float), and after the PID, I send data to the actuarors also in float. 

    And after all, I am not the best programmer as you can see. 

    Is it possible to do all in integer without loose precision?

     

  • @Adriano-

    Fellows are giving good advice - we've seen missile systems track/find/terminate their target - all using integer math.

    Small aircraft - self described, "not the best programmer," just where do "would be" air-passengers "sign-up?"

    Perhaps floating point should be more properly reserved for ejection seats/parachutes - and those ground-borne - unfortunate enough to be near inertially challenged "final" approach...

  • Indeed!!!

  • Well, floating point is fine depending on the amount of calculations you need to do and the bandwidth. I've done some simple PID loops with first-order low pass filtering using floating point at 5khz without any trouble. Of course I can bump that up much higher using integer math only.

     

    Matt

  • Post has moved far from perhaps ill-considered title. (not really surprising)  Real issue - methinks - is appropriately "matching" the project's demands to the skills/experience/resources of the potential developer.  Desire alone - is not adequate substitute for long, hard background/experience... 

    Elephant in this room - "reality" seems to have escaped clear/proper notice...  And - as o/p originally stated, "That's the deal!"  (huh?)

  • Well, 

    @cb1

    When I said small aircraft, my intent was to say model aircraft.
    The only way to learn is to do and try.

    As it is a international forum, please use standard English.

     

    Has anyone worked with Cortex M4?

  • Adriano Bittar said:
    When I said small aircraft, my intent was to say model aircraft

    Those can still be very dangerous - potentially lethal - if they get out of control!

    Adriano Bittar said:
    The only way to learn is to do and try

    No, not the only way!

    The example of flying a plane would be a case in point: you wouldn't just jump into a plane to "do and try" - would you?

    You would do some basic, ground training first to get necessary understanding before flying.

  • I did not think I should have detailed my project to get some help.

    The model aircraft here is only a equation, wich i am working on it.

    There's no real aircraft, yet. 
    I did not said that at first,  because the only question I did was about the performance using M3 or M4.

    Sorry. 

  • I'm already testing the LM4F232 and i strongly recommend that you switch to the LM4Fxxx . beyond the floating point, it has DSP instructions, better ADC, flash and power consuption.

    Fixed point math olny have more precision if you use 32 bits integer, but  32 bits integer multiply for cortex-m3 is a 7 cicles instruction. On Cortex-M4 the same instruction is executed in a single cycle.