00001
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049 #ifndef _CONF_CAN_EXAMPLE_H
00050 #define _CONF_CAN_EXAMPLE_H
00051
00052
00053 #include "avr32/io.h"
00054 #include "compiler.h"
00055 #include "can.h"
00056 #include "board.h"
00057
00058
00059
00060
00061 #define STDIO_USART (&AVR32_USART2)
00062 #define STDIO_USART_RX_PIN AVR32_USART2_RXD_0_1_PIN
00063 #define STDIO_USART_RX_FUNCTION AVR32_USART2_RXD_0_1_FUNCTION
00064 #define STDIO_USART_TX_PIN AVR32_USART2_TXD_0_1_PIN
00065 #define STDIO_USART_TX_FUNCTION AVR32_USART2_TXD_0_1_FUNCTION
00066 #define STDIO_USART_BAUDRATE 57600
00067 #define STDIO_USART_IRQ AVR32_USART2_IRQ
00068 #define STDIO_USART_IRQ_LEVEL AVR32_INTC_INT1
00069 #define FPBA_HZ FOSC0
00070
00071
00072
00073
00074
00075
00076 #if defined (__ICCAVR32__)
00077 can_msg_t msg_tx_sot =
00078 {
00079 0x130,
00080 0x1ff,
00081 0x0102030405060708LL,
00082 };
00083 #else
00084 can_msg_t msg_tx_sot =
00085 {
00086 {
00087 {
00088 .id = 0x130,
00089 .id_mask = 0x1ff,
00090 },
00091 },
00092 .data.u64 = 0x0102030405060708LL,
00093 };
00094 #endif
00095
00096
00097 can_mob_t appli_tx_msg = {
00098 CAN_MOB_NOT_ALLOCATED,
00099 &msg_tx_sot,
00100 8,
00101 CAN_DATA_FRAME,
00102 CAN_STATUS_NOT_COMPLETED
00103 };
00104
00105
00106
00107 #if defined (__ICCAVR32__)
00108 can_msg_t msg_rx_listening =
00109 {
00110 0,
00111 0,
00112 0x0LL,
00113 };
00114 #else
00115 can_msg_t msg_rx_listening =
00116 {
00117 {
00118 {
00119 .id = 0,
00120 .id_mask = 0,
00121 },
00122 },
00123 .data.u64 = 0x0LL,
00124 };
00125 #endif
00126
00127
00128 can_mob_t appli_rx_msg = {
00129 CAN_MOB_NOT_ALLOCATED,
00130 &msg_rx_listening,
00131 8,
00132 CAN_DATA_FRAME,
00133 CAN_STATUS_NOT_COMPLETED
00134 };
00135
00136
00137
00138 #if defined (__ICCAVR32__)
00139 can_msg_t msg_remote_rx = {
00140 0x110,
00141 0x1ff,
00142 0x55AA00000000AA55
00143 };
00144 #else
00145 can_msg_t msg_remote_rx =
00146 {
00147 {
00148 {
00149 .id = 0x110,
00150 .id_mask = 0x1ff,
00151 },
00152 },
00153 .data.u64 = 0x55AA00000000AA55,
00154 };
00155 #endif
00156
00157
00158 can_mob_t appli_remote_rx_msg = {
00159 CAN_MOB_NOT_ALLOCATED,
00160 &msg_remote_rx,
00161 8,
00162 CAN_REMOTE_FRAME,
00163 CAN_STATUS_NOT_COMPLETED
00164 };
00165
00166
00167 const char CAN_Wakeup[] = "\n\r\
00168 === Switch into static Mode...Wait CAN communication... ===\n\r\
00169 \n\r";
00170
00171 const char CAN_WakeupD[] = "\n\r\
00172 === OK: UC3C CAN Wake Up Detected ===\n\r\
00173 \n\r";
00174
00175 const char CAN_Success[] = "\n\r\
00176 === OK: UC3C CAN Communication Successed ===\n\r\
00177 \n\r";
00178
00179 const char CAN_Error[] = "\n\r\
00180 === Error: UC3C CAN Communication Error ===\n\r\
00181 \n\r";
00182
00183 const char CAN_WakeUpIRQ[] = "\n\r\
00184 === Error: UC3C CAN Wake Up IRQ Detected ===\n\r\
00185 \n\r";
00186
00187 const char CAN_BusOFFIRQ[] = "\n\r\
00188 === Error: UC3C CAN Bus OFF IRQ Detected ===\n\r\
00189 \n\r";
00190
00191 const char txt_logo_atmel[]="\r\n\
00192 _____________________________\r\n\
00193 /___ ________________________|\r\n\
00194 ___ | | ________ ____ _\r\n\
00195 / | | | | _ _ \\ | __| | |\r\n\
00196 / /| | | | | | | | | | | |__ | |\r\n\
00197 / / | | | | | | | | | | | __| | |\r\n\
00198 / /_ | | | | | | | | | | | |__ | |__\r\n\
00199 /____||_| |_| |_| |_| |_| |____| |___/\r\n\
00200 ,-----------------------------------,\r\n\
00201 1 - Transmission Mode\r\n\
00202 2 - Reception Mode\r\n\
00203 3 - Remote Reception Mode\r\n\
00204 \r\n\
00205 \n\r";
00206
00207 const char Demo_Sent_Data[] = "\n\r\
00208 -0- TxCAN @ 307: 0x133(Std.), L=8, 01-02-03-04-05-06-07-08; \n\r\
00209 \n\r";
00210
00211 const char Data_Sent_Start_or_Not[] = "\
00212 ===Start demo now? Press y or Y - start\n\r\
00213 === Press n or N - Not start\
00214 \n\r";
00215
00216 #endif // _CONF_CAN_EXAMPLE_H