Giter VIP home page Giter VIP logo

jtx1inst's Introduction

jtx1inst

A custom C API for instrumenting Jetson TX1’s SoM and SoC with the use of userspace I2C and sysfs files. This is small C library for accessing two Jetson TX1’s INA3221 – current and voltage monitors as well as on-module temperature sensors and other information such as GPU, CPUs and EMC operating frequencies – either through sysf nodes or userspace I2C. The current version has been tested on the Jetson TX1 module with a SKU 699-82180-1000-100 obtained with i2cdump -y -r 0x14-0x26 2 0x50 b command.

Build and install

In order to build and install the library and sample programs use the following commands.

mkdir build
cd build
cmake ..
make
sudo make install
sudo ldconfig

Run demo

cd build
watch -n 1 ./jtx1inst_demo -b
sudo watch -n 1 ./jtx1inst_demo -bm

Documentation

In order to generate documentation from sources annotated with Doxygen use the following command in doc directory.

cd doc
doxygen config
xdg-open html/files.html

License

This is free and unencumbered software released into the public domain. For more information, please refer to the LICENSE file.

jtx1inst's People

Contributors

cezs avatar fnoop avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

jtx1inst's Issues

make fails!

nvidia@tegra-ubuntu:/media/nvidia/2c6c5cb4-7ae8-4363-870e-b924ad98185a/jtx1inst/build$ sudo i2cdump -y -r 0x14-0x26 2 0x50 b
[sudo] password for nvidia:
0 1 2 3 4 5 6 7 8 9 a b c d e f 0123456789abcdef
10: 36 39 39 2d 38 32 31 38 30 2d 31 30 699-82180-10
20: 30 30 2d 31 30 30 20 00-100

SKU is same as @cezs 's
After doing 'cmake ..', make fails
Please help!

nvidia@tegra-ubuntu:/media/nvidia/2c6c5cb4-7ae8-4363-870e-b924ad98185a/jtx1inst/build$ make
[ 66%] Built target jtx1inst
[ 83%] Linking C executable jtx1inst_demo libjtx1inst.so: undefined reference to `i2c_smbus_read_word_data' collect2: error: ld returned 1 exit status CMakeFiles/jtx1inst_demo.dir/build.make:95: recipe for target 'jtx1inst_demo' failed make[2]: *** [jtx1inst_demo] Error 1 CMakeFiles/Makefile2:104: recipe for target 'CMakeFiles/jtx1inst_demo.dir/all' failed make[1]: *** [CMakeFiles/jtx1inst_demo.dir/all] Error 2 Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2

error: ‘voltage’ undeclared (first use in this function)

I keep getting the following error while I make.

/tx1Scripts/jtx1inst/build$ make
[ 16%] Building C object CMakeFiles/jtx1inst.dir/src/jtx1pow.c.o
/home/shafeeq/tx1Scripts/jtx1inst/src/jtx1pow.c: In function ‘jtx1_get_ina3221_userspace_i2c’:
/home/shafeeq/tx1Scripts/jtx1inst/src/jtx1pow.c:185:12: error: ‘voltage’ undeclared (first use in this function)
*val = voltage;
^
/home/shafeeq/tx1Scripts/jtx1inst/src/jtx1pow.c:185:12: note: each undeclared identifier is reported only once for each function it appears in
/home/shafeeq/tx1Scripts/jtx1inst/src/jtx1pow.c:193:12: error: ‘current’ undeclared (first use in this function)
*val = current;
^
/home/shafeeq/tx1Scripts/jtx1inst/src/jtx1pow.c:202:10: warning: ‘return’ with a value, in function returning void
return 0;
^
CMakeFiles/jtx1inst.dir/build.make:62: recipe for target 'CMakeFiles/jtx1inst.dir/src/jtx1pow.c.o' failed
make[2]: *** [CMakeFiles/jtx1inst.dir/src/jtx1pow.c.o] Error 1
CMakeFiles/Makefile2:104: recipe for target 'CMakeFiles/jtx1inst.dir/all' failed
make[1]: *** [CMakeFiles/jtx1inst.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2

Missing .gitignore

Project doesn't have .gitignore so build directory is included in changelist

Make error

Scanning dependencies of target jtx1inst
[ 16%] Building C object CMakeFiles/jtx1inst.dir/src/jtx1pow.c.o
[ 33%] Building C object CMakeFiles/jtx1inst.dir/src/jtx1temp.c.o
[ 50%] Building C object CMakeFiles/jtx1inst.dir/src/jtx1rate.c.o
/srv/maverick/var/build/jtx1inst/src/jtx1rate.c: In function ‘jtx1_get_rate’:
/srv/maverick/var/build/jtx1inst/src/jtx1rate.c:151:1: error: ‘o’ undeclared (first use in this function)
 o    default:
 ^
/srv/maverick/var/build/jtx1inst/src/jtx1rate.c:151:1: note: each undeclared identifier is reported only once for each function it appears in
/srv/maverick/var/build/jtx1inst/src/jtx1rate.c:151:6: error: expected ‘;’ before ‘default’
 o    default:
      ^
CMakeFiles/jtx1inst.dir/build.make:110: recipe for target 'CMakeFiles/jtx1inst.dir/src/jtx1rate.c.o' failed
make[2]: *** [CMakeFiles/jtx1inst.dir/src/jtx1rate.c.o] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/jtx1inst.dir/all' failed
make[1]: *** [CMakeFiles/jtx1inst.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2

make fails part 2

Related to #1

In file included from /usr/include/aarch64-linux-gnu/bits/byteswap.h:34:0,
                 from /usr/include/byteswap.h:24,
                 from /srv/maverick/var/build/jtx1inst/src/jtx1pow.c:17:
/srv/maverick/var/build/jtx1inst/src/jtx1pow.c: In function ‘convShuntVol’:
/srv/maverick/var/build/jtx1inst/src/jtx1pow.c:43:27: warning: implicit declaration of function ‘i2c_smbus_read_word_data’ [-Wimplicit-function-declaration]
   uint16_t v = __bswap_16(i2c_smbus_read_word_data(file, reg));
                           ^
/srv/maverick/var/build/jtx1inst/src/jtx1pow.c: In function ‘jtx1_get_ina3221_userspace_i2c’:
/srv/maverick/var/build/jtx1inst/src/jtx1pow.c:173:7: warning: implicit declaration of function ‘ioctl’ [-Wimplicit-function-declaration]
   if (ioctl(file, I2C_SLAVE, addr) < 0) {
       ^~~~~
/srv/maverick/var/build/jtx1inst/src/jtx1pow.c:203:10: warning: ‘return’ with a value, in function returning void
   return 0;

...

[100%] Linking C executable jtx1inst_demo
libjtx1inst.so: undefined reference to `i2c_smbus_read_word_data'
collect2: error: ld returned 1 exit status
CMakeFiles/jtx1inst_demo.dir/build.make:95: recipe for target 'jtx1inst_demo' failed
make[2]: *** [jtx1inst_demo] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/jtx1inst_demo.dir/all' failed
make[1]: *** [CMakeFiles/jtx1inst_demo.dir/all] Error 2
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2

If I install libi2c-dev and include i2c/smbus.h in src/jtx1pow.c it gets rid of the implicit declaration but still doesn't link.

Measurement problem ?

How can you get the following power value with the associated voltage and current?
[POWER] module power input: 3898.000mW

[CURRENT] module power input: 3860.000mA

[VOLTAGE] module power input: 3438.000mV

Since P = U x I, power should be 3.86 x 3.438 = 13,3 W

You also write:
[VOLTAGE] main carrier board 5V supply: 19112.000mV
[VOLTAGE] main carrier board 3.3V supply: 4976.000mV

Does that mean 5V = 19V or that there is overvoltage?

Does this have anything to do with the module version? From the Nvidia forums:

The feature to enable use of INA monitors was added starting with revision 300 of Jetson TX1. For example, SKU 699-82180-1000-300 (note the "-300") has the feature.

cmake ignores -DCMAKE_INSTALL_RPATH

If altering the destination install directory with -DCMAKE_INSTALL_PREFIX, sample binary doesn't run because -DCMAKE_INSTALL_RPATH is ignored, so no path to library.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.