Datasheet

Copyright © 2013 ARM Ltd. All rights reserved
CAN: Controller Area Network Lab using ST STM32 Cortex-M processors. www.keil.com
27
PC Tracing: Program Counter samples…
1. Open Debug/Debug Settings and click on the Trace tab. Unselect EXCTRC and on Data R/W sample.
2. Select Periodic. Click OK and click RUN. Double-click in the Trace Records window to clear it.
3. Program samples will now be displayed with a timestamp in both CPU cycles and the time in seconds.
TIP: In this example every 16,384
th
PC is displayed. PC Samples are useful as they can give good indication where your
CPU is spending its time. Use ETM trace with a ULINKpro if you need to see every instruction executed for advanced
program flow debugging, Code Coverage, Execution Profiling or Performance Analysis.
1. Open Debug/Debug Settings and unselect PC
Samples. They consume a great deal of the SWV
bandwidth. They are best left off if you are not
using them. Click on Close.
Watch and Memory windows: Updated in real-time…
The STM32F400 is an ARM Cortex-M4 processor which incorporates CoreSight debugging technology. CoreSight provides
a means to update the µVision Watch and Memory windows without stealing CPU cycles to do so.
TIP: In addition, you are able, in real-time, to insert values into the Memory window. Right click on the memory location
you want to change, select Modify Memory, enter the new value and press OK.
Recall we have a structure can_msg that contains the CAN frame information. We have two instances of this: CAN_TxMsg
and CAN_RxMsg which are arrays for each of the two CAN controllers.
1. Click on RUN and confirm the CAN values val_Tx and val_Rx are still changing in Watch 1.
2. In a Watch window, double-click on <Enter expression> and enter CAN_TxMsg. Repeat with CAN_RxMsg.
3. In CAN_RxMsg, open to display [0] and data[0]. Note this value changes while the program is running.
4. In CAN_TxMsg, open to display [1] and data[0]. Note this value changes while the program is running.
5. In a memory window, enter &CAN_TxMsg[1].data and press Enter. You will see the appropriate memory locations
change value as the program runs.
6. Stop the program and exit Debug mode.
TIP: Note you can enter these variables when the program is still
running. You can also highlight, drag and drop or right click on a
variable and select Add varname to…
TIP: CoreSight debug technology with Cortex-M processors enables
you to set/unset hardware breakpoints while the program is running.
This finishes a partial demonstration of the Serial Wire Viewer trace
feature of Cortex-M processors. Visit
UUwww.keil.comUU for more
information concerning the Serial Wire Viewer interface in Cortex-M
processors.