Keil™, An ARM® Company

µVision® IDE & Debugger

This feature works with...
ARMC166C251C51Eval

CAN Communications Simulation

CAN Controller Dialog A CAN Bus connects multiple microcontroller systems and allows them to communicate using a reliable, well-defined interface. Testing a CAN application traditionally requires a complete system including multiple CAN nodes (multiple hardware targets) and usually a CAN Traffic Analyzer.

The complexity of building a proper physical test environment can be very time-consuming.

The µVision3 debugger simulates all aspects of a CAN environment and allows you to thoroughly test CAN applications in a fraction of the time required by traditional CAN test environments. Simulation capabilities include:

  • Dialogs that provide access to CAN peripheral configuration options.
  • Virtual target registers that provide access to CAN message traffic.
  • And, debug scripts that make it easy to simulate external CAN nodes.

For example, the following debugger script sends a CAN message into the simulated microcontroller twice a second.

SIGNAL void sendCAN (float secs)  {
  while (1)  {
    CAN0ID = 0x4510;          // CAN message ID
    CAN0L  = 2;               // message length 2 bytes
    CAN0B0 = (info & 0xFF);   // message data byte 0
    CAN0B1 = (info >> 8);     // message data byte 1
    CAN0IN = 2;               // send CAN message with 29-bit ID
    swatch (secs);            // delay for specified time
    info++;                   // increment info value
  }
}

>sendCAN (0.5);               // invoke sendCAN function

CAN Communication Dialog You may review incoming and outgoing CAN messages in the CAN Communication dialog. This dialog displays all CAN Bus traffic sent and received on the simulated CAN Bus.