sudo apt-get install device-tree-compiler
Then I modified the code at https://github.com/OLIMEX/olinuxino-overlays/blob/master/sun7i-a20/sun7i-a20-pwm.dts to look like below/dts-v1/;
/plugin/;
/ {
compatible = "allwinner,sun7i-a20";
description = "Enable PWM controller";
fragment@0 {
target = <&pio>;
__overlay__ {
pwm0_pin: pwm0-pin {
pins = "PB2";
function = "pwm";
};
};
};
fragment@1 {
target = <&pio>;
__overlay__ {
pwm1_pin: pwm1-pin {
pins = "PI3";
function = "pwm";
};
};
};
fragment@2 {
target = <&pwm>;
__overlay__ {
pinctrl-names = "default";
pinctrl-0 = <&pwm0_pin>, <&pwm1_pin>;
status = "okay";
};
};
};
dtc -I dts -O dtb -o /home/sun7i-a20-pwm.dtbo /*path to the DTS file*/sun7i-a20-pwm.dts
# cd /sys/class/pwm/pwmchip0/
# ls
device export npwm power subsystem uevent unexport
# echo 0 > export
The above enables pwm0, which should be at pin PB2
# cd pwm0
#ls
duty_cycle enable period polarity power uevent
# echo 10000 > period
# echo 1000 > duty_cycle
# echo 1 > enable
# echo 0 > enable
# cd ../
# echo 1 > export
The above enables pwm1, which should be at pin PI3
# cd pwm1
#ls
duty_cycle enable period polarity power uevent
# echo 10000 > period
# echo 1000 > duty_cycle
# echo 1 > enable
# echo 0 > enable
$ git diff
diff --git a/board/olimex/a20_olinuxino/board.c b/board/olimex/a20_olinuxino/board.c
index 19cc35ff27..f33f8fa27b 100644
--- a/board/olimex/a20_olinuxino/board.c
+++ b/board/olimex/a20_olinuxino/board.c
@@ -61,11 +61,11 @@ void spl_board_init(void)
printf("\t\'olinuxino config list\' - Select your board\n");
printf("\t\'olinuxino config write\' - Store the board configuration\n");
printf("\t\'reset\' - Reset the board and load the configuration\n");
- printf("\nUsing \'A20-OLinuXino-LIME\' as fallback configuration.\n\n");
+ printf("\nUsing \'A20-OLinuXino-LIME2\' as fallback configuration.\n\n");
eeprom->header = OLINUXINO_EEPROM_MAGIC;
- eeprom->id = 7739;
- eeprom->revision.major = 'A';
+ eeprom->id = 8340;
+ eeprom->revision.major = 'E';
eeprom->revision.minor = 0;
eeprom->serial = 0;
memset(eeprom->mac, 0xFF, 12);
$ sudo apt install bison flex swig gcc-arm-linux-gnueabihf
$ make A20-OLinuXino_defconfig
$ make CROSS_COMPILE=arm-linux-gnueabihf-
dd if=u-boot-sunxi-with-spl.bin of=A20-OLinuXino-bullseye-minimal-20220518-101434.img bs=1024 seek=8 conv=notrunc