Glomation
 
Advanced Search
Welcome, Guest. Please login or register.

Login with username, password and session length
February 05, 2012, 06:01:55 AM
News: Glomation introduced new wireless ready low cost GESBC-9260S
Pages: [1]
Topic Tools  
Read July 31, 2010, 09:51:06 PM #0
tharold

9260 event counter?

Hi,

Which pin can I use?

According to the 9260 datasheet, I will need to clock one of the TCLK0-2 pins or TIOA0-2 pins.  However none of these are available on the GESBC-9260 board.

What is available are the TIOA3-5 pins and TCLK3-4 pins, but I can't find any documentation on them.  There is supposed to be just 3 timer/counters on the chip, so I don't know what these extra pins do. 

How can I implement an event counter (very low speed) on the 9260 board?

Thanks,
-harold
 
Read August 02, 2010, 10:29:48 AM #1
admin

Re: 9260 event counter?

The Atmel AT91SAM9260 data sheet does not have a lot information regarding those pins.  If the input frequency is really low maybe using one of the GPIO pin can be used as interrupt source and using a kernel module to count the event, kind of a software event counter.
 
Read September 06, 2010, 07:35:32 AM #2
tharold

Re: 9260 event counter?

For anyone trying to do this, here's how I enabled TC3 (first clock of the second block) as event counter, clocking on TCLK4 (pin 18 on the GESBC9260).

Tell the PMC to power it on:
    p = mem(PMC_START + PMC_PCER); *p = (1<<26); /* enable TC3 clock */
Tell the peripheral controller to set up pin 18 as:
    p = mem(PIOB_START + PIO_PDR); *p = (1<<17); /* no pio */
    p = mem(PIOB_START + PIO_ODR); *p = (1<<17); /* no output */
    p = mem(PIOB_START + PIO_PUDR); *p = (1<<17); /* no pullup */
    p = mem(PIOB_START + PIO_BSR); *p = (1<<17); /* on periph B */
Set up the counter:
    p = mem(0xFFFDC000 + TC_IDR); *p = ~1; /* disable interrupts */
    /* 0x6: use XC1; 0x8: falling edge */
    p = mem(0xFFFDC000 + TC_CMR); *p = 0x6|0x8;
    p = mem(0xFFFDC000 + TC_CCR); *p = 0x5; /* reset counter */
    delay(100);
Read counter value:
    p = mem(0xFFFDC000 + TC_CV);
    printf("%d\n", *p);

Now my problem is I can't seem to reset it to 0, it always resets to some arbitrary value.  It's not a big deal though.

Thanks,
-harold
 
Pages: [1]
Jump to:  

Theme Update by Runic Warrior Originally created by m3talc0re