Click here to return to the A2B SSPLUS STACK USER GUIDE
Diagnostic and debugging is one of the most powerful aspects of the Stack. Every logged event is timestamped and presented to the PAL for storage or reporting. Internally logged items include:
The Stack included two discrete classes of logging. The first class of logs are used to build structured sequence diagrams. The second class are unstructured trace messages. While both types utilize the pal_logXXX() functions, separate handles allow the PAL layer to distinguish between the two logging classes.
Sequence diagrams provide unparalleled transparency into the complex interactions between the master and slaves throughout the entire lifecycle of an A2B network. This includes all aspects of discovery and steady-state operation after discovery.
Once the deployment of an A2B network reaches a certain state of stability, trace messages can be utilized to log Stack operations in a less detailed manner than the Sequence diagrams. Trace messages are routinely integrated into larger system-level logging frameworks where message types and severity can be monitored and filtered.
Additionally, the Stack automatically performs power and line fault diagnostics whenever a network discovery fails. The diagnostics are reported back to the application through the diagnostic event handler registered with the Stack.
The sequence diagrams created by the Stack are compatible with an open-source tool called PlantUML (http://plantuml.com/). The raw syntax for PlantUML is human-readable and friendly for processing with different tools or checking into document repositories. When post-processed by the PlantUML tool, extremely rich graphical sequence diagrams can be created.
The script to post-process the sequence diagrams to a more readable format is given in ‘Target/tools’.
PAL Function | Use |
---|---|
a2b_LogOpenFunc | The second argument passed to a2b_seqChartStart() is passed back into this function.This argument is a URI that the PAL code should recognize and open. A handle must be returned back to the Stack from this function. The handle will be passed along to the a2b_LogCloseFunc and a2b_LogWriteFunc functions.NOTE: The URI passed into a2b_seqChartStart() can be a pointer to any object, not just a constant string. For systems without an underlying filesystem, a common trick is to pass a pointer to a “logging” structure that contains an application level log buffer. This pointer should then be returned to the Stack by this function as the handle. The Stack will then forward the pointer to the logging structure to the a2b_LogWriteFunc and a2b_LogCloseFunc functions whenever any sequence chart data needs to be written. |
a2b_LogCloseFunc | Closes the device handle returned by a2b_LogOpenFunc |
a2b_LogWriteFunc | Writes a line of sequence chart data to the device handle returned by a2b_LogOpenFunc |
In addition to sequence charts, the Stack also provides mechanisms to emit trace messages. Like sequence charts, trace messages are also sent through the logging subsystem of the PAL. It is important that a unique URI be used for trace messages, so the PAL can distinguish between trace messages and sequence charts. Similarly, if one is running two stack contexts concurrently, insure that each context has a unique URI to keep the trace outputs from mixing together.
Trace Levels(Macros) | Description |
---|---|
A2B_TRC_LVL_DEFAULT | Log fatal errors and warnings. This is a combination of A2B_TRC_LVL_WARN, A2B_TRC_LVL_ERROR, A2B_TRC_LVL_FATAL |
A2B_TRC_LVL_INFO | Log information wrt A2B node properties, slave plugin processing |
A2B_TRC_LVL_DEBUG | Log discovery-related messages and interrupts |
A2B_TRC_LVL_TRACE1 | Log typical function In/Out messages |
A2B_TRC_LVL_TRACE2 | Log verbose messages |
A2B_TRC_LVL_TRACE3 | Log Interrupt Mask for Master Plugin |
A2B_TRC_LVL_ALL | Log all messages |
Trace Domains(Macros) | Description |
---|---|
A2B_TRC_DOM_STACK | Log messages or events from Stack alone. The messages logged will be for a failure case. Hence A2B_TRC_LVL_DEFAULT should be enabled to log these messages. |
A2B_TRC_DOM_TICK | Log information with respect to Stack Tick. Enable A2B_TRC_LVL_TRACE2 to log these messages. |
A2B_TRC_DOM_TIMERS | Log timer related messages. Enable A2B_TRC_LVL_TRACE1 to log the timer functions. |
A2B_TRC_DOM_MSGRTR | Log information with respect to message Request and Notifications. Enable A2B_TRC_LVL_TRACE1 to log the events with respect to message transactions. |
A2B_TRC_DOM_PLUGIN | Log messages or events from all Plugins |
A2B_TRC_DOM_I2C | Log I2C transactions only. Enable A2B_TRC_LVL_TRACE2 to log the I2C transactions. |
A2B_TRC_DOM_SPI | Log SPI transactions only. Enable A2B_TRC_LVL_TRACE2 to log the SPI transactions. |
A2B_TRC_DOM_ALL | Log messages from all domains |
A2B stack is scalable for small micro-controllers to large SoC running complex OS. In this section, we provide options to optimize memory based on a few configurations.