0
nopnop2002

Debian stretch pwm overlay driver[SOLVED]

Recommended Posts

Hello.
I added overlays=pwm to /boot/armbianEnv.txt and reboot system.
 

$ cat /boot/armbianEnv.txt
verbosity=1
logo=disabled
console=both
disp_mode=1920x1080p60
overlay_prefix=sun8i-h3
rootdev=UUID=3d863bb3-b616-4229-94e7-8c92ac95501a
rootfstype=ext4
usbstoragequirks=0x2537:0x1066:u,0x2537:0x1068:u
overlays=pwm

 

Armbian can't boot-up.
 

** Unable to read "/boot/boot.env" from mmc0:1 **
Failed (-5)
In:    serial
Out:   serial
Err:   serial
Net:   phy interface0
eth0: ethernet@1c30000
230454 bytes read in 23 ms (9.6 MiB/s)
starting USB...
USB0:   USB EHCI 1.00
USB1:   USB OHCI 1.0
USB2:   USB EHCI 1.00
USB3:   USB OHCI 1.0
USB4:   USB EHCI 1.00
USB5:   USB OHCI 1.0
scanning bus 0 for devices... 1 USB Device(s) found
scanning bus 2 for devices... 1 USB Device(s) found
scanning bus 4 for devices... 1 USB Device(s) found
       scanning usb for storage devices... 0 Storage Device(s) found
Autoboot in 1 seconds, press <Space> to stop
switch to partitions #0, OK
mmc0 is current device
Scanning mmc 0:1...
Found U-Boot script /boot/boot.scr
3708 bytes read in 18 ms (201.2 KiB/s)
## Executing script at 43100000
U-boot loaded from SD
Boot script loaded from mmc
214 bytes read in 15 ms (13.7 KiB/s)
5104363 bytes read in 264 ms (18.4 MiB/s)
6985408 bytes read in 359 ms (18.6 MiB/s)
Found mainline kernel configuration
32108 bytes read in 60 ms (522.5 KiB/s)
884 bytes read in 130 ms (5.9 KiB/s)
Applying kernel provided DT overlay sun8i-h3-pwm.dtbo
4179 bytes read in 127 ms (31.3 KiB/s)
Applying kernel provided DT fixup script (sun8i-h3-fixup.scr)
## Executing script at 44000000
Warning: Disabling ttyS0 console due to enabled PWM overlay
## Loading init Ramdisk from Legacy Image at 43300000 ...
   Image Name:   uInitrd
   Image Type:   ARM Linux RAMDisk Image (gzip compressed)
   Data Size:    5104299 Bytes = 4.9 MiB
   Load Address: 00000000
   Entry Point:  00000000
   Verifying Checksum ... OK
## Flattened Device Tree blob at 43000000
   Booting using the fdt blob at 0x43000000
   Loading Ramdisk to 49b21000, end 49fff2ab ... OK
   reserving fdt memory region: addr=43000000 size=6e000
   Loading Device Tree to 49ab0000, end 49b20fff ... OK

Starting kernel ...

 

System information

$ cat /etc/armbian-release
# PLEASE DO NOT EDIT THIS FILE
BOARD=orangepipc
BOARD_NAME="Orange Pi PC"
BOARDFAMILY=sun8i
VERSION=5.65
LINUXFAMILY=sunxi
BRANCH=next
ARCH=arm
IMAGE_TYPE=stable
BOARD_TYPE=conf
INITRD_ARCH=arm
KERNEL_IMAGE_TYPE=zImage

Can't I use  sun8i-h3-pwm.dtbo?

Share this post


Link to post
Share on other sites

I was wrong.
I used USB-TTL converter with a debugg port.
When I remove USB-TTL converter,my SG90 work perfect.

#!/bin/bash
#Export PWM channel for user control.
sudo sh -c "echo 0 > /sys/class/pwm/pwmchip0/export"

#Select the period of PWM signal. Value is in nanoseconds.
sudo sh -c "echo 20000000 > /sys/class/pwm/pwmchip0/pwm0/period"

#Change the polarity of the PWM signal.
#The polarity can only be changed if the PWM is not enabled.
sudo sh -c "echo "normal" > /sys/class/pwm/pwmchip0/pwm0/polarity"

#Enable the PWM signal.
sudo sh -c "echo 1 > /sys/class/pwm/pwmchip0/pwm0/enable"

#Select the duty cycle. Value is in nanoseconds and must be less than the period.
#Move to Center
sudo sh -c "echo 1450000 > /sys/class/pwm/pwmchip0/pwm0/duty_cycle"
sleep 2

#Move to Angle +90
sudo sh -c "echo 2350000 > /sys/class/pwm/pwmchip0/pwm0/duty_cycle"
sleep 2

#Move to Angle -90
sudo sh -c "echo 600000 > /sys/class/pwm/pwmchip0/pwm0/duty_cycle"
sleep 2

#Move to Center
sudo sh -c "echo 1450000 > /sys/class/pwm/pwmchip0/pwm0/duty_cycle"
sleep 2

#Disable the PWM signal.
sudo sh -c "echo 0 > /sys/class/pwm/pwmchip0/pwm0/enable"

#UnExport PWM channel for user control.
sudo sh -c "echo 0 > /sys/class/pwm/pwmchip0/unexport"

 

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