OSDev.org
https://forum.osdev.org/

Bare metal clock and timers tutorial for banana pi
https://forum.osdev.org/viewtopic.php?f=13&t=32240
Page 1 of 1

Author:  inaciose [ Sun Jul 23, 2017 12:33 pm ]
Post subject:  Bare metal clock and timers tutorial for banana pi

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

Author:  Octacone [ Sun Jul 23, 2017 2:34 pm ]
Post subject:  Re: Bare metal clock and timers tutorial for banana pi

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/processors/cortex-a/cortex-a53/docs

Author:  inaciose [ Mon Jul 24, 2017 4:23 am ]
Post subject:  Re: Bare metal clock and timers tutorial for banana pi

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.

Author:  zaval [ Tue Jul 25, 2017 4:13 pm ]
Post subject:  Re: Bare metal clock and timers tutorial for banana pi

Quote:
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.

Author:  inaciose [ Wed Aug 23, 2017 6:08 am ]
Post subject:  Re: Bare metal clock and timers tutorial for banana pi

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:
Quote:
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.

Page 1 of 1 All times are UTC - 6 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/