BASIC TOPIC
CAN User Interface
The goal is to design a user interface device that is able to control
and show information from CAN devices in real time, and also functions
as a bridge between PC and CAN devices. CAN devices are devices that
contain a CAN interface for controlling their functions or reading
their properties. Such devices are for example motor control and
sensors boards.
The nodes of the overall system are shown in the figure above. The students
will develop the CAN User Interface (CANUI) device. The device contains
a display, buttons and some knobs for the user interface and menu system.
With these components the user can control a menu system of the device.
The device contains also a serial port and the CAN user interface.
Serial port is used for connecting to PC. PC can control the CAN devices
with simple ASCII commands using a terminal program (hyperterminal on
Windows XP). The can devices can return data that is converted into
ASCII format for viewing on the terminal.
The CAN interface is used for controlling the CAN devices. CAN devices
in this course are two devices, one controlling two servomotors and the other lights and temperature sensor.
The motors, lights and sensors are controllable
via CAN protocol messages that the CANUI device sends to the CAN devices.
The format of the messages is given
here. The CAN protocol
specification is available on the course web page
here
The baud rate of the CAN bus is set to
125 kHz.
Working baud rate setting for MCP2515 is:
//Set SJW = 1TQ, TQ = 1000ns
//For 20MHz, BRP = 9
//For 16MHz, BRP = 7
//For 8MHz, BRP = 3
//For 4MHz, BRP = 1
CNF1 = 2
//BLT mode, PS1 = 3, PRSEG = 1
CNF2 = (1<<7) | (2<<3) | 0;
//PS2 = 3
CNF3 = 2
These settings result can bit time of 8*1000ns i.e. 125kHz baud rate.
The device is powered from a 12 volts DC power source. The block diagram of the system is show in figure below.
The basic requirements for the device are the following:
- The serial interface works from MCU to PC. The unit sends data to
the PC in a readable form. The data is read in PC with some regular
ASCII based terminal program such as Hyper Terminal. Data must be readable
in real-time.
- The serial interface works from PC to MCU. At least menu and
some CAN commands must be possible to be controlled from PC.
- Menu buttons can be used to operate the device.
- LCD display shows menu and some information, at least the current menu state and some current control values.
- The device gets 3.3 volt operating voltage from a 12 volt DC power source. The device must feed the 12 volts to other CAN devices.
- The device is able to control at least two CAN devices simultaneously.
These are also the basic grading points. Additional points can be received
from additional features that demonstrate utilizing different features of
the MCU. You may include also following optional features, such as:
- PC data visualization for measurements
- SD card for data logging
The CAN User Interface will be based on an Atmel ATmega series microcontroller
(MCU). The students are recommended to use ATmega32 controller. The
control module is required to contain the following on-board components:
ATMega MCU
some buttons for operating the CAN User InterfaceLCD display
RS-232 interface for PC connection
JTAG connector for programming and testing the MCU
electronics needed to support required functions
Each group will receive
- The serial cable connector
- LCD display (optrex F-51553)
Serial cable connector, 5 pin 2,54mm raster socket for pin header. Notice 2 empty orientation slots.
CAN light control box.
Notice that your device must supply the 12 volts for the CAN light control box.
The CAN connector is a 5-pin header, 2.54mm raster. Fourth pin is unconnected.
CAN servo control box.
Notice that your device must supply the 12 volts for the CAN servo control box.
The CAN connector is a 5-pin header, 2.54mm raster. Fourth pin is unconnected.