Afe2401 i2c tools and gcc examples for Orange/Raspberry Pi, BBB etc.
===================================================================
$Id: readme.txt 160 2021-04-08 08:35:02Z mayer $
Created: 2021-04-08 
Contact: info@j-2.se, patrik.arven@j-2.se
Author: J2 Holding AB

Installation:
=============
This has been tested with Armbian.

Enable i2c0 by starting 
armbian-config
Choose System, Hardware, enable i2c-0. Reboot.

Attach the afe2401. Be careful with SDA which is close to VIN. 
It is preferred to have a ferrite clamp over the SCL/SDA/GND to the Orange Pi.

Test the connection:

root@orangepizero:~# i2cdetect -y 0
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- 34 -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --

(Note:34 is the afe2401).



Copy the C files to the Orange Pi, then (as root):
make clean
make all

To use:
=======
tsync
Syncs time to AFE2401

sdump
Selects status screen and dumps some registers and time.

pi <p> <i>
Sets PI parameters. Default 251 700.

tset <T>
Selects screen 20 (temp) and sets temperature <T>/100 and start regulation if <T> >2000.

drain <n> <mv>
Sets drain voltage <n>=1,2 to voltage <mv>

tlist <csv list of time(to wait, s),temp(C*100)>
cycles temperature and outputs
<time_ms> <temp> <drain1> <drain2>

Example:
./tlist 1,15000,20,20000,20,30000,20,0

