July 06, 2025, 04:26:06 PM

Recent posts

#31
A20 / Re: LIME2 sun4i-codec not work...
Last post by LubOlimex - June 26, 2025, 08:54:14 AM
Thank you for the update! Glad it worked in the end.
#32
A20 / Re: OLinuXimo A20 LIME2 : use ...
Last post by LubOlimex - June 26, 2025, 08:22:19 AM
Unfortunately, we no longer maintain the customized Python packages like pyA20Lime2. These should be considered abandon-ware. Probably parts or logic in them can be used as basis or inspiration for own work. These packages were made for the Armbian releases, as soon as we switched to mainline Olimage images, we dropped support. The packages are not supposed to work with Olimage out-of-the-box and had never been tested under Olimage. There are few paths forward:

- Adapt the packages for your use, sources can be found at our GitHub;
- Use sysfs to accomplish the same;
- Find similar Python package for the Allwinner A20 chip.

For C code and more refer to "8.6. How to toggle a GPIO pin via sysfs" on page 26 of this document:

https://github.com/OLIMEX/OLINUXINO/blob/master/DOCUMENTS/OLIMAGE/Olimage-guide.pdf
#33
A20 / Re: OLinuXimo A20 LIME2 : use ...
Last post by abriotde - June 25, 2025, 05:55:23 PM
I have test return code from init() in C code, and it's the open of /dev/mem the problem... Not trivial.

https://askubuntu.com/questions/1467092/dev-mem-and-even-dev-port-cant-open-even-as-root
#34
A20 / Re: OLinuXimo A20 LIME2 : use ...
Last post by abriotde - June 25, 2025, 05:40:35 PM
Yes, I bought the LIME2-SHIELD, and know I manage to blink a LED... with Shell with this code:

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

But with C, this code seam to do nothing:

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;
}

I used the lime2-shield doc to convert PIN 53 to B21 but maybe is it wrong?

But in python, it's worst: It's crash with "PermissionError: [Errno 1] Operation not permitted" even in root while overwise, I run in olimex user. And Python init() code, should call sunxi_gpio_init(), the one witch not crash on C...

from pyA20Lime2.gpio import gpio
from pyA20Lime2.gpio import port
from pyA20Lime2.gpio import connector

gpio.init()
#35
A20 / Re: LIME2 sun4i-codec not work...
Last post by zeallin - June 25, 2025, 10:25:44 AM
Hello my friend,

Since I think the system should be alright, I change the wire from HPOUTL + HPCOM to HPOUTR + HPCOM, and the mono audio works!

Thank you very very much for your support, you are the best!
#36
A20 / Re: LIME2 sun4i-codec not work...
Last post by LubOlimex - June 24, 2025, 01:40:08 PM
No idea. My hardware setup is different - I used regular stereo output and I didn't change anything in alsa mixer. You only have one channel connected and mono source, I think you need to change the input the output to mono and either left or right channel as input somewhere. Not sure if unmutting all is the correct approach.

Maybe also try with the audio file I linked above "file_example_WAV_5MG.wav".
#37
A20 / Re: LIME2 sun4i-codec not work...
Last post by zeallin - June 24, 2025, 01:13:36 PM
Hello my friend,

Your suggestion is awesome! I followed the steps you provided and now the board is recognized properly!

1. The sun4icodec is turned on automatically!

**** 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

2. The aplay seems works properly (it finish in time) but no audio output (no sound from the speaker).

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$

3. I checked the alsamixer and unmute all playback items

https://ibb.co/sdWJQnWK

Just wonder what is missing...

Thank you very much my friend!
#38
A20 / Re: LIME2 sun4i-codec not work...
Last post by LubOlimex - June 24, 2025, 09:22:51 AM
Yes, the fail to recognize the board properly is the problem! When this happens the Olimex loads settings for that specific board and revision, and the hardware of the real board would not work properly.

Why did this happen? Well, the ID for the board is stored on the EEPROM memory and either EEPROM got wiped or overwritten and the boot can't find the ID so it loads the default fallback configuration.

How to fix it? Re-configure the EEPROM with proper information. This can be done via software means. You need to interrupt the boot early - where it says in your log "Hit any key to stop autoboot:  0" just mash some key after power up. Then you'd end up in the u-boot. Then you manually set the board and revision by using commands, type:

olinuxino

to see help, then type

olinuxino config list

to see all IDs for each board and then:

olinuxino config write [id] [revision] [serial] [mac]

where ID is taken from the olinuxino config list and should match your board variant and then hardware revision.

Once done, type:

saveenv

and finally reset the board with:

reset

Observe if the new and proper values are stored and displayed at the start of boot.

For more info refer to the Olimage guide document, page 20, chapter "7.1 U-boot tools":

https://github.com/OLIMEX/OLINUXINO/blob/master/DOCUMENTS/OLIMAGE/Olimage-guide.pdf

Best regards,
Lub/OLIMEX

#39
A20 / Re: LIME2 sun4i-codec not work...
Last post by zeallin - June 24, 2025, 05:57:23 AM
Hello my friend,

I tried just use first two steps (clean image + apt update, apt upgrade, u-boot-install), but seems no luck:

1. aplay -l have no soundcard found
olimex@a20-olinuxino:~$ aplay -l
aplay: device_list:274: no soundcards found...

2. However, I check the boot information, it seems not correct. I wonder if this is the problem:

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

3. How can I make the board properly recognized at start of boot?

Thank you very much for your help!
#40
Neo6502 / Neo6502 / Assembler Programmin...
Last post by mscha - June 22, 2025, 10:36:53 AM
When I assemble programs directly on the Neo6502, using David Given's 'asm': is there also a debugger available that runs on the Neo?