Younes_Thabet Posted October 3, 2019 Posted October 3, 2019 Hello all, I used using opi one with (Armbian_5.90_Ubuntu_bionic_4.19.57) image. and used the uart0 pins for hardware pwm but the output was around 330mv pwm not 3.3v as i want. my initial thoughts was either the uart0 isn't disabled or there are no pull ups activated, although i tryed using this: https://github.com/iboguslavsky/pwm-sunxi-opi0 Remap pins in FEX: ; Disable debug UART0 [uart_para] uart_debug_port = 0 uart_debug_tx = port:PA04<2><1> uart_debug_rx = port:PA05<2><1> ; Enable PWM0 on PA05 [pwm0_para] pwm_used = 1 pwm_positive = port:PA05<3><0> but there is no FEX but DTB files and i didn't know how to disable uart0 and activate pwm in DTB/DTS files. so how can i get a 3.3v pwm on uart0 (hardware pwm) ?
martinayotte Posted October 3, 2019 Posted October 3, 2019 7 minutes ago, Younes_Thabet said: but there is no FEX but DTB files and i didn't know how to disable uart0 and activate pwm in DTB/DTS files. You need to decompile DTB into DTS, edit the DTS by changing "status" from "okay" to "disabled" for uart0 node and vice-versa for pwm node, then recompile DTS into DTB and reboot.
Younes_Thabet Posted October 3, 2019 Author Posted October 3, 2019 23 minutes ago, martinayotte said: You need to decompile DTB into DTS, edit the DTS by changing "status" from "okay" to "disabled" for uart0 node and vice-versa for pwm node, then recompile DTS into DTB and reboot. I did decompile DTB into DTS, and this is what i found: uart0 { pins = "PA4/0PA5"; function = "uart0"; phandle = < 0x19 >; }; pwm@1c21400 { compatible = "allwinner,sun8i-h3-pwm"; reg = < 0x1c21400 0x08 >; clocks = < 0x0e >; #pwm-cells = < 0x03 >; status = "disabled"; phandle = < 0x56 >; }; there is no status line in uart0 and all other peripherals (spi i2c i2s ...) i tryed to change the status of pwm to "enabled" but with no luck!?
martinayotte Posted October 3, 2019 Posted October 3, 2019 9 minutes ago, Younes_Thabet said: there is no status line in uart0 This is only the pins definition, you need to search for "serial@1c28000" node and change the "status" there ...
Younes_Thabet Posted October 3, 2019 Author Posted October 3, 2019 30 minutes ago, martinayotte said: This is only the pins definition, you need to search for "serial@1c28000" node and change the "status" there ... i did change the satatus but no luck!! I have my pwm and all but it's peak value is around 330mv not 3.3v ...so maybe the problem is with pull-up resistors !? IDK!
Younes_Thabet Posted October 3, 2019 Author Posted October 3, 2019 @martinayotte Sir, do you have any idea what could be wrong with the 330mv pwm issue!? normally it should be 3.3V, right!? Thanks in advance.
martinayotte Posted October 3, 2019 Posted October 3, 2019 30 minutes ago, Younes_Thabet said: do you have any idea what could be wrong I think the Main DT doesn't specify the pin PA5, but the /boot/dtb/overlay/sun8i-h3-pwm.dtbo overlay does ... So, better use that overlay, simply by adding "overlays=pwm" in the /boot/armbianEnv.txt and reboot. I did some tests on my OPiZero and it worked, adjusting the period and duty-cycle, etc ... 1
Younes_Thabet Posted October 3, 2019 Author Posted October 3, 2019 32 minutes ago, martinayotte said: simply by adding "overlays=pwm" in the /boot/armbianEnv.txt and reboot. It didn't work hahaha, but thanks for your help. i will post the solution once i get it to work properly.
Recommended Posts