tarpn_logo
 home    builders    Search

buildersTNC-PIConfigure TNC-PI ➜ Change I2C Address of TNC-PI

builders

Change I2C Address of TNC-PI

This document discusses how to use the tarpn i2c-set tool for moving a TNC‑PI from one I2C address to another.

The TNC-PI I2C address is configured by writing to register 7 of the TNC using the tarpn i2c-set command. Then you will tell the TNC-PI to reset, again using tarpn i2c-set. Finally you will verify its new address using tarpn i2c.

This command is easiest to understand if there is only one TNC-PI attached to your Raspberry PI's ribbon cable.

First do tarpn i2c. This will show you the current address, in hexadecimal, of the TNC-PI.

     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- 09 -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- UU -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --  
In this example the TNC-PI is at address 09, which, conveniently, means 9, in decimal. Now use that address, converted to decimal, in this command: tarpn i2c-get # where # is the decimal address of your TNC-PI. You will see a table like this:
01 TXDelay - Zero means use ADC  00
02 Persistance                   12
03 Slottime (in 10 mS)           10
04 TXTail                         0
05 Full Duplex - Not used         0
06 Our Channel (Hex)             00
07 I2C Address (0 = async) Hex   09
   ADC Value                     29

Note that register 07 I2C Address is the same hex number as shown in the i2c table.

Now we'll write to address 7 and change the address. For this example we'll change it to address 5.
Do tarpn i2c-set 9 7 5. That says to write to TNC at address 9, to register 7, and set it to 5. This should result in a table displayed which looks almost the same as before, but now the I2C address shows 05. If this didn't seem to work, run it again. It is ok to run it over and over. The new I2C address will not take effect until the TNC is reset.

Once you get the readback showing register 07 has a value of your new address, you can reset the TNC by sending a write to register 15 of the value 2, to the TNC-PI's old I2C address. When you do this command, the TNC should flash it's yellow and red lights in its startup pattern.
tarpn i2c-set 9 15 2.

Now do the tarpn i2c and tarpn i2c-get 5 commands and see the change has taken effect.
Remember to use the new address in the i2c-get command.

© Tadd Torborg, 2016↝2018 -- all rights reserved