AMlogic SoC IO pins control with clean & pure Python library

Share here your ideas for new projects
Post Reply
xpotent
Posts: 2
Joined: Wed May 25, 2022 3:46 am
languages_spoken: english
ODROIDs: C4
Has thanked: 2 times
Been thanked: 3 times
Contact:

AMlogic SoC IO pins control with clean & pure Python library

Post by xpotent »

Hi All!

Not long ago i have started my "AMPatio" project - https://github.com/adir-vrd/ampatio

AMPatio is actually a very easy and simple pure Python lib (in its diapers) to control & manipulate IO pins found on most AMLogic based dev boards out there...
From the beginning when Hardkernel 1st published their Odroid C series i was charmed but i didn't have any idea how to program the IO's i wanted to control.

Year ago I encountered a tutorial on how to manipulate the memory by using Python mmap lib & Linux mem device (/dev/mem) which can achieve just that.
for my understanding the direct memory access abilities existed in linux is more than 10 years old.

For now AMPatio is only able to control & manipulate GPIOs quite easily & fast and only with just less than 150 lines of code, but I have put for myself as a target - the need to do more than that.
Future interfaces hoped to be supported are: UART, I2C, SPI, Infrared blaster/encoder, PWM & ADC.

Importantly, in AMPatio lib I took another approche other than finding the GPIO pin number with calculation, check it out you will find it simplified & well organised.

===================================================================================================================
AMPatio running in my case on Odroid-C4 with Archlinux-ARM using the mainline Linux kernel.
Now, this is where i'm asking also for your kind help, by testing AMPatio lib on more then just my Odroid-C4 board.
===================================================================================================================

In great hope that some of you will find it useful & joyable :)
These users thanked the author xpotent for the post (total 3):
tobetter (Wed May 25, 2022 6:38 am) • odroid (Wed May 25, 2022 10:54 am) • mctom (Mon Jun 06, 2022 12:54 pm)

User avatar
rooted
Posts: 9499
Joined: Fri Dec 19, 2014 9:12 am
languages_spoken: english
Location: Gulf of Mexico, US
Has thanked: 761 times
Been thanked: 486 times
Contact:

Re: AMlogic SoC IO pins control with clean & pure Python library

Post by rooted »

Thank you for sharing.
These users thanked the author rooted for the post:
xpotent (Fri Jun 03, 2022 3:12 am)

User avatar
mctom
Posts: 1677
Joined: Wed Nov 11, 2020 4:44 am
languages_spoken: english, polish
ODROIDs: OGA, XU4, C2, M1
Location: Gdansk, Poland
Has thanked: 195 times
Been thanked: 214 times
Contact:

Re: AMlogic SoC IO pins control with clean & pure Python library

Post by mctom »

Hi there,

If your lib works with one C4, there's no reason not to work on another, I think :)

Great job, although I fail to understand why just Amlogic chips? Other SoCs have very similar mechanisms for driving GPIOs.

I'm sure you could get your library tested on all Odroids around here.
These users thanked the author mctom for the post:
xpotent (Fri Jun 03, 2022 3:12 am)
Punk ain't no religious cult, punk means thinking for yourself!

Maintainer of PiStackMon

xpotent
Posts: 2
Joined: Wed May 25, 2022 3:46 am
languages_spoken: english
ODROIDs: C4
Has thanked: 2 times
Been thanked: 3 times
Contact:

Re: AMlogic SoC IO pins control with clean & pure Python library

Post by xpotent »

mctom wrote:
Wed May 25, 2022 4:31 pm
If your lib works with one C4, there's no reason not to work on another, I think :)
Well, yes the lib suppose to work with all Odroid C/N boards & lots of other vendors boards, you may look at the /AMPatio/boards folder to find them all.
mctom wrote:
Wed May 25, 2022 4:31 pm
Great job, although I fail to understand why just Amlogic chips? Other SoCs have very similar mechanisms for driving GPIOs.
Thanks! :)
1. Since I didn't find any other similar type of project for AMLogic SOCs. The internet is full with RPI projects & other vendors.
2. it is challenge to support more then single vendor only by my self for now.
3. Compare to other SoCs vendors AMLogic do provide excellent datasheets to it's (public open) products, I admire that a lot.
mctom wrote:
Wed May 25, 2022 4:31 pm
I'm sure you could get your library tested on all Odroids around here.
I'll be very pleased if some one will do it, it was a nightmare to find the technical way to make it work on any other AMLogic SoC.
AMLogic has two type of digital IO section in it's SoCs, really not easy task to read many different SoC datasheets & look at other board vendors schematics just to be able to play with.

B.D.W... sorry for my delayed response, I got almost zero time to do more.

User avatar
mctom
Posts: 1677
Joined: Wed Nov 11, 2020 4:44 am
languages_spoken: english, polish
ODROIDs: OGA, XU4, C2, M1
Location: Gdansk, Poland
Has thanked: 195 times
Been thanked: 214 times
Contact:

Re: AMlogic SoC IO pins control with clean & pure Python library

Post by mctom »

No worries, and thanks for your answers. It all does make a lot of sense and indeed it was very tricky to handle GPIOs on a few SoCs (Rockchip being my latest "adventure"...)
Punk ain't no religious cult, punk means thinking for yourself!

Maintainer of PiStackMon

Post Reply

Return to “The Ideas”

Who is online

Users browsing this forum: No registered users and 10 guests