This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Unable to Access i2c port using wiringPI library
#11
It's basically how is written on wiki pages. But for Android Nougat it is not updated.
https://tinkerboarding.co.uk/wiki/index....0.1_kernel
You need to download either
https://github.com/TinkerBoard/android-6.0.1_kernel.git
or
https://github.com/TinkerBoard/android-7.1.2_kernel.git
and compile the kernel.
Find
Code:
arch/arm/boot/dts/rk3288-miniarm.dts
and change or delete the entries you find under &i2c1.
Then compile again.
You will get a kernel.img and a resource.img. The devicetree resides in the resource.img, that you need to flash to the TB.
You can use the dd method for that, but I am not sure that the addresses are the same on Nougat.
I recommend to use rkflashtool. With dd you can easily destroy the partition of the sdcard.
For rkflashtool you must bring the TB into bootloader mode and then you can flash like this:
Code:
sudo ./rkflashtool w resource < resource.img
Hope this helps.
Reply
#12
Hi Lobo,

       Thank for you response,
       
        I followed the below post for Compiling Tinker Board Android . 
        tinkerboarding.co.uk/forum/thread-1865-page-7.html

        Able to do the Repo init and sync it.   

       
Code:
 
repo init -u https://bitbucket.org/TinkerBoard_Android/manifest.git -b sbc/tinkerboard/asus/Android-6.0.1
repo sync -j4 -c -q   
       
 
      
       Able to do the build envsetup and lunch the rk3288- userdebug  
       
Code:
       source build/envsetup.sh
       lunch rk3288-userdebug
       
       
       able to do compiling the kernel make ARCH=arm rockchip_defconfig is done 
       when we try to  compile the kernel  make ARCH=arm rk3288-miniarm.img -j4.
       We Observed the error as follows
       
Code:
b'arch/arm/kernel/return_address.c:63:2: warning: #warning "TODO: return_address should use unwind tables" [-Wcpp]\n'   CC      fs/open.o
Traceback (most recent call last):
  File "/home/krishna_ubuntu/BEABLE/TB/kernel/scripts/gcc-wrapper.py", line 107, in <module>
    status = run_gcc()
  File "/home/krishna_ubuntu/BEABLE/TB/kernel/scripts/gcc-wrapper.py", line 93, in run_gcc
    interpret_warning(line)
  File "/home/krishna_ubuntu/BEABLE/TB/kernel/scripts/gcc-wrapper.py", line 63, in interpret_warning
    line = line.rstrip("\n")
TypeError: a bytes-like object is required, not 'str'
make[1]: *** [scripts/Makefile.build:308: arch/arm/kernel/return_address.o] Error 1
make: *** [Makefile:829: arch/arm/kernel] Error 2
make: *** Waiting for unfinished jobs....
         

     
   
                   
        how to solve the above error, please help out me 

Thanks,
Krishna.
Reply
#13
I cannot help with this. Why you try to compile the whole Android? Only for changing the devicetree? If you want to change the devicetree, compile the kernel as I recommended. It's easier.
Reply
#14
Hi Lobo,

       thanks a lot for needful information.

       it is to inform you that I downloaded the provided link from your previous post 
       https://github.com/TinkerBoard/android-6.0.1_kernel.git


       And tried to compile the Kernel but I got the following error:

        
Code:
krishna_ubuntu@DESKTOP-REJBA9E:~/BEABLE/Kernel_6_0_1/android-6.0.1_kernel$ make rk3288-miniarm.img -j4
 CHK     include/generated/uapi/linux/version.h
 CHK     include/generated/utsrelease.h
 CC      scripts/mod/empty.o
b'gcc: error: unrecognized argument in option \xe2\x80\x98-mabi=aapcs-linux\xe2\x80\x99\n'   CC      scripts/mod/devicetable-offsets.s
make[1]: 'include/generated/mach-types.h' is up to date.
b'gcc: error: unrecognized argument in option \xe2\x80\x98-mabi=aapcs-linux\xe2\x80\x99\n'   CC      kernel/bounds.s
b'gcc: error: unrecognized argument in option \xe2\x80\x98-mabi=aapcs-linux\xe2\x80\x99\n' Traceback (most recent call last):
 File "/home/krishna_ubuntu/BEABLE/Kernel_6_0_1/android-6.0.1_kernel/scripts/gcc-wrapper.py", line 110, in <module>
   status = run_gcc()
 File "/home/krishna_ubuntu/BEABLE/Kernel_6_0_1/android-6.0.1_kernel/scripts/gcc-wrapper.py", line 96, in run_gcc
   interpret_warning(line)
 File "/home/krishna_ubuntu/BEABLE/Kernel_6_0_1/android-6.0.1_kernel/scripts/gcc-wrapper.py", line 65, in interpret_warning
   line = line.rstrip('\n')
TypeError: a bytes-like object is required, not 'str'
make[2]: *** [scripts/Makefile.build:309: scripts/mod/empty.o] Error 1
make[2]: *** Waiting for unfinished jobs....
Traceback (most recent call last):
 File "/home/krishna_ubuntu/BEABLE/Kernel_6_0_1/android-6.0.1_kernel/scripts/gcc-wrapper.py", line 110, in <module>
   status = run_gcc()
 File "/home/krishna_ubuntu/BEABLE/Kernel_6_0_1/android-6.0.1_kernel/scripts/gcc-wrapper.py", line 96, in run_gcc
   interpret_warning(line)
 File "/home/krishna_ubuntu/BEABLE/Kernel_6_0_1/android-6.0.1_kernel/scripts/gcc-wrapper.py", line 65, in interpret_warning
   line = line.rstrip('\n')
TypeError: a bytes-like object is required, not 'str'
make[2]: *** [/home/krishna_ubuntu/BEABLE/Kernel_6_0_1/android-6.0.1_kernel/scripts/mod/Makefile:35: scripts/mod/devicetable-offsets.s] Error 1
make[1]: *** [scripts/Makefile.build:455: scripts/mod] Error 2
make: *** [Makefile:539: scripts] Error 2
make: *** Waiting for unfinished jobs....
Traceback (most recent call last):
 File "/home/krishna_ubuntu/BEABLE/Kernel_6_0_1/android-6.0.1_kernel/scripts/gcc-wrapper.py", line 110, in <module>
   status = run_gcc()
 File "/home/krishna_ubuntu/BEABLE/Kernel_6_0_1/android-6.0.1_kernel/scripts/gcc-wrapper.py", line 96, in run_gcc
   interpret_warning(line)
 File "/home/krishna_ubuntu/BEABLE/Kernel_6_0_1/android-6.0.1_kernel/scripts/gcc-wrapper.py", line 65, in interpret_warning
   line = line.rstrip('\n')
TypeError: a bytes-like object is required, not 'str'

    So, I request you to kindly help us to overcome the above issue.
    please suggest corrections if any.

Thank you,
Krishna.
Reply
#15
Have you downloaded a right toolchain for cross compiling the kernel?
I used this time ago: https://releases.linaro.org/components/t.../arm-eabi/
A newer one might work also. I used this for AMD 64bit Linux: x86_64
Then after unzip the toolchain you should tell where the compiler can be found, in the shell at root of the kernel source:
Code:
export CROSS_COMPILE=/path/to/toolchain/gcc-linaro-4.9.4-2017.01-x86_64_arm-eabi/bin/arm-eabi-
Then:
Code:
export ARCH=arm
make rockchip_defconfig
make -j8 rk3288-miniarm.img
I do not doing something else. When you face this errors you have, then might be that your PC is not set up right.
When you think you have used the wrong arch or the wrong toolchain then clean the source code or download it again.
Reply
#16
Hi Lobo,

     Thanks a lot for your support.

     I followed the steps given by you and it worked for me.

     
Code:
root@rk3288:/ # i2cdetect -y 1
    0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:                         08 09 0a 0b 0c 0d 0e 0f
10: 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f
20: 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f
30: -- -- -- -- -- -- -- -- 38 39 3a 3b 3c 3d 3e 3f
40: 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f
50: -- -- -- -- -- -- -- 57 -- -- -- -- -- -- -- --
60: 60 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f
70: 70 71 72 73 74 75 76 77

   As far now we are able to access the I2C-1 slave address 0x68 for this RTC Module.
   Thank you very much for your needful support.
   Further, if any problem occurs, I will seek your help.

Thanks & Regards,
Krishna.
Reply
#17
(08-17-2020, 02:59 PM)lobo Wrote: Maybe you can see this way, if a driver is already mapped to this address:
Code:
ls /sys/bus/platform/devices/ff650000.i2c/i2c-0/0-001b                         <
driver   name    power     rk808-clkout    rk808-rtc uevent
modalias of_node regulator rk808-regulator subsystem
Note, this is for i2c-0 where the rk808 i2c device 0x1b is, and you can see that rk808-clkout, rk808-rtc and rk808-regulator drivers are mapped to it. As this is also described in the devicetree.
For the i2c-1 device 0x68 you would list like this:
Code:
ls /sys/bus/platform/devices/ff140000.i2c/i2c-1/0-0068
I see in my devicetree that there is a DS3231 driver for that address, but I don't remember if I put this years ago, or it is there from Asus. Maybe it is there from Asus, than it would explain, that this address is used and you would need to change the devicetree.

It would be great to add more information about it. I mean in detail because beginners can't understand with it.
Reply
#18
After half a day of hard work and studies, I was able to read from i2c, specifically from the IR camera MLX90614.

I used wiringPI for tinkerboard for android 7.1.2:
https://github.com/joerg65/wiringTinker_7.1.2

This is my test code. Enjoy!!


Code:
#include <wiringPi.h>
#include <stdio.h>
#include <wiringPiI2C.h>
#include <errno.h>

int main(void)
{
  char rd = 0;
  wiringPiSetup() ;
  int dev = wiringPiI2CSetup(0x5A);
  int i=0;
  printf ("dev id = %d\n",dev);
 
  while(1)
  {
 
 short r0 = wiringPiI2CReadReg16(dev, 0x06);
 
 short r1 = wiringPiI2CReadReg16(dev, 0x07);
 
 if(r0 > 0 && r1 > 0)
 {
 double temp0 = (double) r0;
 double temp1 = (double) r1;
 
 
 printf("temp0: %f\n", temp0);
 printf("temp1: %f\n", temp1);

 temp0 = (temp0 * 0.02)-0.01;
 temp0 = temp0 - 273.15;
 
 temp1 = (temp1 * 0.02)-0.01;
 temp1 = temp1 - 273.15;
 
 printf("temp0: %f\n", temp0);
 printf("temp1: %f\n", temp1);
 }
 

 printf("----------------\n");
   
     delay(100);
  }

return 0;
}
[-] The following 1 user Likes ugos's post:
  • Tinker Board
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)