This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Linux/AM5728: Using my GPIO

Part Number: AM5728

Tool/software: Linux

Hi, 

In my custom board, we use  pins of GPIO to output or input some information. I have modified the DTS by referring to community threads. For example, 

&gpio5{
    P5_3{                           /* gpio5-3, for input Power_monitor */
         gpio-hog;
         gpios = <3 GPIO_ACTIVE_HIGH>; 
         input;
         line-name = "PowerMonitor ";
    };
   P5_10{                         /* gpio5-10, connect to FPGA */
         gpio-hog;
         gpios = <10 GPIO_ACTIVE_HIGH>;
         output-high;
          line-name = "GPIO_FPGA";
    };
};

I also set pinmux mode in UBOOT.  When Linux has been started, I have seen the following related messages.

[ 0.486689] GPIO line 131 (PowerMonitor ) hogged as input
[ 0.486707] GPIO line 138 (GPIO_FPGA) hogged as output/high
.......

I have checked the output of GPIO5_10 is high level. Now I am wondering how can I control these two gpio in my application program. I am using SDK5.0 and the Linux kernel is 4.9.59. How can I read status of gpio5_3 ? How can I set low level for gpio5_10? and may I change the direction of gpio5_10 to input mode ?  

BTW, if I append these contents in DTS, the gpio export command will failed after Linux has been started. Please give some guide to help me operating these two gpios in my codes.

Best Regards,

Thanks!

Guan Qing 

  • guan said:
    BTW, if I append these contents in DTS, the gpio export command will failed after Linux has been started. Please give some guide to help me operating these two gpios in my codes.

    Guan Qing,

    I wanted to make sure that you had seen our GPIO Documentation here:

    http://software-dl.ti.com/processor-sdk-linux/esd/docs/05_01_00_11/linux/Foundational_Components_Kernel_Drivers.html#gpio

    Also, please make sure to set status = "okay" for the GPIO5 node in your DTS.

    guan said:
    BTW, if I append these contents in DTS, the gpio export command will failed after Linux has been started. Please give some guide to help me operating these two gpios in my codes.

    Can you please elaborate on this? If possible, could you please provide a full log of boot up and the appropriate GPIO commands so that we can see how they are failing? Please attach this as a file.

    BTW, if I append these contents in DTS, the gpio export command will failed after Linux has been started. Please give some guide to help me operating these two gpios in my codes.