AIO Bootloading Slave modules

From OpenMotics
Jump to navigation Jump to search

Introduction

The OpenMotics Slave modules (Input, Output, Can Control, Dim Control, energy module etc) are programmed with a Bootloader allowing new firmware to be loaded in the field. This short introduction describes what needs to be done to be able to use the Beagle Bone (BB) as a bootloader to update the slave modules through the Master processor (DSPIC). Following needs to be considered:

  • The RJ45 connection present on the Core and Core+ connects the slave modules. On this RJ45, 2 RS485 networks are available:
    • RS485 Bus 1: All non-energy modules (Input, Output, Can Control etc) are connected on this network, network controlled by the Master Processor (DSPIC)
    • RS485 Bus 2: All Energy slave modules (Energy module, P1 concentrator) are connected on this network, network controlled by the BB

This document describes the pre-requisites for boot loading the RS485 Bus 1 which will be called RS485 bus in the rest of the document.

RS485 Mode

The RS485 Bus has 3 modes of operations:

  • RS485_mode=0: RS485 Bus is in LIVE mode and controlled by the Master (DSPIC).
    • The Master will scan the Bus for input changes and will update the output modules when a changed did occur.
    • The slave modules will only respond when the Master first send a request
    • The Master is master of the Bus.
  • RS485_mode=1: RS485 Bus is in INIT mode and Slaves can send messages without the Master asking for it.
    • The Master will be silent and will listen for messages from slaves
    • When an init button is pressed for example, the slave module will send a message to the Master indicating that this module is new or an existing module including his ID.
    • The Slave Modules are master of the Bus
  • RS485_mode=2: RS485 bus is in TRANSPARENT mode and all incoming messages from slaves will be forwarded to the BB without any interpretation of the Master.
    • The Master will act as a tunnel between the BB and the slave modules
    • The Master will not put any messages on the Bus only those asked by the BB
    • All incoming messages from slaves on the Bus will be forwarded to the BB
    • Non of the RS485 messages (incoming and outgoing) will be interpreted by the Master
    • The BB is master of the Bus

API instructions

2 set of API instructions are needed:

Step by Step

Step 1

First the RS485 mode needs to be changed so the BB becomes the master of the Bus by using API instruction "SM".

API Reference Guide instruction "SM" (Set RS485 Mode): https://wiki.openmotics.com/index.php/API_Reference_Guide_AIO#SM_-.3E_Set_RS485_Mode

RS485_mode=2

Step 2

Verify that RS485_mode=2 by using API instruction "ST".

API Reference Guide instruction "ST" (Status): https://wiki.openmotics.com/index.php/API_Reference_Guide_AIO#ST_-.3E_Status_Read

Step 3

Start sending embedded RS485 messages by using API instruction "TC".

API Reference Guide instruction "TC" (Message from BB to RS485 Bus): https://wiki.openmotics.com/index.php/API_Reference_Guide_AIO#TC_-.3E_Transparent_Communication_.28RS485_Tunnel.29

All returned messages from the RS485 slaves towards the BB will be embedded in API instruction "TM"

API Reference Guide instruction "TM" (Message RS485 Bus to BB): https://wiki.openmotics.com/index.php/API_Reference_Guide_AIO#TM_-.3E_Transparent_Message_.28from_RS485_slave.29

Following RS485 messages needs to be embedded by using API instruction "TC":

Step 4

As a last step, the RS485 mode needs to be changed so the Master become master of the Bus again by using API instruction "SM".

API Reference Guide instruction "SM" (Set RS485 Mode): https://wiki.openmotics.com/index.php/API_Reference_Guide_AIO#SM_-.3E_Set_RS485_Mode

RS485_mode=0

Step 5

Verify that RS485_mode=0 by using API instruction "ST".

API Reference Guide instruction "ST" (Status): https://wiki.openmotics.com/index.php/API_Reference_Guide_AIO#ST_-.3E_Status_Read