Patch for AVR32 platforms without 32kHz crystal

classic Classic list List threaded Threaded
6 messages Options
Martin Guy Martin Guy
Reply | Threaded
Open this post in threaded view
|

Patch for AVR32 platforms without 32kHz crystal

Hi
   AVR32 board usually have two crystals: a 12MHz one from which the
CPU and bus clocks are derived, and a 32768Hz one for the real time
counters.
   The following patch makes eLua timers work on AVR32 boards that
don't have the 32768Hz crystal mounted (just the 12MHz one), such as
our forthcoming project. I need to check a few other thing before I
submit our board config files, but this patch can be tested on EVK1100
by undefining FOSC32 in src/platform/avr32/EVK1100/evk1100_conf.h

   Background: AVR32UC3 parts have 3 independent timers, which can be
clocked at one of five frequencies:
0 - the 32768Hz crystal
1-4 - PBA frequency (which is configured in platform_conf.h (i.e.
src/platform/avr32/BOARD/board_conf.h) and is usually 15MHz) divided
by 2, 8, 32 or 128, giving 7.5MHz, 1.875MHz, 468.750kHz or 117.187kHz
By default the clock selection register starts at 0, which selects the
32768Hz crystal clock.
  On boards with no 32768Hz crystal, this means that the timers do not
run at all until you explicitly select a clock frequency of 100kHz(*)
or above (thereby selecting a PBA-derived clock for that timer) with
tmr.setclock(0, 100000)

(*) More exactly, one higher than the arithmetic mean of 32768 and the
PBA frequency/128.

The effect of this patch, if FOSC32 is undefined, is to make hardware
and virtual timers work by selecting the slowest available PBA clock
at startup and never selecting the 32768Hz clock when a slow clock
frequency is requested.
This also reduces the maximum delay when using the hardware timers
(ids 0 and 1) from 2 seconds to just over half a second (due to its
16-bit counters) when FOSC32 is undefined.

The patch also replaces explicit "32768"s in the code with the FOSC32
macro, whose value is 32768.

    M

_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev

elua-avr32-without-FOSC32.patch (3K) Download Attachment
Dado Sutter Dado Sutter
Reply | Threaded
Open this post in threaded view
|

Re: Patch for AVR32 platforms without 32kHz crystal

Thank you very much Martin.
   Do you know of any commercially available AVR32 kit that does not have an on board low freq clock  ?
   I'd like to document it on the wiki.
   Does the values you've mentioned depend on the main MCU clock being 12MHz ?

Best
Dado



On Thu, Aug 26, 2010 at 07:33, Martin Guy <[hidden email]> wrote:
Hi
  AVR32 board usually have two crystals: a 12MHz one from which the
CPU and bus clocks are derived, and a 32768Hz one for the real time
counters.
  The following patch makes eLua timers work on AVR32 boards that
don't have the 32768Hz crystal mounted (just the 12MHz one), such as
our forthcoming project. I need to check a few other thing before I
submit our board config files, but this patch can be tested on EVK1100
by undefining FOSC32 in src/platform/avr32/EVK1100/evk1100_conf.h

  Background: AVR32UC3 parts have 3 independent timers, which can be
clocked at one of five frequencies:
0 - the 32768Hz crystal
1-4 - PBA frequency (which is configured in platform_conf.h (i.e.
src/platform/avr32/BOARD/board_conf.h) and is usually 15MHz) divided
by 2, 8, 32 or 128, giving 7.5MHz, 1.875MHz, 468.750kHz or 117.187kHz
By default the clock selection register starts at 0, which selects the
32768Hz crystal clock.
 On boards with no 32768Hz crystal, this means that the timers do not
run at all until you explicitly select a clock frequency of 100kHz(*)
or above (thereby selecting a PBA-derived clock for that timer) with
tmr.setclock(0, 100000)

(*) More exactly, one higher than the arithmetic mean of 32768 and the
PBA frequency/128.

The effect of this patch, if FOSC32 is undefined, is to make hardware
and virtual timers work by selecting the slowest available PBA clock
at startup and never selecting the 32768Hz clock when a slow clock
frequency is requested.
This also reduces the maximum delay when using the hardware timers
(ids 0 and 1) from 2 seconds to just over half a second (due to its
16-bit counters) when FOSC32 is undefined.

The patch also replaces explicit "32768"s in the code with the FOSC32
macro, whose value is 32768.

   M

_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev



_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
Martin Guy Martin Guy
Reply | Threaded
Open this post in threaded view
|

Re: Patch for AVR32 platforms without 32kHz crystal

On 8/26/10, Dado Sutter <[hidden email]> wrote:
>    Do you know of any commercially available AVR32 kit that does not have an
> on board low freq clock  ?
No, we are producing one - we just took delivery of the naked circuit
boards today.

>    I'd like to document it on the wiki.
>    Does the values you've mentioned depend on the main MCU clock being 12MHz

The main crystal is 12 MHz, but the values depend on the PBA
(peripheral bus) frequency which, like the CPU clock, can take a lot
of different values by programming the PLLs and dividers, so they
depend on the 12MHz crystal frequency and the programming of the PBA
multipliers and dividers.
 You can say it depends on the PBA frequency - anyone who works with
AVR32UC3 should understand what that means.

     M
_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
Dado Sutter Dado Sutter
Reply | Threaded
Open this post in threaded view
|

Re: Patch for AVR32 platforms without 32kHz crystal



On Thu, Aug 26, 2010 at 12:29, Martin Guy <[hidden email]> wrote:
On 8/26/10, Dado Sutter <[hidden email]> wrote:
>    Do you know of any commercially available AVR32 kit that does not have an
> on board low freq clock  ?
No, we are producing one - we just took delivery of the naked circuit
boards today.

Cool.
Is it for a pvt project or will we be able to buy it somewhere ?
 
>    I'd like to document it on the wiki.
>    Does the values you've mentioned depend on the main MCU clock being 12MHz

The main crystal is 12 MHz, but the values depend on the PBA
(peripheral bus) frequency which, like the CPU clock, can take a lot
of different values by programming the PLLs and dividers, so they
depend on the 12MHz crystal frequency and the programming of the PBA
multipliers and dividers.
 You can say it depends on the PBA frequency - anyone who works with
AVR32UC3 should understand what that means.

Right, Thanks.

    M

Best
Dado





 
_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev


_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
Sergio Sorrenti Sergio Sorrenti
Reply | Threaded
Open this post in threaded view
|

Re: Patch for AVR32 platforms without 32kHz crystal

Hi Dado,

i'm the projects coordinator at SimpleMachines,
a no profit organization in Italy, www.simplemachines.it

our eLua board (Mizar32) will be available commercially soon,
and will be sold from all our supporting partners worldwide.

Right now the Open Source Hardware project
of the base board and all its modules is hosted at google code
here: http://code.google.com/p/mizar32/

We will populate it with the Kicad PCB design files soon,
some of the schematics are already available.

Last thing, we will make soon a beta test program before mass production
so you can try one board very soon if you will like to participate.

B. Regards,
Sergio Sorrenti

2010/8/26 Dado Sutter <[hidden email]>


On Thu, Aug 26, 2010 at 12:29, Martin Guy <[hidden email]> wrote:
On 8/26/10, Dado Sutter <[hidden email]> wrote:
>    Do you know of any commercially available AVR32 kit that does not have an
> on board low freq clock  ?
No, we are producing one - we just took delivery of the naked circuit
boards today.

Cool.
Is it for a pvt project or will we be able to buy it somewhere ?
 


_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
Marcelo Politzer Marcelo Politzer
Reply | Threaded
Open this post in threaded view
|

Re: Patch for AVR32 platforms without 32kHz crystal

Looks like an amazing board with a lot of spare space to play with elua.

now we just need to discover how to hack a display into it :P

Best,
Marcelo


2010/8/27 Sergio Sorrenti <[hidden email]>
Hi Dado,

i'm the projects coordinator at SimpleMachines,
a no profit organization in Italy, www.simplemachines.it

our eLua board (Mizar32) will be available commercially soon,
and will be sold from all our supporting partners worldwide.

Right now the Open Source Hardware project
of the base board and all its modules is hosted at google code
here: http://code.google.com/p/mizar32/

We will populate it with the Kicad PCB design files soon,
some of the schematics are already available.

Last thing, we will make soon a beta test program before mass production
so you can try one board very soon if you will like to participate.

B. Regards,
Sergio Sorrenti

2010/8/26 Dado Sutter <[hidden email]>



On Thu, Aug 26, 2010 at 12:29, Martin Guy <[hidden email]> wrote:
On 8/26/10, Dado Sutter <[hidden email]> wrote:
>    Do you know of any commercially available AVR32 kit that does not have an
> on board low freq clock  ?
No, we are producing one - we just took delivery of the naked circuit
boards today.

Cool.
Is it for a pvt project or will we be able to buy it somewhere ?
 


_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev



_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev