📄 basic-can-project.html
字号:
<!DOCTYPE PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>Atmel Corporation - Basic CAN 1.4</title>
<link rel="stylesheet" type="text/css" href="css/style.css" />
</head>
<body>
<h1>Basic CAN Project 1.4</h1>
<div id="breadcrumb">
<a href="../index.html">Main</a> >
<a href="examples.html">Examples</a> >
CAN
</div>
<h2>Purpose</h2>
<p>
This project uses the Controller Area Network (CAN).
</p>
<div class="requirements">
<h2>Hardware Requirements</h2>
<p>This examples requires one of the following evaluation kits:</p>
<ul>
<li>AT91SAM7A3-EK</li>
<li>AT91SAM7X-EK</li>
<li>AT91SAM7XC-EK</li>
<li>AT91SAM9263-EK</li>
</ul>
</div>
<h2>Description</h2>
<p>
Upon startup, the program will configure the CAN, and make synchronization.
If connected to other board, user can send a frame by pressing a key.
</p>
<p>
The basic will :
<ul>
<li>CAN0 Mailbox 1, transmit, with acceptance mask</li>
<li>CAN0 Mailbox 2, transmit, no acceptance mask</li>
<li>Dump registers (for debug purpose)</li>
</ul>
</p>
<h2>Usage</h2>
<ol>
<li>
Build the program and download it inside the evaluation board. Please refer
to the <a href="http://www.atmel.com/dyn/resources/prod_documents/doc6132.pdf">SAM-BA User Guide</a>,
the <a href="http://www.atmel.com/dyn/resources/prod_documents/doc6310.pdf">GNU-Based Software Development</a>
application note or to the <a href="http://www.iar.se/website1/1.0.1.0/78/1/index.php?">IAR EWARM User Guide</a>,
depending on your chosen solution.
</li>
<li>
On the computer, open the DBGU port with a terminal application
(e.g. HyperTerminal on Microsoft Windows).
</li>
<ul>
<li>Settings: 115200 bauds, 8 bits, 1 stop bit, no parity, no flow control.</li>
</ul>
<li>If you have 2 boards:</li>
<ul>
<li>
Connect the CAN D+ board 1 to the CAN D+ board 2,
and then CAN D- board 1 to the CAN D- board 2.
</li>
<li>Run the software on the 2 boards. You should get the following traces:
<blockquote>
<code>
BOARD 1: (we press the key 1)<br />
-- Basic CAN Project 1.4 --<br />
-- AT91SAM7X-EK<br />
IP version: 0x121<br />
CAN_Synchronisation<br />
-I- CAN0 Initialisations Completed<br />
INIT OK<br />
CAN0 Mailbox 1, transmit, with acceptance mask<br />
<br />
BOARD 2:<br />
-- Basic CAN Project 1.4 --<br />
-- AT91SAM7X-EK<br />
IP version: 0x121<br />
CAN_Synchronisation<br />
-I- CAN0 Initialisations Completed<br />
INIT OK<br />
Press a Key [1:transmit 2:transmit 3:dump register]<br />
Receive Maibox Number: 5<br />
Read data low 0xAABBCCDD<br />
Read data high 0x11223344<br />
CAN0 Mailbox 1, transmit, with acceptance mask<br />
Dump registers<br />
CAN_MR: 0x1<br />
CAN_IMR: 0x1F0000FF<br />
CAN_SR: 0x610000<br />
CAN_BR: 0x23534<br />
CAN_ECR: 0x0<br />
CAN_MB_MMR: 0x1000000<br />
CAN_MB_MAM: 0x20080000<br />
CAN_MB_MID: 0x80000<br />
CAN_MB_MSR: 0x0<br />
CAN_MB_MDL: 0x0<br />
CAN_MB_MDH: 0x0<br />
</code>
</blockquote>
</li>
</ul>
<li>With the AT91SAM7A3:</li>
<ul>
<li>
The AT91SAM7A3 has 2 can on its board. For the test, no need of 2 boards.
Only connect CAN1 D+ to CAN2 D+ and CAN1 D- ton CAN2 D+.
</li>
<li>
Launch the software. The software make a test of the 2 can. You should get the following output
on the DBGU:
<blockquote>
<code>
-- Basic CAN Project 1.4 --<br />
-- AT91SAM7A3-EK<br />
IP version: 0x121<br />
CAN_Synchronisation<br />
-I- CAN0 Initialisations Completed<br />
-I- CAN1 Initialisations Completed<br />
With Interrupt CAN0 Mailbox 0 transmitting to CAN1 Mailbox 0<br />
Test passed<br />
With Interrupt CAN0 Mailboxes 1 & 2 transmitting to CAN1 Mailbox 15<br />
Test passed<br />
With Interrupt CAN0 Mailboxes 1 & 2 transmitting to CAN1 Mailbox 15<br />
Wait, wait, wait, wait<br />
Test passed<br />
With Interrupt CAN0 Mailbox 3 asking for CAN1 Mailbox 3 transmission<br />
Test passed<br />
Without Interrupt CAN0 Mailbox 0 transmitting to CAN1 Mailbox 0<br />
Test passed<br />
Without Interrupt CAN0 Mailboxes 1 & 2 transmitting to CAN1 Mailbox 15<br />
Test passed<br />
Without Interrupt CAN0 Mailboxes 1 & 2 transmitting to CAN1 Mailbox 15<br />
Test passed<br />
Without Interrupt CAN0 Mailbox 3 asking for CAN1 Mailbox 3 transmission<br />
Test passed<br />
</code>
</blockquote>
</li>
</ul>
</ol>
<h6>Atmel Corporation ©2008</h6>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -