EVK-1100 clocks, timers and COUNT

Go To Last Post
2 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Looking at the timing behavior of the AT32UC3C there are some useful observations that may be worth sharing.

 

The code below is a two part timer (used to guarantee software derived set-up and hold times).

Using an external trigger it shows that the peripheral clock is 15 MHz and the COUNTER is 120 MHz.

 

The peripheral bus seems to stall the CPU when there is another operation stated.

 

 

#define TICK_us               24

 

#define TICK_ms            24000

#define TICK_DELAY(t)      while((int32_t) (t -  sysreg_read(AVR32_COUNT)) > 0);

#define TICK_RESET(t, d)   { int32_t _c; if ((_c = sysreg_read(AVR32_COUNT)) > t) t = _c; t += d; }

#define TICK_SET(t, d)     t = sysreg_read(AVR32_COUNT) + d

 

#define PA                 0

#define SETUP              AVR32_GPIO.port[PA].oders = GPIO_PIN
#define GPIO_HIGH          AVR32_GPIO.port[PA].ovrs = GPIO_PIN
#define GPIO_LOW           AVR32_GPIO.port[PA].ovrc = GPIO_PIN

 

        CP_CPU_SPEED = 60000000      // take eval default

 

        SET_UP;

        GPIO_HIGH;                   // Establish minimum timing characteristics
        GPIO_LOW;

        TICK_SET(p0, TICK_MS);       // setup timing period
        GPIO_HIGH;
        // do cool stuff in the snipe time
        TICK_DELAY(p0);              // wait for timing period to end
        GPIO_LOW;

 

Last Edited: Mon. Apr 13, 2015 - 02:21 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The behavior of the system is not as expected.

 

UPDATE:  see other threads on the I/O ring clock speed being different from the CPU clock.

Last Edited: Fri. Apr 28, 2017 - 03:04 PM