[En-Nut-Discussion] Timer1, AT90CAN128 & NutOS

Jari Heikkilä jaripetteri at gmail.com
Wed Jan 21 20:59:33 CET 2009


Thank you for you help but no go yet...
> The special stack handling option NUTMEM_STACKHEAP is not automatically
> enabled for the AT90CAN128. It must be set in the configurator in addition
> to the CPU selection. However NUTMEM_STACKHEAP is not required for newer
> AT90CAN128 silicon from Revision D onwards. These chips are identified with
> date code ? 0107.
>
>   
I have date code 1807 so it doesn't need NUTMEM_STACKHEAP, right? I'll try to add it to config file but no help. with NUTMEM_STACKHEAP my code doesn't run at all but without my code and sample codes runs otherwise but without interrupts.


Here is one of my test code:

#include <dev/irqreg.h>
#include <sys/atom.h>
#include <dev/board.h>
#include <stdio.h>
#include <io.h>
#include <cfg/arch.h>
#include <sys/timer.h>

static void timer1IRQ(void *arg) {
        PORTG ^= (1 << 3);
        PORTG ^= (1 << 4);
        puts("timer1irq...\n");
}

int main(void)
{
    int i;
    sbi(DDRG, 3);
        sbi(DDRG, 4);
       
        u_long baud = 9600;

    NutRegisterDevice(&DEV_UART, 0, 0);
    freopen(DEV_UART_NAME, "w", stdout);
    _ioctl(_fileno(stdout), UART_SETSPEED, &baud);

    NutEnterCritical();
    // register interrupt service routine
        NutRegisterIrqHandler(&sig_OVERFLOW1, timer1IRQ, 0);
        // configure the speed of the timer
        TCCR1B |= 1<< CS10;
        //TCCR1B |= 1<< CS12;
        // enable the interrupt at overflows of the timer
        TIMSK |= 1<< TOIE1;
        NutExitCritical();

    puts("\nThread Test");
   
    for (i = 0;;i++)
    {
               NutSleep(1000);
            puts("testing...\n");
   
    }
    return 0;
}






More information about the En-Nut-Discussion mailing list