CANNY 5.3 MD1A

CANNY 5.3 MD1A is a miniature programmable logic controller designed for automotive, domestic and industrial use. It is cost-effective CAN/LIN controller with two half-bridge power outputs and three discrete IO channels and protected ADC.

Power channels can be used independently of each other to control resistive, capacitive and inductive loads, as well as to control brushed DC motors.

General Information

CANNY 5.3 MD1A small-sized, cost-effective CAN/LIN controller with two half-bridge power outputs, three universal discrete IO channels, Dallas 1-Wire support and protected ADC with a measurement range 0..5V/0..16V and a resolution of 12 bits.

Two power outputs with a continuous load current of up to 5A per output and a total load current of up to 10A (25A short-term) in discrete or PWM mode with a resolution of 1 μs.

The controller is equipped with built-in current and temperature sensors, automatic protection against overload, overheating, polarity reversal, and allows you to regulate the power on the load through the use of PWM with an effective frequency of up to 40 kHz. The present feedback from the actuator/electric motor can be diagnose overload/jamming/limiter reached. The controller is equipped with non-volatile memory and means for limiting energy consumption.

Using CannyLab® Integrated Development Environment controller can be programmed in simple but powerful graphical way. The internal USB interface is used for the firmware updates.

CAUTION HOT! When the controller operates with heavy loads, or in PWM/HF PWM mode, individual internal elements of the controller can heat up to a temperature of more than +100°C. Improper handling of the controller may result in personal injury.

DANGER OF SHORT CIRCUIT AND FIRE! Connect the conductors of the power section to the controller by soldering, and use a wire that matches the characteristics of the connected load. Always use fuses of the correct rating in the controller and load power supply circuits. Do not use wires with damaged insulation. Do not allow moisture or foreign conductive objects to get inside the controller. If necessary, organize sufficient forced heat removal from the power elements of the controller. Do not use a controller that shows signs of damage. Failure to comply with these conditions may result in a short circuit or fire.

CANNY 5.3 MD1A has a limited number of external channels and can therefore be classified as a smart relay or a Nano PLC. Nevertheless, CANNY 5.3 MD1A has enough channels and driver features to serve as a solution for many different control, automated and monitoral tasks.

CANNY 5.3 MD1A has the following unique combination of features:

  • supply voltage range (Vext) 7…18V;
  • rated IO channels voltage 0…Vext;
  • the maximum output current of each of the 3 IO channels: +/- 100mA, sufficient to control a standard automotive relay;
  • two high power outputs with a continuous load current of up to 5A per output and a total load current of up to 10A (25A short-term);
  • one CAN 2.0B interfaces, compliant with ISO-11898, SAE J2411 standards, which are widely used in modern cars;
  • two half-duplex single-wire UART interfaces or one full-duplex UARTs with direct or inverted (RS232-like) polarity;
  • two LIN 1.3 / 2.0 master/slave interfaces;
  • any of IO channels can be configured as Dallas 1-Wire Master;
  • each IO channel, as well as two power outputs of the controller, can operate in PWM / HF PWM mode with individual settings for the period and filling, each of the IO channels of the controller can work in the asynchronous pulse counter mode with maximum effective frequency up to kHz and input PWM signal parameters meter about 1μs resolution;
  • discrete IO channels #9 and #10, together, can operate in counter-encoder mode;
  • built-in energy consumption management in the range of 1 to 40 mA, helps conserve battery power during a period of inactivity in a car;
  • EEPROM for applications and sixty-four 16-bit non-volatile memory data cells, available to user application for preserving critical data during a power failure;
  • wide operating temperature range from -40 to + 85 ° C;
  • integrated surge protection and short circuit protection;
  • compact IP50 compliant housing, suitable for installation and operation as part of a car’s cabin equipment;
  • specialised packages of system and application software for use with automotive CAN and LIN networks.

The CFD (Canny Function Diagram) visual programming language was created specifically for the purpose of creating applications in a fast, intuitive fashion. These programs are called function diagrams. The free CannyLab IDE is used to create, edit, debug and deploy these programs.

Requirements for writing software to the controller:

  • PC with a USB port version 1.1 or higher;
  • installed CannyLab IDE;
  • ordinary microUSB cable.

The amount of controller memory accessible to you is enough to accommodate a function diagram consisting of several hundred function blocks. This allows you to implement fairly sophisticated algorithmms.

The controller has a two-coloured LED controlled from the user application, useful for indicating controller operation mode and debugging.

Design and functional operation

The appearance and layout

The main components of CANNY 5.3 MD1A are:

  • a micro controller (MCU) with the auxiliary circuits;
  • power supply system for all controller elements;
  • IO channels level matching circuit;
  • power output elements;
  • electric protection system;
  • connectors and LED.

All of these components are based on a single 65 x 23 mm printed circuit board, mounted inside a quick-to-open plastic housing.

The controller has three external connectors and one internal. To connect the controller to the power supply and external devices, the kit includes a set of jumper harness.

  • external connector X1. Contains four pins: +7…+18V input, power input GND, CAN-H and CAN-L.
  • 4 power contact holes for connecting DC power and power load.
  • external connector X3. Contains three pins: channel #8, channel #9 and channel #10.
  • internal connector USB is to connect controller to the PC with microUSB cable.
CANNY 5.3 MD1A appearance
CANNY 5.3 MD1A pins

Controller Power Supply

The supply voltage of the CANNY 5.3 MD1A controller ranges from 7V to 18V and is carried out through special contacts of the 4-pin connector X1.

Note: High power outputs are powered separately from the controller and supplied through special contacts (contact holes).

Software Architecture

CANNY 5.3 MD1A is a digital programmable computing controller. Its main structural elements are:

  • arithmetic logic unit (ALU);
  • internal memory;
  • command execution management subsystem;
  • input-output system.
CANNY 5.3 MD1A software architecture

Arithmetic Logic Unit is the processing core of CANNY 5.3 MD1A. ALU is used to execute both system software and function diagrams that were uploaded into the controller’s internal memory. The controller’s internal memory is divided into the EEP program memory, EEP data memory, and ROM. The command management subsystem is responsible for switching and setting up the operation mode of the controller. The IO system is used to communicate with the outside world, using both discrete IO channels and standard digital interfaces CAN / LIN / RS232 / USB.

Software Structure

CANNY 5.3 MD1A software structure

CANNY 5.3 MD1A software structure consists of:

  • a bootloader;
  • system software (operating system and drivers);
  • function diagram.

The bootloader enables the operation of the controller in the software download mod by organizing data transmission between CANNY 5.3 MD1A and the PC using the USB protocol. It is responsible for checking the integrity of data transmitted for PC and subsequently writing it to the controller’s internal memory. The bootloader is placed into the internal memory of the controller during production and can not be deleted or modified by you.

The manufacturer distributes CANNY 5.3 MD1A firmware in the CCX file format. Firmware includes an operating system and a set of drivers providing function diagram execution and its interaction with controller resources. You can write/erase firmware to/from the controller, but you cannot modify CCX file content.

The function diagram is created and modified in CannyLab IDE. You can then save it to a CFD file or load it into the controller where it specifies the controller’s algorithm in Run mode.

Operation modes

There are three operation modes, each of them used for specific functionality.

Software upload mode

In software download mode, the controller is ran by bootloader. The bootloader writes firmware and function diagrams according to commands received from the CannyLab IDE. Transition to this mode happens automatically when the controller is connected to a PC via a USB cable. During the transition to software upload mode the controller performs a master reset: the function diagram execution stops, IO channels are switched to the neutral state, built-in green LED turns on. When the controller establishes communication with CannyLab, the green LED starts blinking.

This mode is exited automatically when the controller is disconnected from the PC. When exiting the mode if system software is loaded into the EEPROM correctly, the controller will switch to running mode, otherwise it returns to software download mode.

Running mode

Run mode is the controller’s main operation mode. In this mode, the controller is operated by the system software continuously, executing the function diagram in a never-ending loop. Transition to this mode happens automatically when the controller is connected to an external 12V power supply and not connected via USB. In this mode the function diagram has access to all controller resources that are supported by the drivers currently uploaded to the controller.

Sleep mode

This mode is a variant of run mode in which the controller pauses to reduce its power consumption to a minimum after each loop of the function diagram. Thus, the controller operates in a “pulsed” mode, periodically “falling asleep” and “waking up”. Enable, disable, and configure the parameters of this mode via the function diagram. This mode is useful when developing systems where power consumption matters, such as on-board car equipment.

Runtime Environment

Functional diagram presentation

Programs for CANNY 5.3 MD1A controller, function diagrams are developed within the CannyLab IDE. Upon uploading the diagram to the controller, it is automatically processed by the translator. The translator checks the consistency of the diagram, determines function block execution order and converts the diagram into the executable code - a sequence of machine instructions for CANNY 5.3 MD1A controller’s ALU.

The execution order

When written to the controller the executable program code is included in the sequence of system software machine instructions. Thus, the entire command sequence for a controller that contains both system software and a function diagram will be:

  • initialisation routine executed once after each reset of the controller;
  • infinite loop, called the diagram execution loop. It consists of:
  • procedures for reading the status of hardware resources;
  • executable function diagram code;
  • procedures for changing the status of hardware resources.

Some of the drivers included in the controller system software, such as the CAN driver, need the controller to react immediately to program events and received data. Program code of these drivers is asynchronously processed by the controller in parallel with the main execution flow. When processing asynchronous drivers calls, the execution of the diagram’s main loop is briefly suspended.

Algorithm of diagram execution by CANNY 5.3 MD1A controller

Access to hardware resources

The following resources are available from the function diagram:

  • controller system resources;
  • IO subsystem;
  • additional drivers included in the system software.

All of these resources appear within the controller’s internal memory protected address space. This address space is divided into input and output registers.

You can use input registers as a source of input data for virtually any function block of the diagram. This allows you to access and use the data received by the controller from the outside world for your algorithms. For example, you can access information about the electric potential on any of the controller’s connector pins, or data packet contents received via the CAN bus.

You can use output registers as the output target for any function block on the diagram. This lets you control controller resources from the function diagram, which lets you influence objects in the outside world. For example, you can switch an external relay by changing the electrical potential on one of the pins of the controller, turn the controller LED on, set CAN operation mode, send a data packet via the CAN bus.

To use most controller resources you will first need to assign the necessary operating parameters, such as the polarity of output channels, the polarity and the sensitivity of input channels, CAN communication speed and so on.

Assigning these parameters is done by recording special constants into one or several specific output registers, depending on the resource that needs to be accessed. For example, writing a constant with a value of 260 into the register located at 71 address sets channel №8 to an output positive polarity mode.

Writing a constant to a controller register

For user convenience all the of the controller’s available registers, as well as all special constants used for interacting with these resources, are named. As demonstrated above, instead of writing 260 into the register 71, you instead write a named “Strong VDD/Weak GND” constant to “DIO Output Mode Setup Register, IO Channel №8”.

Receiving a signal from an input register

Controllers’ Registers

System Registers

Main article: CANNY 5.3 MD1A, System Registers

System resources are divided into an address group of input registers and an address group of output registers. By accessing these registers from the function diagram you can receive useful information about the current status of the controller, and control its operating mode. The set of system registers is located in the “System Registers” folder of the CannyLab IDE registers list. The list is accessible via “Input Register” and “Output Register” context menu options in the editor.

Discrete Inputs and Outputs

Main article: CANNY 5.3 MD1A, Discrete Inputs and Outputs

CANNY 5.3 MD1A gives you access to nine discrete general purpose IO channels. Each channel is physically accessed through a corresponding pin of X3 (Channels 8, 9, 10) connectors. By writing and reading data of the respective driver registers, the functional diagram can manage the electric potential in each of these contacts, as well as get information about the current potential of each of them.

The physical characteristics of these channels allow them to be connected to a variety of external devices. All channels can be used to work with any type of load, for example: electromagnetic relays, small electric motors, LEDs, low current systems. You can use a variety of input signal sources, such as: mechanical, electromechanical, and electronic buttons and switches, pulse generators, voltage source 0-12V, transistor outputs of various equipment, etc.

Channel operation mode and parameters are set via the function diagram. At any given moment in time, the channels can only work in one of the possible modes, but it is possible to dynamically override the channel configuration from the function diagram.

High Power Output Channels

Main article: CANNY 5.3 MD1A, High Power Output Channels Driver

The main purpose of the CANNY 5.3 MD1A controller is to control powerful DC loads using power output channels, with the ability to flexibly configure their operating parameters, including in high-frequency PWM mode. For this purpose, the controller has 2 power outputs with a continuous load current of up to 5A each and a total load current of up to 10A. Each power output is equipped with an individual built-in current sensor, automatic protection against overload and overheating. Own sets of registers for reading and writing power outputs allow you to set individual operating modes for them and monitor their status.

Note: Using power output channels in high-frequency PWM mode leads to an increase in the temperature of the controller, which, under certain PWM parameters, can cause it to turn off to protect against overheating. For stable operation in these modes, it is necessary to provide additional heat removal from the controller.

High Resolution PWM

Main article: CANNY 5.3 MD1A, High Resolution PWM

CANNY 5.3 MD1A supports high-resolution pulse-width modulator mode on all of its nine input-output channels. However, only one controller output can be used as an HR PWM channel at a time. The HR PWM channel can be reassigned from the function diagram during its execution. In HR PWM mode, the PWM timing parameters - the period and duty cycle can be set in the range from 2 to 65535 microseconds, in 1 microsecond increments.

In HR PWM mode, the channel is asynchronous to the function diagram, which allows for maximum stability of generated signal timing parameters.

HR PMW driver operates using the controller’s channel resources, but has a higher priority than the discrete input-output driver. This means that for all channels, for which the HR PMW driver is activated, all value changes in registers associated with discrete input-output driver will be ignored.

CAN driver

Main article: CANNY 5.3 MD1A, CAN driver

Two specialized external contacts, located on the 4-pin connector X1 (CAN-H and CAN-L), are provided for connection to digital information CAN-bus.

The CANNY 5.3 MD1A controller CAN driver has 16 hardware filters.

LIN driver

Main article: CANNY 5.3 MD1A, LIN driver

The CANNY 5.3 MD1A controller has two independent interfaces LIN, using controller input/output channels, which are specified by the user in the functional diagram.

LIN driver channels can be connected both in tandem and individually. They have individual settings for baud rate, pull-up line and bus node type - MASTER or SLAVE.

LIN driver operates using the controller’s channel resources, but has a higher priority than the discrete input-output driver. This means that for all channels, for which the LIN driver is activated, all value changes in registers associated with discrete input-output driver will be ignored.

UART / RS232 / Modbus driver

Main article: CANNY 5.3 MD1A, UART Driver

The CANNY 5.3 MD1A controller has two half-duplex single-wire UART interfaces or one full-duplex UARTs with direct or inverted (RS232-like) polarity. It may be used to connect the controllers with each other or with external equipment supporting this communications protocols. The channels may be activated independently of each other and have individual data speed setting, protocol type and configuration, pull up line.

Size of receive and transmit buffers for each of the interfaces of the CANNY 5.3 MD1A UART driver is 64 bytes.

UART implementation in CANNY 5.3 MD1A controllers enables serial data reception and transmission over a single wire in half-duplex mode. Thus CANNY 5.3 MD1A may have four independent connections when using the UART protocol. Monitoring of the data link status is done from the function diagram. If the channel is free, the device may start data transmission, otherwise the device should wait for the line release.

Inverted UART (RS-232) implementation, using any two UART data channels, enables the exchange of data with other Inverted UART devices in duplex mode, i.e. one channel is used to send data, while the other is used to simultaneously receive data.

Modbus protocol in CANNY 5.3 MD1A controllers is implemented both over UART or over Inverted UART. A compact binary variant called Modbus RTU is used as the ADU (Application Data Unit). Checking the data integrity is done via the automatically calculated checksum (CRC). Package size is limited to 64 bytes including the CRC.

UART / RS232 / Modbus driver operates using the controller’s channel resources, but has a higher priority than the discrete input-output driver. This means that for all channels, for which the UART/RS-232/Modbus driver is activated, all value changes in registers associated with discrete input-output driver will be ignored.

Dallas 1-Wire Driver

Main article: CANNY 5.3 MD1A, Драйвер Dallas 1-Wire

CANNY 5.3 MD1A controller can be used as a MASTER in a single-wire data network Dallas 1-Wire®. The controller is only capable of sending requests for data to slave devices.

All CANNY 5.3 MD1A input-output channels can be used to connect the controller to 1-Wire bus. At the same time, that channel must be externally pulled-up to 5V with a 3-7k Ohm resistor. Depending on the specific mode(defined through the function diagram), the CANNY 5.3 MD1A implementation makes it possible to communicate with a specific device through the 1-Wire bus by using the device address. This enables the controller to work with several SLAVE devices through one channel. It’s also possible to perform a serial connection of the controller to several 1-Wire buses. In operating modes when device handling by address is not available, therefore you will only be able to connect to one SLAVE node per channel.

User Preprogrammed Parameters

Main article: CANNY 5.3 MD1A, User Preprogrammed Parameters

The custom configuration parameters can be specified by the end user when loading software into the controller using SFX-files. After uploading software and running the controller in standalone mode, parameters set by user become available in the function diagram within the relevant controller registers list folder.

Proper use of user-defined parameters significantly increases the flexibility and versatility of controller-based solutions, enabling the end user to make safe changes in controller operation algorithm, using a simple user interface, bypassing the need for teaching them how to work with CannyLab.

EEPROM Non-volatile Memory

Main article: CANNY 5.3 MD1A, EEPROM Non-volatile Memory

To eliminate loss of critical information (controller’s state, external device status, etc.) in case of a power failure, the CANNY 5.3 MD1A controller is equipped with non-volatile memory. The values saved in EEPROM will be available in special registers after the power is restored.

There are 64 16-bit non-volatile memory cells, which are accessed by using the corresponding input and output registers.

Note: Working with non-volatile memory does not require any special pre-configuration.

Analog-to-digital converter (ADC)

Main article: CANNY 5.3 MD1A, Analog-to-digital converter (ADC)

Two ADCs with a resolution of 12 bits, which can operate in two modes: in voltage measurement mode in the range 0…5V and in voltage measurement mode in the range 0…16V, having built-in protection against increased input voltage, are connected to additional through contacts. Operating modes are controlled for each ADC separately. By default, the voltage measurement mode is active from 0 to 5V. Using jumpers on the contact pads located on the reverse side of the board, ADC1 and ADC2 can be connected to discrete channels #9 and #10, respectively

ADC driver is always active.

It is possible to determine the Main Power Input voltage of the controller, for which a separate ADC is used. Information on the value of the ADC power supply of the controller is available in a special register.

SEE ALSO