SUPPORT ON MPC561

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

SUPPORT ON MPC561

699 Views
maheshvastrad
Contributor II

Hi ,

 

Need support on below topic

We are using MPC 561 MCU as part of our control systems. we would like to know the below information

 

  1. 1. What is the maximum % CPU utilization the controller can safely operate
    1. a. Soft limit
    2. b. Hard limit
  2. 2. What are the limits of Stack and Static for safe computation .
Labels (1)
Tags (1)
2 Replies

594 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi,

these are generic questions which are not related to this specific device. Everything is a matter of your software and your application. If we are talking about stack size, I like this high-water mark method: Reset the microcontroller by debugger and go to main function. Now fill the stack with some characters like 0xAA. You can find the stack address range in map file. Now run the code and watch the address where characters 0xAA are not overwritten by stack. Note that stack is filled from the higher addresses to lower. Make sure you exercise as many different paths through the code as possible. Based on the reported high water mark you can then adjust your stack allocation accordingly (add adequate safety margin to ensure the stack cannot overflow).

Regards,

Lukas

0 Kudos

594 Views
alexvinchev
Contributor V

maheshvastrad Some remarks from me:

- Stack measurement should be done nearly start of production, because during the development phase, many code parts are changing, which invalidates any measurement done at earlier phase of the project;

- If there is OS in use, the Idle task could be used to "watch" the stack state. Stack fill with certain value could be used to check at run-time if initially set threshold is passed (stack fill value is overwritten). 85% is a good starting point.

- There are tools which are doing static analysis of stack depth, based on the compiled code (for example if GreenHills toolchain is in use). This analysis is valid only if single stack is in use. Many RTOS use separate stack per thread, which makes stack estimation very, very hard after the design phase, so stack estimation should be taken into consideration while or before code is written.

- If system uses only one stack it is always a good advice to adjust mapping in order to use whole available free RAM as stack space;