Cortex A9 Coresight TMC State Machine and STS Register Behavior
The Cortex A9 Coresight Trace Memory Controller (TMC) is a critical component for debugging and tracing operations in ARM-based systems. The TMC operates in several states, including Disabled, Enabled, and Ready, which are governed by a state machine defined in the ARM documentation. The Status (STS) register, specifically the TMCReady and TMCEnable bits, plays a pivotal role in determining the current state of the TMC. According to the ARM white paper, the TMC should transition to the Disabled state after a reset, allowing for configuration and programming. However, the STS register’s reset value of 0xC indicates that both the TMCReady and TMCEnable bits are cleared, which should theoretically place the TMC in the Disabled state. The confusion arises when the TMCReady bit does not set as expected, preventing the TMC from entering the Disabled state and thus hindering further configuration.
The TMC state machine is designed to ensure that the TMC is properly initialized and ready for operation before any tracing or debugging activities commence. The Disabled state is the initial state post-reset, where the TMC can be programmed with the necessary configurations. The TMCReady bit in the STS register is a critical indicator of whether the TMC has successfully transitioned to the Disabled state. When the TMCReady bit is set, it signifies that the TMC is ready to be enabled and configured. However, if the TMCReady bit remains cleared, it indicates that the TMC is stuck in an intermediate state, preventing any further operations.
The STS register’s reset value of 0xC is particularly perplexing because it suggests that the TMC is in the Disabled state, but the TMCReady bit being cleared contradicts this. This discrepancy can lead to significant issues in system initialization and debugging, as the TMC cannot be configured or used for tracing until it properly enters the Disabled state. Understanding the relationship between the TMC state machine and the STS register is crucial for diagnosing and resolving this issue.
JTAG Interface Timing and TMC State Transition Delays
One of the primary reasons the TMCReady bit may not set as expected is related to timing issues in the JTAG interface. The JTAG interface is used to communicate with the TMC and configure its registers, including the STS register. However, the timing of these communications can be critical, especially when dealing with state transitions in the TMC. If the JTAG interface does not provide sufficient time for the TMC to complete its state transitions, the TMCReady bit may remain cleared, indicating that the TMC has not yet entered the Disabled state.
The TMC state machine operates based on a series of internal signals and conditions that must be met before transitioning between states. These transitions are not instantaneous and require a certain amount of time to complete. If the JTAG interface attempts to read the STS register before the TMC has had sufficient time to complete its state transition, the TMCReady bit may still be cleared, leading to the erroneous conclusion that the TMC is not in the Disabled state.
Additionally, the JTAG interface itself may introduce delays due to its own internal state machine and signal propagation times. These delays can further exacerbate the timing issues, making it even more challenging to accurately determine the TMC’s state. In some cases, the JTAG interface may need to be configured to introduce additional wait states or delays to ensure that the TMC has sufficient time to complete its state transitions before the STS register is read.
Another potential cause of the TMCReady bit not setting is related to the power-on reset sequence of the Cortex A9 processor. The power-on reset sequence initializes various components of the processor, including the TMC. If the power-on reset sequence does not provide sufficient time for the TMC to complete its initialization, the TMCReady bit may remain cleared. This can be particularly problematic in systems with complex power management schemes, where the power-on reset sequence may be truncated or delayed.
Implementing Proper JTAG Timing and Power-On Reset Sequences
To resolve the issue of the TMCReady bit not setting, it is essential to ensure that the JTAG interface and power-on reset sequences are properly configured to provide sufficient time for the TMC to complete its state transitions. This involves carefully analyzing the timing requirements of the TMC state machine and adjusting the JTAG interface and power-on reset sequences accordingly.
First, it is important to review the timing specifications provided in the ARM documentation for the Cortex A9 processor and the Coresight TMC. These specifications will provide detailed information on the required timing for state transitions and register accesses. Based on this information, the JTAG interface can be configured to introduce additional wait states or delays to ensure that the TMC has sufficient time to complete its state transitions before the STS register is read.
In addition to adjusting the JTAG interface timing, it may also be necessary to modify the power-on reset sequence to ensure that the TMC is properly initialized. This may involve extending the duration of the power-on reset sequence or adding additional delay cycles to allow the TMC to complete its initialization before the processor begins executing code. In some cases, it may be necessary to add external hardware components, such as delay circuits or reset controllers, to ensure that the power-on reset sequence meets the timing requirements of the TMC.
Another approach to resolving the TMCReady bit issue is to implement a software-based polling mechanism to monitor the STS register and wait for the TMCReady bit to set. This involves repeatedly reading the STS register and checking the TMCReady bit until it is set, indicating that the TMC has successfully entered the Disabled state. While this approach may introduce additional latency, it can be an effective way to ensure that the TMC is properly initialized before proceeding with further configuration.
In conclusion, the issue of the TMCReady bit not setting in the Cortex A9 Coresight TMC can be attributed to timing issues in the JTAG interface and power-on reset sequences. By carefully analyzing the timing requirements of the TMC state machine and adjusting the JTAG interface and power-on reset sequences accordingly, it is possible to ensure that the TMC properly enters the Disabled state and the TMCReady bit is set as expected. Implementing a software-based polling mechanism can also be an effective way to monitor the STS register and ensure that the TMC is properly initialized before proceeding with further configuration.