• Recent
    • Docs
    • Github
    • 百度网盘
    • Onedrive
    • Official
    • Shop
    • Register
    • Login

    CoolPi 4B硬件扩展四:GPIO

    Scheduled Pinned Locked Moved Hardware
    19 Posts 4 Posters 1.8k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Z
      zensation @george
      last edited by

      @george ok George where can i find this file to modify?

      1 Reply Last reply Reply Quote 0
      • Z
        zensation @george
        last edited by

        @george and can i do the same thing with an overlay in the config.txt or something? if so how? thx

        G 1 Reply Last reply Reply Quote 0
        • G
          george @zensation
          last edited by

          @zensation
          Software modification pull-down:

          • specifies that the default pull-down of GPIO needs to be modified in the kernel DTS file, path:/arch/arm64/boot/dts/rockchip. After the modification is completed, compile and generate a DTB file, and then replace it.

          Hardware modification pull-down:

          • You can change the default pull-down situation of IO by connecting a pull-down resistor to GPIO. The default pull-up change is to connect a 2K resistor to the GND network, and the default pull-down change is to connect a 4.7K resistor to a 3.3V power supply.
          Z 1 Reply Last reply Reply Quote 0
          • Z
            zensation @george
            last edited by

            @george thanks for the info george...i tried adding a 2k resistor to ground on pin 32 to change it to change it from pull up to pull down as you mentioned, however that does not work and the pin voltage on 32 reads 1.034 volts. ill try other values of resistors and report which one works.

            G 1 Reply Last reply Reply Quote 0
            • G
              george @zensation
              last edited by george

              @zensation
              If you need to use PWM function, it is recommended to use PIN12 (PWM3-M3). This port defaults to the pull-up port, and you can increase the resistance to ground by 2K. The default level can be reduced to below 0.6V. If you need GPIO function, except for PIN3 PIN5 PIN32 PIN40 PIN8 PIN10, all other IOs can use pull-down resistors to change the default level.
              22b20546-a88f-4284-b2d4-b4f5bdea548f-image.png

              Z 3 Replies Last reply Reply Quote 0
              • Z
                zensation @george
                last edited by

                @george ok this explains things better. I have a HAT that was designed for the raspberry pi 4 and it has a power detection pin on pin 32. it needs to be pulled down in order to function because the hat sends 3.3v to the pin as long as incoming power is detected on the power in lines of the HAT. then when the incoming power dissapears from the hat incoming lines, pin 32 will be pulled low by the pull down resistor and the pi can execute some code. If i can figue out how to edit the dts file and recompile to dtb to change pin 32 to an internal pull down resistor i will do it that way. otherwise i guess i am stuck.

                1 Reply Last reply Reply Quote 0
                • Z
                  zensation @george
                  last edited by

                  @george so here is where I am at. Ive spent a lot of time trying to figure this out but nothing is making sense so maybe you can give me a direct file of what will work. I have done this:

                  1. navigate to folder of rk3588s-cp4.dtb (/boot/firmware/rk3588s-cp4.dtb)
                  2. converted the dtb file to dts file using command: sudo dtc -I dtb -O dts rk3588s-cp4.dtb -o rk3588s-cp4.dts
                  3. nano to open the file: sudo nano rk3588s-cp4.dts

                  heres where im stuck...theres nothing in that file that resembles the syntax you have sent me. I will attach the dts file in txt format here. can you edit it with the correction to change pin 32 from pull up to pull down? thanks!
                  rk3588s-cp4.txt

                  alternatively, on line 1562 i find there is an entry for wake from suspend such as below.

                  rockchip,wakeup-config = <0x100>;

                  can you tell me how to change this line to enable GPIO wake from suspend? then I can use whatever GPIO I wish to wake the cool-pi 4b up when suspended without physically pushing the button. I have tried the syntax below but i get a syntax error when i try to convert it back to dtb file:

                  rockchip,wakeup-config = <
                  (0
                  | RKPM_GPIO_WKUP_EN
                  )
                  >;

                  1 Reply Last reply Reply Quote 0
                  • Z
                    zensation @george
                    last edited by

                    after doing more research it seems you have to compile the dts files into a pre processed file with cpp command before you can compile into a dtb file with the dtc command. so i got that figured out and can change the io pullups.

                    however im still struggling with the wakeup from suspend conditions. I enabled several of them but none seem to work. usb hubs are suspended so usb wakeup doesnt work, the Uart0 wakeup condition is enabled but doesnt wakeup the processor either. ill have to keep digging, but if you are anyone knows how to wakeup from a source other than the power button that would be great to know. as it stands ill have to add a secondary microprocessor to the system to ground the power button contact physically to wake up the board.

                    1 Reply Last reply Reply Quote 0
                    • O
                      Orion
                      last edited by

                      您好,我想用C++代码实现对sys/class/gpio的操作,这意味着我不能使用带sudo的命令,但是它提示我Permission denied,即使我解除了写入export的限制,但value和direction依然没有权限写入,在网上搜寻了很多方法无果,请问有好的建议吗

                      G 1 Reply Last reply Reply Quote 0
                      • G
                        george @Orion
                        last edited by george

                        @Orion 参数如下帖子处理,增加规则文件
                        https://www.cool-pi.com/topic/136/coolpi-4b-python3-gpio-operation-compatable-with-raspberry-pi/21?_=1694425872738

                        1 Reply Last reply Reply Quote 0
                        • A
                          AugustRobot_Zou
                          last edited by AugustRobot_Zou

                          This post is deleted!
                          1 Reply Last reply Reply Quote 0
                          • 1 / 1
                          • First post
                            Last post