CAN Eeprom pages

From OpenMotics
Jump to navigation Jump to search

Introduction

This section talks about the input and sensor location data of the uCAN and CAN Control. More settings however exist that are not described in this page.

The Micro controller (Microchip 18F46K80) used in the CAN Control and uCAN has a built-in Eeprom. This Eeprom is used to store multiple setting of the module.

Important note: This page is only valid for the traditional Master configurations and NOT for the Brain and Brain+.

Eeprom locations

Below, you'll find the locations where the input and sensor data is stored:

For the CAN Control:

Location DEC Location HEX Description
304
130
Total number of CAN inputs
305
131
Total number of CAN sensors

For the uCAN (GEN2):

Location DEC Location HEX Description
0
0
programmed input nr for this CAN Bus for input 0
1
1
programmed input nr for this CAN Bus for input 1
2
2
programmed input nr for this CAN Bus for input 2
3
3
programmed input nr for this CAN Bus for input 3
4
4
programmed input nr for this CAN Bus for input 4
5
5
programmed input nr for this CAN Bus for input 5
8
8
programmed sensor nr for this CAN Bus for sensor 0
9
9
programmed sensor nr for this CAN Bus for sensor 1

For the uCAN (GEN3):

Location DEC Location HEX Description
0
0
programmed input nr for this CAN Bus for input 0
1
1
programmed input nr for this CAN Bus for input 1
2
2
programmed input nr for this CAN Bus for input 2
3
3
programmed input nr for this CAN Bus for input 3
4
4
programmed input nr for this CAN Bus for input 4
5
5
programmed input nr for this CAN Bus for input 5
8
8
programmed sensor nr for this CAN Bus for sensor 0
9
9
programmed sensor nr for this CAN Bus for sensor 1
10
A
Module Link
11
B
ID_NE: Module is new "N" or existing "E"
12
C
ID2: Micro CAN ID
13
D
ID1: Micro CAN ID
14
E
ID0: Micro CAN ID
15
F
Modbus Address
16
10
Modbus Type
17
11
Modbus Model
18
12
Modbus Speed
19
13
Modbus Mode
20
14
Buzzer/led mode programmed
21
15
Can bus speed
30
1E
Hardware Revision
128
80
Bootloader Mode
129
81
Flash Mode
900
384
Production Company (0-9)
901
385
Serial number 2 (MSB)
902
386
Serial number 1
903
387
Serial number 0 (LSB)
904
388
Production day (1-31)
905
389
Production month (1-12)
906
38A
Production year (0-99)

How does it work

Every CAN bus has its own numbering that starts with 0. So if you have 2 CAN Controls, each CAN Controls will start numbering its inputs and sensors starting from 0.

If you want to modify Eeprom values, it's important to understand how the Eeprom values are changed.

These are the different steps happening when a new installation is initialised:

  • When no inputs have been pressed (and thus no sensors nor inputs have been added), CAN Control Eeprom location DEC 304 and DEC 305 will contain 0 (or 255 which mean never been used). The uCAN Eeprom locations DEC 0-5 and DEC 8-9 will contain 255.
  • When an input is pressed, following will happen:
    • One of the input Eeprom locations (DEC 0-5) depending of the input being pressed of uCAN will get value 0 (first input). So this input gets ID 0 for this CAN bus. This is NOT input 0 for the Master (see later).
    • The CAN Control will create a virtual input module (for 8 inputs) and the CAN Control Eeprom location DEC 304 will be put at 1 (One input programmed and in use). The created input is now linked at the first input of this virtual input module. Depending on the location of this input module, the real input number can be found (for example, if the virtual input module is the 3rd module (module nr 2) of the input list, then this new created input in the Master will be input nr 16).
    • When the uCAN has a sensor linked, the sensor will get an ID as well. Since this is the first sensor of this CAN bus, it will get ID 0 that is programmed in the uCAN Eeprom location DEC 8 or 9 (depending if its the first or second sensor of this uCAN)
    • The CAN Control will create a virtual Sensor module (for 8 sensors) and the CAN Control Eeprom location DEC 305 will be put at 1 (one sensor programmed and in use). The created sensor is now linked at the first input of this virtual input module. Depending on the location of this sensor module input list, the real sensor number can be found (for example, if the virtual sensor module is the 2nd sensor module found in the input list, then this new created sensor in the Master will be input nr 8).
    • The next input being pressed will generate ID 1 that will be programmed in the corresponding Eeprom location for this input. The CAN control nr of inputs being used will be increased to 2.
    • etc
    • The Virtual inputs and sensors can only be used when a module discover process has been done and the virtual input and sensor modules have been added to the Master

How do I know the number of inputs, sensors and outputs a CAN Control has generated?

The below information only works as of Master Firmware V3.143.114 and CAN Control Firmware V4.1.29.

It's possible to know how many inputs, outputs and sensors every CAN control has:

  • This visualisation can only be done in CLI mode
  • Instruction "debug on" will display every change for every CAN Control (inputs, sensors and outputs)
  • Every time "debug on" is executed, the status of every CAN Control will be printed. When debug is on, every change will be printed as well.

Manually Erasing uCAN's by using the CLI

Note: The below procedures works for Master firmware 3.143.114 (and higher) and CAN Control firmware 4.1.29 (and higher)

These are the steps that are needed to erase the inputs and sensors in CLI mode:

  • Go to CLI mode
  • With the below instruction, you can visualise the number of inputs and sensors the system currently holds
debug on

Example feedback on the console:

CAN Control info (0): Inputs: 5 Sensors: 6 Outputs: 0
  • As long as debugging is on, every change will be displayed
  • Deleting inputs and sensors can only be done in discovery mode:
module discover start
  • Before deleting, you need to know the address of the CAN Control. To know the address:
error list
  • In the below example, you'll find 1 CAN control with address C:
error list
i2c errors: 0/0 1:1 PC0
00 T 084.001.003.006 0   # of Errors: 0
01 I 073.193.184.167 0   # of Errors: 0
02 C 067.044.155.120 0 C # of Errors: 1
03 T 084.051.168.146 0 C # of Errors: 1
04 I 073.208.102.145 0 C # of Errors: 0
00 D 068.171.254.252 0   # of Errors: 0
01 O 079.104.105.107 0   # of Errors: 0
OK
  • Deleting inputs, conform above example, is done in the following way:
erase cc inputs 67 44 155 120
  • You will get following feedback:
CAN Control erase done 67.44.155.120
CAN Control C2
  • Deleting sensors, conform above example, is done in the following way:
erase cc sensors 67 44 155 120
  • You will get following feedback:
CAN Control erase done 67.44.155.120
CAN Control C2
  • You can leave discovery mode now and start adding sensors and inputs
module discover stop

Note:

  • For CAN Control F4.1.37 or lower: The input and sensor modules that the CAN Control has created are not deleted, when the init button is pressed at the CAN Control, the modules will be added again if these are deleted.
  • For CAN Control F4.1.38 or higher: The input and sensor modules that the CAN Control has created are deleted, when the init button is pressed at the CAN Control, the modules not will be added again if these are deleted. Those modules must be deleted from the Master list because those won't exist in the CAN Control and will generate errors on the bus.

Adding uCAN's in a new installation step by step

uCAN firmware 1.5.2 or lower has the chance to generate double input and sensor ID's. To avoid this, the below procedure can be used:

  • Go to maintenance mode, if the modules are not yet added, add all the modules
  • Use the below CLI instruction to check the CAN control inputs and sensors (a line per CAN Control installed will be displayed)
debug on

Feedback:

CAN Control info (0): Inputs: 0 Sensors: 0 Outputs: 0
  • You see that no inputs nor outputs are yet available on the bus
  • Press a button of a uCAN (with sensor), following will be displayed:
CAN Control info (0): Inputs: 1 Sensors: 0 Outputs: 0
  • As you can see, an input has been added, a sensor not yet. Just wait until the sensor is added as well (can take up to 1 minute)
CAN Control info (0): Inputs: 1 Sensors: 1 Outputs: 0
  • Automatically, the CAN Control has created 1 input module and 1 sensor module that needs to be added:
module discover start
  • press the init button on the CAN Control and wait until all modules have been added
  • Leave discovery mode
module discover stop
  • you can use the below instruction to display the input being pressed (a second press will display the input)
input debug on
  • You can now add all other inputs of this uCAN (this uCAN has 4 inputs)
CAN Control info (0): Inputs: 4 Sensors: 1 Outputs: 0
  • Press now a button of the second uCAN in our example (who has 2 sensors connected)
CAN Control info (0): Inputs: 5 Sensors: 1 Outputs: 0
  • Wait until the 2 sensors are added (can take up to 1 minute)
CAN Control info (0): Inputs: 5 Sensors: 3 Outputs: 0
  • Continue the rest of the inputs of this uCAN and don't forget, depending on the inputs and sensors being added, you have to add input and sensor modules to the master ("module discover start", press init button). An input or sensor module ready to be added is visualised on the CAN Control module when the CAN stat led is blinking.
  • etc

Manually Erasing uCAN's by using a programmer

The uCAN's of a bus can get an erase when the Eeprom values of the CAN control are modified:

  • At CAN Control Eeprom location HEX 130, put value 0 (nr of inputs for this CAN bus)
  • At CAN Control Eeprom location HEX 131, put value 0 (nr of sensors for this CAN bus)

When the above value are being modified using a programmer, and the CAN Control is restarted, it will distribute a message to the uCAN's to erase all input and sensor values in their eeproms.

Note: It's also possible to only erase for example the sensors only and not the inputs, just change one value in Eeprom.

Manually Programming inputs and sensors by using a programmer

The following steps can be used to program manually inputs and/or sensors:

  • First program the CAN Control:
    • If you're going the program 8 inputs, write with a programmer at CAN Control location HEX 130 value 8 (which must be programmed as HEX number as well)
    • If you're going the program 4 sensors, write with a programmer at CAN Control location HEX 131 value 4 (which must be programmed as HEX number as well)
    • A virtual input and a virtual sensor module are created. First add these modules by using the module discovery procedure
  • Second program the uCAN's:
    • Program the inputs used: Write at the uCAN input location (HEX 0-5) value 0 for the first input, then 1 for the second input etc (Value are programmed as HEX numbers)
    • Program the sensors used: Write at the uCAN sensor location (HEX 8-9) value 0 for the first sensor, then 1 for the second sensor etc (Value are programmed as HEX numbers
    • Test the inputs in maintenance mode by using instruction "input debug on"
    • Test the sensors in maintenance mode by using instruction "sensor list"