Description of Ixxat Lua ADK
For more information see the module documentation in
p.
12.
2.3
Limitations of the Ixxat Lua ADK
The Ixxat Lua ADK has hardware resource limitations because code is loaded from the Flash file
system into off-chip RAM and executed there. This RAM area is shared between Lua and other
tasks on the target. The overall size is approximately 900 KByte. Therefore, Lua can use up to
approximately 600 KByte RAM for code and data.
The total amount of memory in use by Lua (in Kbytes) can be determined and written to the
terminal window of the CAN-Gateway Configurator with the following command:
print(collectgarbage("count"))
Keep in mind:
•
Lua scripts need much more CPU time than compiled code written in C.
•
Do as less as possible computation in Lua.
•
Do the computation with the lowest possible frequency.
To reduce the effort for Lua:
•
If possible use mapping tables and other features.
•
Use the max_frequency feature for registered can messages to reduce the on_can call
frequency.
•
Use the array.repack function to reassemble CAN message payload.
The needed CPU power can be monitored via the output in the status bar of the CAN-Gateway
Configurator. The Lua function
precisely.
A typical value for the execution time of a short Lua function is 150 to 200 μs. About 5000–8000
messages can be processed per second.
2.4
Specifics in Coding for the Ixxat Lua ADK
2.4.1
Bit Model 32 Bit Version
The Ixxat Lua ADK is compiled for the 32 bit model. Therefore integer and floating points values
are stored as 32 bit values instead of 64 bit values as with a standard desktop Lua installation.
2.4.2
Errors and Debugging
The Ixxat CAN@net/CANbridge NT runs the Lua ADK over the native hardware. There is an
underlying kernel system to capture errors and to provide graceful failure modes. To avoid
affecting the standard firmware, error handling is kept simple. If an error occurs when calling a
Lua function, an error message is written to the log file and Lua is stopped. Runtime errors in Lua
functions are written to the terminal and Lua is stopped. The rest of the firmware is running
without restrictions. To reactivate the Lua script the system has to be restarted.
There is currently no target debugging support. The print statement diagnostics through the
terminal interface of the system must be used. The Ixxat Lua ADK provides a remote debugging
feature to run the Lua script on the PC while communicating with the target device via an USB
connection.
CAN@net NT/CANbridge NT User Manual
sys.get_us_time()
Lua API Function and Module Reference,
allows to measure execution times more
4.02.0332.20002 1.2 en-US
5 (22)
Need help?
Do you have a question about the IXXAT CAN@net NT and is the answer not in the manual?
Questions and answers