avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-gcc-list] (AT90can128) CAN doesn't work


From: Ollinad
Subject: [avr-gcc-list] (AT90can128) CAN doesn't work
Date: Mon, 3 Oct 2005 18:14:00 -0300

Hello everybody,

I've just started working with at90can128 and I'm in trouble. I downloaded the atmel's lib for this mcu and i'm trying to run it in avr-gcc, but up to now, nothing.

Does anybody did this?

if not, i'll try to explain what i'm doing...

I have 2 stk500 with 2 stk501 and 2 at90can128, i want then to talk. I'm trying with the code from Atmel, the lib they have there for this mcu but to IAR compiler... it is a polling loop_back_without_interrupt. I made this compile... and I made another piece of code to generate a CAN pack in the other mcu... OK that's all beautiful but it doesn't work...

I know it is dificult to understand but there we go...

I guess the sender, is correct (I made it ;-), but using the atmel lib ) so let's go to the receiver loopback:

this is where everuthing happens:

void loop_back_without_interrupt(void)
{
    unsigned char buffer[8];
    st_cmd_t msg;     // message descriptor store in code area

    msg.pt_data = &buffer[0];
    msg.status = 0;
    msg.handle = 0;

    do{
        msg.cmd     = CMD_RX;
        PORTB = 0xfe;
        while(can_cmd(&msg) != CAN_CMD_ACCEPTED);
        while(can_getstatus(&msg) != CAN_STATUS_COMPLETED);
        PORTB = 0xfd;
        if (msg.ctrl.rtr) {
            msg.cmd = CMD_TX_REMOTE;
        } else {
            msg.cmd = CMD_TX;
        }
        PORTB = 0xfb;
        while(can_cmd(&msg) != CAN_CMD_ACCEPTED);
        while(can_getstatus(&msg) != CAN_STATUS_COMPLETED);
    } while(1);
}

but it nevers get out of the second loop... the one wich checks the status!

can anyone help...

Thanks in advance,



--
Mr. Santos, Danillo Moura  - Computer Science Student - UFSC
Home:            (48) 91347806    (48) 3382755
Parents Town: (13) 97869780    (13) 32372723
reply via email to

[Prev in Thread] Current Thread [Next in Thread]