CAN Schnittstelle mit ATMEL STUDIO

Hi,
das ist aber nicht der komplette Code im Atmel Studio.
Ist in der Boardconfig die CAN Schnittstelle richtig initialisiert ?
Was ist mit den includes und dem restlichen drumherum ?

Du kannst im Atmel Studio direkt unter Beispiele. (Beispiel Projekte) den Arduino auswählen und auch dazu ein Can Projekt öffnen. Dieses ist lauffähig. Ich hab diese Beispielprojekte von ein paar Monaten noch verwendet und daraus eine Anwendung programmiert. Bei den Beispielen muss man oft mit dem Watchdog aufpassen, da dieser Standard maäßig aktiviert ist. (16 Sekunden überlaufszeit)

Programmierst du den Arduino über die USB Schnittstelle oder direkt über den Jtag Header mit einem richtigen Debugger ?

Der Code sollte, so oder so ähnlich im Beispiel aussehen:

/**
 * \file
 *
 * \brief CAN example for SAM.
 *
 * Copyright (c) 2011 - 2013 Atmel Corporation. All rights reserved.
 *
 * \asf_license_start
 *
 * \page License
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * 1. Redistributions of source code must retain the above copyright notice,
 *    this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright notice,
 *    this list of conditions and the following disclaimer in the documentation
 *    and/or other materials provided with the distribution.
 *
 * 3. The name of Atmel may not be used to endorse or promote products derived
 *    from this software without specific prior written permission.
 *
 * 4. This software may only be redistributed and used in connection with an
 *    Atmel microcontroller product.
 *
 * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
 * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 *
 * \asf_license_stop
 *
 */

/**
 *  \mainpage CAN example
 *
 *  \par Purpose
 *
 *  This example demonstrates the basic functions of CAN controller.
 *
 *  \par Requirements
 *
 *  This package can be used with SAM3X or SAM4E evaluation kits.
 *  CAN0 and CAN1 should be hooked-up externally before running
 *  the example.
 *
 *  \par Description
 *
 *  In this example, it sends and receives messages over CAN bus to manage
 *  the LED on the board and display CAN message on the terminal window.
 *  There are four basic tests:
 *  - test1: Test the transmission from CAN0 Mailbox 0 to CAN1 Mailbox 0.
 *  - test2: Test the transmission from CAN0 Mailboxes 1 & 2 to CAN1 Mailbox 7
 *    without overwrite.
 *  - test3: Test the transmission from CAN0 Mailboxes 1 & 2 to CAN1 Mailbox 7
 *    with overwrite.
 *  - test4: Test the communication between CAN1 Mailbox 3 and CAN0 Mailbox 3.
 *
 *  \par Usage
 *
 *  -# Build the program and download it into the evaluation board.
 *  -# On the computer, open and configure a terminal application
 *     (e.g., HyperTerminal on Microsoft Windows) with these settings:
 *    - 115200 bauds
 *    - 8 bits of data
 *    - No parity
 *    - 1 stop bit
 *    - No flow control
 *  -# Connect CAN0 (J17 on SAM3X-EK or J13 on SAM4E-EK) and CAN1 (J20
 *     on SAM3X-EK or J14 on SAM4E-EK) in loop.
 *  -# Start the application.
 *  -# Upon startup, the application will output the following lines
 *     on the terminal window.
 *      \code
 *      -- CAN Example --
 *      -- SAMxx-EK --
 *      -- Compiled: xxx xx xxxx xx:xx:xx --
 *      \endcode
 *  -# Press a key in the terminal window to run the tests. CAN messages
 *     will be displayed on the terminal window and LED0 or LED1 will toggle
 *     according to the messages.
 */

#include <stdio.h>
#include <string.h>
#include "board.h"
#include "sysclk.h"
#include "exceptions.h"
#include "uart.h"
#include "pmc.h"
#include "ioport.h"
#include "can.h"
#include "stdio_serial.h"
#include "sn65hvd234.h"
#include "conf_board.h"
#include "conf_clock.h"

#define STRING_EOL    "\r"

#define STRING_HEADER "-- CAN Example --\r\n" \
                      "-- "BOARD_NAME" --\r\n" \
                      "-- Compiled: "__DATE__" "__TIME__" --"STRING_EOL

#define CAN_MSG_TOGGLE_LED_0        0x11223344
#define CAN_MSG_TOGGLE_LED_1        0xAABBCCDD
#define CAN_MSG_DUMMY_DATA          0x55AAAA55

//...