tarpn_logo
 home    builders    Search

buildersTNC‑PIConfigure TNC‑PI ➜ Async to I2C

The TNC-PI is discontinued. Support for TNC-PI is no longer expected to work on Raspberry PIs set up for TARPNs.

The TARPN project created the NinoTNC as a replacement for the TNC-PI. NinoTNC is easier to build (as a kit), more powerful, easier to configure, easier to operate.

I'm leaving these TNC-PI pages intact, but the tools and commands referenced here only exist because they didn't get in the way, much. Some elements will disappear from the TARPN tools over the next several years.

Please check out the NinoTNC at TARPN hardware projects documentation.

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.

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‑PI attached at one time.

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 assigns I2C address 9 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 works slightly differently on modern Raspberry PI (version 3 or later) and you have to pay attention to what is printed in response to the command.

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

Shutdown the node software and turn off the node background execution. tarpn service stop and tarpn kill. Verify the node is off by using the tarpn command. The node should not be set to auto and should not be running.

Unplug all of the TNC‑PI from the Raspberry PI except the one you want to work on. If you have to plug or re-plug a TNC‑PI or the Raspberry PI ribbon cable, be very careful to not plug the ribbon in backwards or offset by a pin or row. This is where Raspberry PIs get damaged.
Do the tarpn i2c command and observe the address table to see if your TNC‑PI shows up.

pi@somenode ~ $ tarpn i2c
#### =TARPN vs036
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:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- UU -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --  
If a TNC‑PI is working, and you see its address under the 0 1 2 3 4, then the TNC‑PI already has an I2C address. The tarpn assign command won't affect a TNC‑PI that already has an I2C address. However, one of the issues with the TNC‑PI, which doesn't happen very often, may be fixed by forcing it into Async mode and then putting it back into I2C address mode. More on that on Builders: ConfigureTNC‑PI.

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

On a Raspberry PI 2 or older, the Raspberry PI will assign address 9 to the TNC‑PI, will read back the registers from the TNC‑PI, and will then read the table of I2C addresses and display it.
See For Raspberry PI 2 and older below in this web page.


For Raspberry PI 3 and newer

Use the command as so: tarpn i2c-assign
In a Raspberry PI 3 or newer, this will result in output that looks like this:
pi@somenode ~ $ tarpn i2c-assign
#### =TARPN vs036 =
NOTICE!!!

I2C-ASSIGN is interesting on a Raspberry PI 3.  The assign process requires
the Bluetooth system to be disabled.  This program will now do that and then
will restart.  When the Raspberry PI comes up, you should log in and then type
        tarpn finish-i2c
at which point your assign will completed and the Raspberry PI
will reboot, restoring Bluetooth
After the Raspberry PI reboots, log in and do
        tarpn i2c
Hopefully that takes care of it.

If this is NOT what you want, do a Control C  on your terminal right now to stop this.
If this is NOT what you want, do a Control C  on your terminal right now to stop this.
If this is NOT what you want, do a Control C  on your terminal right now to stop this.
 ?
 ?
 ?
 ?
 ?
 ?
If this is NOT what you want, do a Control C  on your terminal right now to stop this.
 ?
       .... Proceeding with Bluetooth Disable and REBOOT
Connection to 192.168.0.32 closed by remote host.
Connection to 192.168.0.32 closed.
Macintosh:~ fred$
 
The Raspberry PI can be seen to reboot.
I use Terminal or Putty to reconnect to the Raspberry PI and then type tarpn finish-i2c.
Macintosh:~ fred$ ssh [email protected] 
Tadd-Mac-Mini:~ tadd$ ssh [email protected]
[email protected]'s password:
Linux somenode 4.9.56-v7+ #1044 SMP Fri Oct 13 15:23:13 BST 2017 armv7l

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Mon May 13 16:17:49 2019
pi@somenode ~ $ tarpn finish-i2c
#### =TARPN vs036 =
  Finishing moving TNC-PI to I2C address 9
  If this function results in a continuous retrying, you should
     do a control-C to break out of the retry and then try tarpn i2c.
If tarpn i2c shows an 09 as an active address, then all is well.
At that point you should do a tarpn reboot to finish the process, automatically
re-enabling Bluetooth.

  If tarpn i2c did not show 09, then try tarpn finish-i2c a second time.

Failing success a 2nd time, do tarpn reboot      but next,
turn the TXDELAY potentiometer all the way to the left (counter clockwize).
  Remove and then reapply power (ribbon cable) to the TNC-PI.
  The TNC-PI should blink it's TX and DCD lights over and over again.
  Remove power, set the TXDELAY to middle, and apply power again.
  This will have erased the TNC-PI's NVmemory and restored defaults.

 Now do the tarpn i2c-assign process over again.
  If that still doesn't work, it may be time to send emails and complain.

Starting move of TNC-PI to I2C address 9 now,
------ A good end would be that the Raspberry PI reboots.

retrying...
retrying...
retrying...
retrying...
retrying...
retrying...
retrying...
retrying...
retrying...
retrying...
retrying...
^C                                              <<‐ Here I did a control C
                                                and I type tarpn finish-i2c at the prompt
pi@somenode ~ $ tarpn finish-i2c
#### =TARPN vs036 =
  Finishing moving TNC-PI to I2C address 9
  If this function results in a continuous retrying, you should
     do a control-C to break out of the retry and then try tarpn i2c.
If tarpn i2c shows an 09 as an active address, then all is well.
At that point you should do a tarpn reboot to finish the process, automatically
re-enabling Bluetooth.

  If tarpn i2c did not show 09, then try tarpn finish-i2c a second time.

Failing success a 2nd time, do tarpn reboot      but next,
turn the TXDELAY potentiometer all the way to the left (counter clockwize).
  Remove and then reapply power (ribbon cable) to the TNC-PI.
  The TNC-PI should blink it's TX and DCD lights over and over again.
  Remove power, set the TXDELAY to middle, and apply power again.
  This will have erased the TNC-PI's NVmemory and restored defaults.

 Now do the tarpn i2c-assign and finish-i2c process and steps over again.
  If that still doesn't work, it may be time to send emails and complain.

Starting move of TNC-PI to I2C address 9 now,
------ A good end would be that the Raspberry PI reboots.


   PIC Software Version          30
01 TXDelay - Zero means use ADC   1
02 Persistance                    0
03 Slottime (in 10 mS)            0
04 TXTail                         9
05 Full Duplex - Not used        45
06 Our Channel (Hex)             d3
07 I2C Address (0 = async) Hex   c0
   ADC Value                      0
e1 1e 1 0 0 9 2d d3 c0 sum 9
** Checksum Error - Sum = 9 Should be Zero

     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- 09 -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
 ...  Going to reboot the Raspberry PI now.
Connection to 192.168.0.32 closed by remote host.
Connection to 192.168.0.32 closed.
Macintosh:~ fred$ 
The Raspberry PI rebooted for the 2nd time.

We've been logged out of the Raspberry PI and disconnected back to the workstation.
Again I connect to the Raspberry PI and type tarpn.

Macintosh:~ fred$ ssh [email protected]
[email protected]'s password:
Linux somenode 4.9.56-v7+ #1044 SMP Fri Oct 13 15:23:13 BST 2017 armv7l

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Sun May 12 19:59:29 2019
pi@somenode ~ $ tarpn
#### =TARPN vs036 =
##### BPQ node is NOT running. BPQ node background Service STOPPED
##### TARPN HOME is NOT running. TARPN HOME is set to START
##### Raspberry PI is a >>>  type 3 B  --bluetooth/wifi  <<<
##### OS version is "Raspbian GNU/Linux 9 (stretch)"
##### Ethernet MAC=b8:27:eb:0a:90:93   CPU temp=54.8'C   SDcard=1532802180
#####   Use tarpn help     for subcommand list.
pi@somenode ~ $
Let's see if the TNC‑PI shows up now. Do a tarpn i2c command to see the address table.
pi@somenode ~ $ tarpn i2c
#### =TARPN vs036 =
Scanning for attached TNC‑PI
note: Addresses found are shown in HEXADECIMAL.
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- 09 -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
pi@somenode ~ $
The response from the tarpn i2c command is the table showing all i2c addresses. This result shows that your TNC‑PI has been put back on the I2C bus at address 9. You can now use the tarpn i2c-set command to change the i2C address of the TNC‑PI as necessary.

See Builders: Configure TNC‑PI

 


 

For Raspberry PI 2 and older

Use the command as so: tarpn i2c-assign
This will result in output that looks like this:
pi@somenode ~ $ tarpn i2c-assign
#### =TARPN vs036 =
Assigning I2C address 09 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‑PI 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   09
   ADC Value                     29

done
now sending a RESET command to the TNC‑PI.  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@somenode ~ $ tarpn i2c
#### =TARPN vs036 =
Scanning for attached TNC‑PI
note: Addresses found are shown in HEXADECIMAL.
     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 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‑PI. That data is the response from an i2c-get registers sequence to the TNC‑PI.
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↝2022 -- all rights reserved