Raspberry Pi I2C Support

146 views
Skip to first unread message

Todd Kolmodin

unread,
Jul 3, 2019, 11:43:57 PM7/3/19
to Aprx software
Hello all,
I searched for this topic but did not see anything specific regarding the I2C Bus.  I have Pi-3s that run stacked TNC-Pi TNCs from Coastal Chipworks. However I can only run APRX on one of the TNCs as it is running on the serial bus.  To run stacked TNC-Pis you have to run them on the I2C bus.  So right now I cannot run two transmitters on the PI with APRX as I don't see we have support for the I2C bus as of yet.  If I am missing the answer  posted somewhere else, please send me in that direction with my sincere apologies. 
73, Todd N7TRY
SHERWD APRS Digipeater
Sherwood OR (APRX39)

Jason Buchanan

unread,
Jul 4, 2019, 12:20:52 AM7/4/19
to aprx-s...@googlegroups.com
hi - 

I have a TNC-Pi - works great.

You have to configure the TNC-Pi to use I2C and you can only do this with one TNC-Pi connected to the Raspberry Pi.  

Here's what I used to move from serial to I2C:


./pitnc_getparams 0 0       # view parameters

./pitnc_setparams 0 0 7 16  # set tnc-pi to address 16 (10 hex)

./pitnc_setparams 0 0 15 2  # reboot tnc-pi


# board should now be readable on i2c bus at address 16 /dev/i2c-1

./pitnc_getparams 1 16


# I pull the power cord from the Rasbperry Pi to fully test the configuration

poweroff



Adjust TXDelay and other values as needed:


./pitnc_setparams 1 16 1 32 # TXDelay 32 - this is radio-specific

./pitnc_getparams 1 16      # view parameters




Hope this helps.

73 Jason N1SU



--
You received this message because you are subscribed to the Google Groups "Aprx software" group.
To unsubscribe from this group and stop receiving emails from it, send an email to aprx-softwar...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/aprx-software/56322039-c559-4a79-8891-8f9fc739464d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jason Buchanan

unread,
Jul 4, 2019, 12:23:40 AM7/4/19
to aprx-s...@googlegroups.com
forgot to mention - each TNC-Pi needs to be on a unique address - you can't put them all on address 16.

Take a look at http://tarpn.net/t/builder/builders_configure_tnc_pi.html - more details there.

Jason Buchanan

unread,
Jul 4, 2019, 12:26:16 AM7/4/19
to aprx-s...@googlegroups.com
... and after you configure each board to be on a unique address you can stack them all back together - it's only when moving them from serial to I2C that you have to have only one board connected.  After they each have a unique address you can reconnect them all back in a stack.

Todd Kolmodin

unread,
Jul 4, 2019, 12:51:05 AM7/4/19
to aprx-s...@googlegroups.com
Thanks Jason. I am familiar with switching the TNC-Pi between Serial and I2C.  I'm just trying to find out the syntax that would be used
in the aprx.conf for the interfaces.  If I set my two Pis to I2C Bus 1, Devices 16 and 17, how to I call them correctly in aprx interfaces?
73, Todd

On Wed, Jul 3, 2019 at 9:20 PM Jason Buchanan <jason.b...@gmail.com> wrote:

Jason Buchanan

unread,
Jul 4, 2019, 8:17:08 AM7/4/19
to aprx-s...@googlegroups.com
Got it - I use ax25.

$ cat /etc/ax25/axports 

# /etc/ax25/axports

#

# The format of this file is:

#

# name callsign speed paclen window description

#


1 N1SU-3 19200 255 2 TNCX



A snippet of my /etc/aprx.conf:

mycall  N1SU-3


. . .

 <interface>

     ax25-device  $mycall

     tx-ok        true

     telem-to-is  true

 </interface>

 <digipeater>

     transmitter    $mycall

     <source>

         source         $mycall

         relay-type     digipeated

         viscous-delay  5

         ratelimit      60 120

     </source>

     <source>

         source         APRSIS

         relay-type     third-party

         viscous-delay  5

         msg-path WIDE2-2 # gate TX with 2 hops for messages

         via-path WIDE1-1 # gate TX with 1 hop for everything else

     </source>

 </digipeater>


I have some regex-filters and other stuff but these are the highlights.  I use msg-path to help propagate messages for delivery - it improves the "quality of life" for message senders/receivers.


This is what I use to start the interface and aprs as a systemd service:

$ cat aprx_start 


axup=$(ifconfig -a | grep flags | awk -Fflags '{print $1}' | grep ax0)

if [[ -z $axup ]];

 then

  echo "ax0 does not exist - attempting to create it"

  /usr/local/bin/i2ckiss 1 16 1 10.1.1.1

 fi


mkdir -p /var/log/aprx

sudo /usr/sbin/aprx -i



I did a lot of tweaking to reduce writes to the SD card - /var/log is a small 50M mount against tmpfs and I create the log directory for use across reboots.

The start script is used to create the ax0 interface used by aprx.


thanks,
Jason



Reply all
Reply to author
Forward
0 new messages