Someone with Olimex sam7x board please help...

I am trying to get a timer counter example to work for days now. I cannot figure out at all why it is not working. At this time, I am thinking that either my yagarto setup is creating bad code (very unlikely) or that my board is faulty (also very unlikely)…

So, I created a bin file by compiling the example from http://www.ethernut.de/en/documents/at91-timer-irq.html. It downloads, and outputs meaningful values at the beginning (mcu speed, etc…), however when it comes to the main loop that should display the counter ticks, it always says: “0 counter ticks”. It is driving me crazy.

I have attached the bin file at http://www.vidrica.com/prz/timer.bin (compiled to download into flash). If someone with the board can download this file and let me know if it is outputting anything other than 0 ticks, I would really appreciate it. The serial port setting should be at 115200.

There is also another file (http://www.vidrica.com/prz/timer_dbg.bin) that is the same thing with more debug information. It also dumps zeroes all over, where it shouldn’t.

Anyway, thanks in advance guys…

Ivan

How about someone with a project for sam7x that uses timer/counter, so I can try it out?

I still haven’t figured out what is going on with my designs. I just cannot get the timer/counter to work at all…

Thanks in advance,

Ivan

I personally have not used TC so I cannot directly help with that, however maybe worth to check that peripheral clock is enabled for the TCx you use!

For example if I want to use ADC and SPI I need to enable the peripheral clocks for those modules through the power management controller (PMC) i.e.

    /* Enable peripheral clocks */
    AT91C_BASE_PMC->PMC_PCER = (1 << AT91C_ID_ADC)
                             | (1 << AT91C_ID_SPI0);

I’m not familiar about Ethernut so I do not know do you need to enable those clocks via PMC or are those enabled by default by some initialisation routine?

For TC the constants are:

#define AT91C_ID_TC0    (12) // Timer Counter 0
#define AT91C_ID_TC1    (13) // Timer Counter 1
#define AT91C_ID_TC2    (14) // Timer Counter 2

I cannot believe I made such a retarded mistake… Yes, you are right: I had to enable the clock. Now it all works.

Thanks a lot for the tip, tparviai.

Ivan.