Page 1 of 1

Bare metal clock and timers tutorial for banana pi

Posted: Sun Jul 23, 2017 12:33 pm
by inaciose
Hello

Im trying to learn as hobby how to make baremetal programing on banana pi.

To begin I take this tutorial and made it in banana pi
http://wiki.osdev.org/ARM_RaspberryPi_Tutorial_C

Then I add the getc and made an echo shell (just show what you type in serial port);
After that i blink a led using a loop delay function;

Then i try to blink the led with interrups. I got stuck here. Im not smart enought to figure if for my self.
There is no simple information or simple code sample about clok control and timers on banana pi, and allwinner A20.
Then i try to see if i cant get the code from else here. U-boot code was my first try. But it is not simple enough get how to do it.

So.. i need some help to get this done.
Any one knows where to get a simple code sample or tutorial about clock control, timers and interrupts on banana pi / A20

Thanks

Re: Bare metal clock and timers tutorial for banana pi

Posted: Sun Jul 23, 2017 2:34 pm
by Octacone
Banana Pi is a "clone" of Raspberry Pi (sort of). None of them feature a battery powered real time clock (RTC) (low cost intended).
You can buy a separate RTC module that uses on-board GPIOs for communication and can be programmed.
If you are talking about other timers it is most likely they are using some sort of a crystal, meaning fixed frequency.
They are both acquiring their data/time information from an online server.
See if you can use PWM signaling for internal tick keeping. (most likely can be programmed, desired frequency).
Also take a look at your CPU, see if you can find any manuals online. There is a chance that there might be some timer related info.

Here is some Cortex A53 documentation (you didn't mention your processor at all):
https://developer.arm.com/products/proc ... x-a53/docs

Re: Bare metal clock and timers tutorial for banana pi

Posted: Mon Jul 24, 2017 4:23 am
by inaciose
Octacone wrote: See if you can use PWM signaling for internal tick keeping. (most likely can be programmed, desired frequency).
Also take a look at your CPU, see if you can find any manuals online. There is a chance that there might be some timer related info.
Hello. Tks.
The PWM and the manual are the path, unfortunately the manual its only a description of bytes and bits, without a single sample code.
Need to get smarter to do it.

Re: Bare metal clock and timers tutorial for banana pi

Posted: Tue Jul 25, 2017 4:13 pm
by zaval
There is no simple information or simple code sample about clok control and timers on banana pi, and allwinner A20.

Then i try to see if i cant get the code from else here. U-boot code was my first try. But it is not simple enough get how to do it.

Any one knows where to get a simple code sample or tutorial about clock control, timers and interrupts on banana pi / A20
I fear, there is no such things as code samples on "clock control, timers and interrupts on banana pi / A20". Or it's so rare, that noone knows about its existence. Try searching for it, maybe you will be lucky to find some blog with the content which you exactly are searching for. It's just not as a common "hobby" as eg "learning to blink leds on RPi with python". You need to learn buffing your banana by yourself. :mrgreen:

But what I want to say - is don't give up on uboot inspecting. It's not as "hard" as it seems (messy but readable yet). Just have a bit of persistence. It's the ultimate source on the "bare metal programming" of such devices - all they use it as a "firmware", so nowhere else you'll find what you need.

Re: Bare metal clock and timers tutorial for banana pi

Posted: Wed Aug 23, 2017 6:08 am
by inaciose
After a lot of time reading arm manuals I manage to code a simple sample on interrupts and timers for allwinner A20 banana pi.

https://github.com/inaciose/noos/tree/master/bpi/gic02

zaval wrote:
There is no simple information or simple code sample about clok control and timers on banana pi, and allwinner A20.

Then i try to see if i cant get the code from else here. U-boot code was my first try. But it is not simple enough get how to do it.

Any one knows where to get a simple code sample or tutorial about clock control, timers and interrupts on banana pi / A20
I fear, there is no such things as code samples on "clock control, timers and interrupts on banana pi / A20". Or it's so rare, that noone knows about its existence. Try searching for it, maybe you will be lucky to find some blog with the content which you exactly are searching for. It's just not as a common "hobby" as eg "learning to blink leds on RPi with python". You need to learn buffing your banana by yourself. :mrgreen:

But what I want to say - is don't give up on uboot inspecting. It's not as "hard" as it seems (messy but readable yet). Just have a bit of persistence. It's the ultimate source on the "bare metal programming" of such devices - all they use it as a "firmware", so nowhere else you'll find what you need.