This chapter describes how to use the SWO Calibration which obtains the SWO clock frequency and the Prescaler (clock divider) value in a semi automated way.
The Data Rate setting relates to an amount of internal BlueBox clock cycles relative to one SWO bit. As the SWO uses a UART (Universal Asynchronous Receiver/Transmitter) protocol and hence the more time (cycles) per UART bit the more timing margin and hence error margin results.
•Fastest - Starts the calibration with the fastest possible SWO clock settings and results in the highest possible SWO bit rate (speed) but potentially at the price of the stability of long trace recordings. This should only be used if the device internal clock from which the SWO clock is derived is stable, e.g., derived from a crystal oscillator.
•Optimum (Recommended) - Optimum setting between speed and SWO baudrate error margin.
•Slow - Offers the highest SWO baudrate error margin at the expense of speed. Use this if the clock originates from an internal oscillator which varies widely over voltage and temperature.
SWO Calibration is available on the iC5700 only.
Make sure the SWO Trace Capture method is selected in Hardware / CPU Options / SoC.
Run the application and make sure the CPU clock is set.
The CPU should run until the clock initialization completes as the SWO clock can depend/vary based on it.
Stop the CPU.
Select the Data Rate and start the SWO Calibration via Hardware / Tools / SWO Calibration.
Once the calibration condition - Data Rate (Optimum, Fast, Slow) is changed a new debug session should be started.
Copy the Recommended values to Current via the arrow button.
Apply the Recommended values and transfer the results to Hardware / CPU Options / SoC / SWO.
Note that changes will apply in the next session. It is recommended to save this configuration to the workspace (File / Save All).
Make sure winIDEA Debug Status is OFFLINE.
Make sure that winIDEA is disconnected. If that is not the case, disconnect it via Debug / End Session.
Perform Reset Download.
Trace Line Calibration is usually used for identifying and configuring optimal settings of trace signals when using parallel trace. However, the tool can be also used to determine the SWO clock. This is especially useful when the SWO Calibration is not supported, for example on the iC5000.
Follow the instructions below to measure the SWO clock with Trace Line Calibration:
1. Make sure the Parallel Trace Capture method is selected in Hardware / CPU Options / SoC.
2. Run the application. Debug status must be .
3. Start the Trace Line Calibration by pressing Start in Hardware / Tools / Trace Line Calibration. Calibration can take a minute.
4. Multiply the value obtained from Measured trace clock by two.
5. In Hardware / CPU Options / SoC, select SWO Trace Capture method and enter the calculated value into the SWO / Clock field.
6. Perform Reset or Download.
The limitation of this method is when parallel trace is not exposed via the CoreSight 20-pin debug connector on the embedded target. In such case, use one of the next methods.
Using the logic analyzer or oscilloscope, you can measure the SWO clock directly from the SWO pin.
1. Find the SWO pin on the target.
2. Connect the probe to the pin and record the signal.
3. Find the shortest pulse in the record.
4. Calculate the SWO clock frequency from the shortest measured period.
It can be assumed that the width of this pulse is equal to one period of the signal. For greater reliability, these steps can be repeated several times.
5. In Hardware / CPU Options / SoC, select SWO Trace Capture method and enter the calculated value into the Clock field.
6. Perform Reset or Download.
Your application needs to ensure that the trace components and the SWO pin are configured correctly.
The last method is clock determination from the CPU configuration. If you decide to use this method, you must be familiar with the clocking infrastructure of your particular microcontroller. For more information, refer to the reference manual of your device.
Of all the above methods, this method is the least reliable, as some details can be missed quickly.