Knowledge Base

Xwire: Slave configuration

Configuration of slave controllers

A SPLat controller that is to be used as an Xwire slave needs two things to get communications going:

  1. An Xwire address, so the master knows how to find it
  2. A configuration table in NVEM page 0 that tells it where in RAM the exchanged data is to be located.
Setting slave address

The slave’s address is set by executing an XwireSetAddr instruction with X set to the required address. This would normally happen during your program’s initialisation. This must match the SlaveAddr used in the master configuration table. This could be “hardwired” into your program or perhaps derived from some inputs or jumpers. For example, the CC18 and HD8 have two jumpers, A0 and A1, which can be read into X with the XwireGetJumpers instruction.

Slave configuration table

Each SPLat controller that is a slave in Xwire must also have a configuration table in NVEM page 0. For a slave it is a single 4-byte entry of the form

        NVEM0  XWireTab:          NV0Byte         TxRAMStart,TxRAMLen,RxRAMStart,RxRAMLen

The variables mean the same as before.

The RAM addresses in the slave need not match those in the master. However the slave TxRAMLen must match the master RxRAMLen, and vice-versa. The master and the slave will both ignore any data transfers that contain the wrong number of bytes.

The configuration will be invoked by the following instruction placed in the early initialization code for the master

        XwireSlave     
Dedicated slave boards

An Xwire slave needn’t be a SPLat controller. It can simply be a dedicated peripheral device that interfaces to Xwire. In that case you won’t need to do anything to configure it, except set some jumpers for its address. The board’s documentation will tell you how many bytes of data to send it, how many to expect back, and what those bytes mean.