Jump to content

Marco Cettina

Members
  • Posts

    13
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. This is going to be a rough tutorial on how to get PWM working on a OrangePi Zero 3 running armbian. Just got this working thanks to (https://forum.armbian.com/profile/9748-going/). I am no expert when it comes to PWM and kernel overlays but this should get you something that works. Enjoy! Install all 4 of the deb's from this link (https://github.com/The-going/PKG_test/tree/master/sunxi64-6.13) after rebooting you should be on 6.13.11. You can check with "uname -r" Edit the file at /boot/armbianEnv.txt and add "pwm1-ph3", "pwm1-pi11", "pwm4-ph1" or "pwm4-pi14" depending on which pwm pin you want to use. Use the included pinout.png for reference. After enabling the overlay I used the gpio command which should be preinstalled on armbian, if not this wiki page tells you how to install. (http://www.orangepi.org/orangepiwiki/index.php/Orange_Pi_Zero_3#How_to_install_wiringOP) "gpio readall" this will print out an ascii diagram of the physical pins on the board as shown in ascii.png. In this case I am using physical pin 10, which corresponds to wPi pin 4 which is what we need for the next commands. (The pin names/number here are going to be different than the ones used previously, it is best to just use the ascii diagram and find what pin you are using instead of basing off of previous pin names) "gpio mode 4 pwm" replace 4 with whatever wPi pin you are using, do this for all following commands. This will set the pin mode in the software to pwm The following information I just learned from doing some googling so it may NOT be 100% correct but it was enough to get it working in my case. "gpio pwmc 4 25" this sets the clock frequency of the PWM pin. The clock frequency is equal to 19200000 divided by the last number specified in the command. So in this case the clock frequency is 768000=19200000/25. "gpio pwmr 4 50" this sets the pwm range and output frequency. range is essentially the resolution of pwm adjustment, higher range means finer control. your final pwm frequency is equal to 19200000/clockvalue/rangevalue. So in this case my pwm frequency is 15360=19200000/25/50. "gpio pwm 4 25" this sets your pwm duty cycle, this is the value you will most likely be changing to control whatever device you have connected to your pwm pin. this number cant be more than your set pwm range, so in this case i have 51 steps because I have any number from and including 0 to 50 to work with. Again I am far from an expert in PWM so I cant guarantee this is all correct but at the very least this shows how to set the needed values with the gpio commands and get PWM working on this board.
  2. Success!! New kernel installed and overlays enabled, pwm works exactly how it should with the gpio command. The pwm chip shows up in /sys/class/pwm instead of /sys/pwm but it works!! Thank you for all the help! If you want more details on what commands i ran to use pwm i can send them.
  3. Awesome, going to give it a shot right now.
  4. Hey any update on this? No rush, just checking in. Not sure what has to be done on your end.
  5. So do you need to push an update to the EDGE build to allow PWM?
  6. Alright im updated to 6.13.7-edge-sunxi64.
  7. Ill do that and get back to you! Thank you!
  8. uname -r: 6.6.75-current-sunxi64 I am wired to PH3 right now, that's what i have been testing with and was functional in hardware mode on the factory supplied Debian image.
  9. So Im not entirely sure if I need to figure out the overlays or something else. On the factory debian image there are two overlays pwm12 and pwm34, i didnt enable them and it seems to work just fine with the gpio command. I should have been more specific, on armbian there are two pwm overlays but they have the prefix of sun50i-h5 and sun50i-h6, i tried enabling them anyway but didnt make a difference and still no pwmchip showing up in /sys/class/pwm. It also is giving me "val pwmWrite 0 <= X <= 1024, Or you can set new range by yourself by pwmSetRange(range)" when i set the pwm value even though I already did set a range and ram the same commands that worked perfectly on the factory image. Im not sure exactly what you mean by core.
  10. The only two dtbs that mention PWM have a different prefix so i assume thats why they dont work when i try to enable them? sun50i-h5-pwn.dtbo and sun50i-h6-pwn.dtbo
  11. Whoops forgot to add that, there are no pwm related overlays on armbian install.
  12. Hello! PWM seems to work without any configuration on the factory images with the gpio command, but I cant seem to get it to work on armbian. There doesn't seem to be any dtbs related to pwm, and /sys/class/pwm is empty on armbian. Anyone got this to work? EDIT: Forgot to add, doesnt seem to be any pwm overlays present on armbian install
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines