tarpn_logo
 home    builders    Search

buildersTNC-PIConfigure TNC-PI ➜ Async to I2C

Move TNC-PI from Async to I2C

This document discusses how to use the tarpn i2c-assign tool for moving a TNC‑PI from async to I2C.
Note: The i2c-assign command is not supported for Raspberry PI 3 units.
If you need to perform this operation and you only have a Raspberry PI 3, send a missive to the TARPN email reflector. We'll see if we can help you. Somebody must have an older Raspberry PI.
There is a way to do this operation with a Raspberry PI 3 but it is ugly and involves rebooting the device a couple of times. I don't have a ready-made script for this and there will be some interesting work to be done if you are not comfortable with VI and Linux. The reason this is so exciting is that the Raspberry PI 3 added Bluetooth and the addition of that feature sacrificed the usefulness of the rarely used ASYNC port. The wild and crazy fix for this lobotomizes the Raspberry PI so it behaves like a Raspberry PI 2, and you'll want to put it back to normal after you finish the i2c-assign function.

tarpn i2c-assign

This procedure is not necessary for the TARPN model TNCs unless they have crashed or been assigned an I2C address of 0.

tarpn i2c-assign 3    assigns I2C address 3 to an async TNC-PI

tarpn i2c-assign will not affect TNC-PIs already running with i2c-addresses.
tarpn i2c-assign with more than one unconfigured TNC-PI on the ribbon or in a stack will have unpredictable results -- don't do this.
tarpn i2c-assign with no unconfigured TNC-PI will not hurt anything, but will give you confusing error messages.
This command is not normally operable on a Raspberry PI 3 due to incompatibilities caused by the new BlueTooth feature. There is a work-around but that is out-of-scope for this article.

Procedure to assign an async TNC-PI to an I2C address.

TNC-PIs that have been reset to factory defaults will respond to the tarpn i2c-assign command but will not show up as having an i2c address.
You can use an ASYNC TNC-PI for some applications like APRS packet, but the TARPN node management requires that the TNCs are assigned to I2C addresses. This will permit us to have multiple TNC-PIs attached at one time.
First shutdown the Raspberry PI using tarpn shutdown. When the PI is fully down, no lights blinking for 5 seconds or so, remove power.
Attach a single TNC-PI to the Raspberry PI with the ribbon cable.
Power on the Raspberry PI.
Log into the PI and do the tarpn command. The node should not be set to auto and should not be running.

Now you are ready to assign an address to the TNC-PI.

Use the command tarpn i2c to read the I2C bus. Since there is only one TNC on the bus and it set for async operation, no i2C addresses should show up.
Use the command tarpn i2c-assign to give the TNC-PI an i2c address.
The legal range for an I2C address is 3 through 119. I suggest starting with address 3 for your first TNC and then move up to 4 for the next TNC etcetera.
So, use the command as so: tarpn i2c-assign 3
This will result in output that looks like this:

pi@nathan ~ $ tarpn i2c-assign 3
#### =TARPN v117 =
Assigning I2C address 3 decimal to the ASYNC TNC-PI.
Unfortunately there isn't much error checking on this.
If you see retrying messages, then this isn't working.
Perhaps in that case your TNC is not in ASYNC mode?

Do control-C now if this assigning an I2c Address is not your intent.
3
2
1
3 0 dc c a 0 0 0 8 1d c7 c0 sum 0

01 TXDelay - Zero means use ADC  00
02 Persistance                  220
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   03
   ADC Value                     29

done
now sending a RESET command to the TNC.  This may result in the command
getting stuck in a RETRY sequence.  That's ok.  Just do control-C followed
by sending a tarpn i2c  command to see what is on the i2c bus.  Your TNC-PI
should have been re-assigned.
retrying...
retrying...
retrying...
retrying...
retrying...
^C
pi@nathan ~ $ tarpn i2c
#### =TARPN v117 =
Scanning for attached TNC-PIs
note: Addresses found are shown in HEXADECIMAL.
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          03 -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- UU -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --  
In the above text output there are two tables showing results. The first table shows the visible registers for a TNC-PI. Some of the numbers shown will be different for your TNC. That data is the response from a GET registers sequence to the TNC.
We'll be seeing more of that table later.
The second table is the result of an i2c detection.

See Configure TNC-PI

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