Avisaro Online Documentation - Wiki
Impressum Kontakt Sitemap

Using I2C interface

The command interface is available on the I2C interface. This interface is not the default interface, thus it needs to be activated once after receiving the module.

Setup and configuration

Activating and configuration of I2C interface (Slave)

The I2C is designed to receive user data as well as commands adressed to configure the Avisaro product. The interface is working as a slave device.

Activate and configure the I2C interface either through the build-in configuration web site or through SD-Card:

... via web interface

Activating I2C Slave interface

General

Module Name

The text entered in this field shows up in the top left corner of the web site. It has no functional meaning, but can be used to distinguish between modules.

Data Interface

Selects the active data interface. This is the main interface for the module. Through this interface the Avisaro device receives commands or sends out messages. Or, through this interface data is send and received to be stored or forwarded wirelessly.

RS232/RS485: Sets primary RS232 or RS485 or RS422 interface

IIC: Interface is set to IIC (= I2C) slave. See Mehr here for I2C master settings

SPI: SPI slave

CAN: Sets primary CAN interface

Ethernet: Sets to raw ethernet interface. For experts only.

TCP Socket: Sets to TCP socket interface

None: No interface is active

File: Outputs are written into a file.

Network Interface

The valid network interface option depend on the type of interface connected to the Avisaro device

WLAN: Only the wireless LAN interface is active (if present)

Ethernet: Only the LAN interface is active (if present)

None: No network interface becomes active (even if present)

Automatic: The network interface is automatically selected. The search is processed in the order 1) WLAN 2) LAN

Both: Both interfaces - WLAN and LAN - are active (if present)

 

Recovery Mode

There is a special feature to access a Avisaro device through a network interface, even if settings are messed up. See Mehr here for details.

Scheduling Frequency

Avisaro system runs on a multitasking system. This setting defines the time in milliseconds each task is assigned. Setting '0' sets this value to 'dynamic'. The recommended value is '0'.

IP Bridging

If there are two network interfaces, the Avisaro module can work as a bridge between those two. Thus, network traffic is routed from one to the other interface.

SD/MMC Support

The SD card slot requires periodic processing resources even if no card is inserted. If no SD card slot is present, the 'SD Support' should be disabled.

 

 

Reboot Device

This reboots the device. Quite a few changes require a reboot in order to become effective.

Factory Settings

This resets all customer settings to default values. All entries such as selected data interface, WLAN and IP settings are reset. The stored script remains stored, however the automatic execution upon startup is disabled.

Configuring I2C Slave interface

I2C

There is only one setting to be made:

I2C Slave Address: Enter the slave address for the Avisaro unit on the I2C bus. Values are entered in decimal.

... via SD card

To activate the I2C interface, copy the following commands into a file called 'autorun.txt'. Place this file on a SD card, insert card and power on device. See Mehr here for details on how to configure Avisaro products using the 'autorun.txt' file.

    prot i2c
i2c 73

See Mehr here for details on the 'prot' command
See Mehr here for details on the 'i2c' command

Activating and configuration of I2C interface (Master)

The I2C port in Master configuration is only available within Scripting. See Mehr here for details.

Working with I2C data interface

Enter data

For the I2C interface, commands can be entered in text (ASCII) form as well as in packet mode (binary):

Commands send in text (ASCII) mode

To send a command, perform a I2C write to the Avisaro module on the bus (by default it is address 73 decimal). Send the command (like "time?") by sending the ASCII values: 0x74, 0x69, 0x6d, 0x65, 0x3f  . The command needs to be terminated with a carriage return: 0x0d, 0x0a . Finish the I2C communication with a I2C 'stop' sequence.


To read the answer, perform a I2C read to the Avisaro module. The module will return 0xFF if no valid answer can be read. Keep on reading until valid text (ASCII) character are read. Finish the I2C read when all characters are read - to be recognized at a 0xFF after the last 0x0d 0x0a.

It is required to read the answer, otherwise the module will be blocked by unread answeres.

Commands send in packet (binary) mode

Typically, the I2C is used in a micro controller environment. The Avisaro module supports a simple packet mode which is well suited for this environment. See Mehr here for more details.

The procedure is to perform a I2C write sending the packet to the Avisaro module. To read the answer (required) perform a I2C read and get the answer - also in packet form.