0
Younes_Thabet

pmw on orange pi one isn't 3.3v in magnitude!

Recommended Posts

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) ?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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!?

Share this post


Link to post
Share on other sites
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 ...

Share this post


Link to post
Share on other sites
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!

Share this post


Link to post
Share on other sites
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 ...

Share this post


Link to post
Share on other sites
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.

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
0