Jump to content

yi-hsin_hung

Tinker Engineer
  • Content Count

    28
  • Joined

  • Last visited

  • Days Won

    3

Posts posted by yi-hsin_hung


  1. Hi @JulianR:

         This is the linux common functions. Need to echo the pin number to export and then show the gpio$number in the path.

    Please reference the following website link and reference sample. Thank a lot!

    --->  Website link for GPIO Programming: Using the sysfs Interface

    https://www.ics.com/blog/gpio-programming-using-sysfs-interface

    ---> Examples

    1. GPIO input control example

     

    0, 8 GPIO: /sys/class/gpio/gpio8   TEST_CLKOUT2 GPIO0_B0 7

    * Console command:

    - Export the GPIO pin

    echo 8 > /sys/class/gpio/export
    

    - Set the GPIO pin to input mode

    echo in > /sys/class/gpio/gpio8/direction
    

    - Read input value:

    cat /sys/class/gpio/gpio8/value

     

    1. GPIO output control example

     

    0, 8 GPIO: /sys/class/gpio/gpio8   TEST_CLKOUT2 GPIO0_B0 7

    * Console command:

    - Export the GPIO pin

    echo 8 > /sys/class/gpio/export
    

    - Set the GPIO pin to output mode

    echo out > /sys/class/gpio/gpio8/direction

    - Set value to GPIO pin:

    echo 1 >  /sys/class/gpio/gpio8/value

    - Read the GPIO value

    cat /sys/class/gpio/gpio8/value

  2. @Albertortor00

              Please reference following information. Thank a lot!

    sudo i2cdetect -y 1 

    sudo i2cdetect -y 2

    --> Tinker Board 2S should use the following command for i2c 6 and 7

    sudo i2cdetect -y 6

    sudo i2cdetect -y 7

    And the others to 9, but on mi /dev/ directory, doesn't exist 6, or 7... (like you say on your post)

    --> Could you help to reference the following information to enable i2c 6 and 7 

    https://github.com/TinkerBoard/TinkerBoard/wiki/Developer-Guide#tinker-board-2-on-debian-os

    WiringPi C library for Debian (Tinker Board 2S)

    I2C WiringPi for C library for Debian

    • Firstly, modify the /boot/config.txt file as following and then reboot to enable I2C6 (wiringPi only support 1 I2C interface).
    ##### Hardware Interface Config #####
    
    ## Note: uart4 and spi1 are the same pins. Set the latter one while both on. ##
    
    intf:fiq_debugger=on
    #intf:uart0=off
    #intf:uart4=off
    intf:i2c6=on
    #intf:i2c7=off
    #intf:i2s0=off
    #intf:spdif=off
    #intf:spi1=off
    #intf:spi5=off
    #intf:pwm0=off
    #intf:pwm1=off
    #intf:pwm3a=off
    #intf:test_clkout2=off

  3. Hi doggedly:

        The following red parts pin are for I2S so that you can't control the pins by gpio ways because the hdmi audio card need the pins.

    Thank a lot!

     

    126   I2S0_SDO1 GPIO3_D6 29   30   GND    
    125   I2S0_SDO2 GPIO3_D5 31   32 GPIO4_C2 PWM0   146
    150   PWM1 GPIO4_C6 33   34   GND    
    121   I2S0_FS GPIO3_D1 35   36 GPIO2_C2 UART0_CTSN   82
    149   SPDIF_TX GPIO4_C5 37   38 GPIO3_D3 I2S0_SDI0   123
        GND   39   40 GPIO3_D7 I2S0_SDO0   127
    • Like 1

  4. Hi doggedly:

    Please reference the following table for Tinkerboard 2. If you have any problem, please let us know! 

     

    GPIO number Function2 Function1 GPIO Pin#   Pin# GPIO Function1 Function2 GPIO number
        VCC3.3V_IO   1   2   VCC5V_SYS    
    73   I2C6_SDA GPIO2_B1 3   4   VCC5V_SYS    
    74   I2C6_SCL GPIO2_B2 5   6   GND    
    8   TEST_CLKOUT2 GPIO0_B0 7   8 GPIO2_C1 UART0_TXD   81
        GND   9   10 GPIO2_C0 UART0_RXD   80
    83   UART0_RTSN GPIO2_C3 11   12 GPIO3_D0 I2S0_SCLK   120
    85   SPI5_TX GPIO2_C5 13   14   GND    
    84   SPI5_RX GPIO2_C4 15   16 GPIO2_C6 SPI5_CLK   86
        VCC3.3V_IO   17   18 GPIO2_C7 SPI5_CSN   87
    40 UART4_TXD SPI1_TXD GPIO1_B0 19   20   GND    
    39 UART4_RXD SPI1_RXD GPIO1_A7 21   22 GPIO3_D4 I2S0_SDO3   124
    41   SPI1_CLK GPIO1_B1 23   24 GPIO1_B2 SPI1_CSN   42
        GND   25   26 GPIO0_A6 PWM3A_IR   6
    71   I2C7_SDA GPIO2_A7 27   28 GPIO2_B0 I2C7_SCL   72
    126   I2S0_SDO1 GPIO3_D6 29   30   GND    
    125   I2S0_SDO2 GPIO3_D5 31   32 GPIO4_C2 PWM0   146
    150   PWM1 GPIO4_C6 33   34   GND    
    121   I2S0_FS GPIO3_D1 35   36 GPIO2_C2 UART0_CTSN   82
    149   SPDIF_TX GPIO4_C5 37   38 GPIO3_D3 I2S0_SDI0   123
        GND   39   40 GPIO3_D7 I2S0_SDO0   127
×
×
  • Create New...