PIN_NUM=53
gpio_init () {
echo "PIN_NUM=${PIN_NUM}"
# echo $PIN_NUM > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio${PIN_NUM}/direction
}
gpio_set () {
val=$1
echo "GPIO set $val"
echo $val > /sys/class/gpio/gpio${PIN_NUM}/value
}
gpio_get () {
echo -n "GPIO = "
cat /sys/class/gpio/gpio${PIN_NUM}/value
}
gpio_init
gpio_get
while true; do
gpio_set 1
gpio_get
sleep 1
gpio_set 0
gpio_get
sleep 1
done
int main() {
sunxi_gpio_init();
unsigned int pin = SUNXI_GPB(21);
sunxi_gpio_set_cfgpin(pin, SUNXI_GPIO_OUTPUT); // Set PB21 as outputtput
sunxi_gpio_pullup(pin, SUNXI_PULL_DOWN); // Enable pull-up on PB21
sunxi_gpio_pullup(pin, SUNXI_PULL_UP); // Enable pull-up on PB21
int i = 0;
while( 1 ) {
printf("Write 1;\n");
sunxi_gpio_output(pin, 1); // Set PB21 high
sleep(1);
printf("Write 0;\n");
sunxi_gpio_output(pin, 0); // Set PB21 low
sleep(1);
}
return 0;
}
from pyA20Lime2.gpio import gpio
from pyA20Lime2.gpio import port
from pyA20Lime2.gpio import connector
gpio.init()
**** List of PLAYBACK Hardware Devices ****
card 0: sun4icodec [sun4i-codec], device 0: CDC PCM Codec-0 [CDC PCM Codec-0]
Subdevices: 1/1
Subdevice #0: subdevice #0
olimex@a20-olinuxino:~/tool-audio$ aplay -Dhw:0,0 launch.wav
Playing WAVE 'launch.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
olimex@a20-olinuxino:~/tool-audio$
olimex@a20-olinuxino:~$ aplay -l
aplay: device_list:274: no soundcards found...
U-Boot 2021.04+olimex-1-20250305.102147 (Mar 05 2025 - 10:22:57 +0000) Allwinner Technology
CPU: Allwinner A20 (SUN7I)
ID: A20-OLinuXino-LIME Rev.A
SN: 00000000
MAC: FF:FF:FF:FF:FF:FF
I2C: ready
DRAM: 1 GiB
MMC: mmc1:0c0f000: 0
Loading Environment from EXT4... *** Warning - bad CRC, using default environment
Loading Environment from FAT... ** No device specified **
HDMI connected: Setting up a 1920x1080 hdmi console (overscan 0x0)
In: serial
Out: vga
Err: vga
Allwinner mUSB OTG (Peripheral)
Net: eth0: ethernet@1c50000, eth1: usb_ether
starting USB...
Bus usb0c14000: USB EHCI 1.00
Bus usb1c14400: USB OHCI 1.0
Bus usb1c1c000: USB EHCI 1.00
Bus usb1c1c400: USB OHCI 1.0
scanning bus usb0c14000 for devices... 7 USB Device(s) found
scanning bus usb1c14400 for devices... 1 USB Device(s) found
scanning bus usb1c1c000 for devices... 2 USB Device(s) found
scanning bus usb1c1c400 for devices... 1 USB Device(s) found
scanning usb for storage devices... 1 Storage Device(s) found
Hit any key to stop autoboot: 0
https://ibb.co/pGc5HHJ