Hi I am using external mode to run a simulink model on TI F28335, I am trying to log some data on the scope by triggering it only for 20 ms , unfurtunatily I am not able to get more than 140 samples, when I increaee the duration for 150 for example it shows this message on command windw ''action: EXT_SELECT_SIGNALS Got EXT_SELECT_SIGNALS_RESPONSE from target with status NOT_ENOUGH_MEMORY'' , by the way the sampling frequency in this model is 50 microsecond. could any one help me to get more samples
MATLAB: EXTERNAL MODE ON TI C2000
external mode
Related Solutions
By default, the Embedded Target for Motorola MPC555 supports the Internal (On-Chip) Flash of the MPC5xx processors. In certain situations it may be required to target the External (Off-Chip) Flash memory of a development board instead of using the Internal Flash. For example, the MPC561 and MPC562 do not have any Internal Flash memory so the External Flash memory of the development board must be used instead.
Some manual configuration of the Embedded Target for Motorola MPC555 and your target hardware may be necessary before applications can be deployed in External Flash memory. For example, the Embedded Target for Motorola MPC555 is suitable for MPC561 and MPC562 (MPC56x processors with no internal flash) code generation immediately out-of-the-box, though application deployment may require some configuration changes.
One limitation of using the External Flash memory is that the Flash programming features of the Embedded Target for Motorola MPC555 will not work with the External Flash memory, only Internal Flash memory. To program External Flash memory, drivers specific to the external memory type are required. This means that an independent mechanism to install the bootcode and application code to External Flash is required - the documentation for your development board and / or toolchain should contain details of how to program External Flash memory.
For more information on targeting the External Flash memory, see the attachment at the bottom of the page.
This warning occurs because there is not enough memory on the target to properly execute the model in External mode. There are a number of factors that influence the memory usage on the Arduino Uno. Ultimately, the memory constraints of the Arduino are causing the issue with bad sensor readings.
Note that the Arduino Uno has 2KB of SRAM for data, stack, and heap combined:
External mode is using heap memory for logging signals. In the Diagnostic Viewer, we can see the amount of space that is taken for data when we generate code. For example:
AVR Memory Usage----------------------------Device: atmega328pProgram: 22464 bytes (68.6% Full)
(.text + .data + .bootloader)*Data: 1319 bytes (64.4% Full)*
(.data + .bss + .noinit)
In this example, we see that there is < 1KB of SRAM left for stack and heap combined. The following are some rough numbers for how much memory External mode requires:
- Basic External mode connection without logging requires ~150 bytes
- Logging one double signal (with Duration = 2) requires an additional ~550 bytes
- Each additional double signal logged (with Duration = 2) requires another ~50 bytes
Therefore, it is easy to run into memory limits on the Uno in External mode. The available workarounds are to change the model to use less memory, or to upgrade to a microcontroller with more memory. For example, the Arduino Due has 96KB of SRAM.
If you decide to change the model, listed below are several factors that can influence the SRAM used. Note that you can monitor the code generation output to see the amount of memory being used for data, as shown above. Some of the factors listed will affect the heap memory used too.
1) Number of signals being logged: Increasing the number of Display and Scope blocks increases the amount of memory needed by the buffer on the Arduino that stores the data collected in External mode. Having too many signal logging blocks can therefore overload the memory on the Arduino.
2) Size of the External Mode buffer: This value determines how many samples are collected in the External mode buffer before transmitting them back to Simulink. Collecting more samples at a time can affect memory usage on the Arduino. The number of samples collected can be changed with "Duration" value from the Code menu, under External Mode Control Panel > Signal & Triggering > Duration. See this page for further details:
3) Choice of solver: Continuous solvers use more memory than discrete solvers. Additionally, there are several continuous solver options, which you view under Configuration Parameters > Solver. The higher order (i.e. more precise) solvers use more memory on the Arduino.
4) Complexity of the model: Increasing the complexity of the model uses more memory on the Arduino.
In summary, there are several strategies you can use to address the External Mode memory constraints, by referring to each of the points above. The following will likely have the greatest affect:
- Reduce the number of signals being logged at once
- If possible, use a discrete instead of a continuous solver. Note that this requires discretizing the model (for example, you must use a discrete PID controller instead of a continuous one)
- If you must use a continuous solver, choose the lowest order solver that meets your requirements. Note that the higher order solvers have higher numbers (e.g. ode8 is a higher order solver than ode5).
- Reduce the complexity of the model as much as possible
By implementing these suggestions, you maybe able to reduce the memory requirements of your model to fit under the constraints of the Arduino. If this is not possible, it is recommended to upgrade to a target with more memory.
Related Question
- Is it possible to log an entire signal to a single workspace variable when running a Simulink model in external mode on a C2000 target
- How to resolve error ‘Not enough memory on the target to process the packet’ while working on TI C2000 in external mode
- Am I getting less data points than the amount mentioned in Configuration parameter when logging data using Simulink Real Time
Best Answer