Component - Controller Area Network V2.1 Datasheet (Chinese).pdf

®
PSoC Creator™
ª«‡¬-®¯ (CAN)
2.1






CAN2.0A/B
ISO 11898-1
8 MHz (BUS_CLK)
1 Mbps
€•‚€ƒ„…†‡ˆTx‰Rx Š Enableˆ‹Œ••
Ž••
‘’“”‡
š›œ•žŸ
•–“
—˜ 1”Š“
—˜ 2”—™
¡Š¢£
¤ PSoC 5 ¥¦§
¨©
ª«‡¬-®¯ (CAN) ª«‡
ISO-11898-1
µ
¶
Bosch °±²£³
CAN2.0A Š CAN2.0B °±
´
‹· CAN
CAN
¸¹º»¼½¾¿·ÀÁ
ÂÃÄ Å ÆÇÈɵŒÊËÌÍÎÏ ÐÑ
Ò
ÓÔ ÕÖµ×Ä ½¾¿·²ØÙÚÛÜÐÝ CAN Þ·ßàáâ㪫®¯ (CANOpen)
Šäåæáç¿· (DeviceNet)
ÓÔ
µCAN ª«‡èéêë ÝŒ ŒÊ ì
í
ž
î¥ïðñòª«‡ CPU ÖŒµ
óô/ó
óõ‚€
јö÷ CAN
" # I/O δ
óôŠóõ‚€µI/O øù²
$µ
úû (*) ùü
I/O ýþ²øõ ÿ!
rx – óô
CAN %
€…Ôûˆ‚€&ƒ„…†‡
Cypress Semiconductor Corporation
Document Number: 001-79425 Rev. **
CAN Rx %
•µ
• 198 Champion Court • San Jose, CA 95134-1709 • 408-943-2600
Revised: May 18, 2012
®
ª«‡¬-®¯ (CAN)
PSoC Creator™
ù
tx– óõ
CAN %
†›Ôûˆ‚€&ƒ„…†‡
CAN Tx %
•µ
tx_en – óõ *
ƒ„…†‡‹ŒÔûµ' Configureˆ()•¼*+²,- Add Transceiver Enable Signal
ˆ./…†‡‹ŒÔû•,0
1ü2óõµ
²3 – ó õ *
2²3óõ× CAN •
²3 [email protected]











†›
‘’
€…
‘’
AB
€…CD¬
%
²
()
²345áµ6é4789:“ ”à;Í<=¸>óõÔûµ
EFGH
ÈÉ&
CRC IJ
ÈÉ&
‘’KLIJ
ÈÉ&‘’, ËMIJ
ÈÉ&NOPIJ
ÈÉ&JQ
€…&“RS
ÈÉ&TUVW
'Configureˆ()•¼*+²Interruptˆ²3•,0X Advanced Interrupt Configuration…
ˆ ž²3()…•Y•²,-ÚEnable External Interrupt LineˆZ·ƒ„²3 •,0
1ü2óõµ
Page 2 of 40
Document Number: 001-79425 Rev. **
®
PSoC Creator™
CAN
‰Šƒ„‡ˆ
‡ˆ
“
(CAN)
“ƒ„‹Œ”
CAN
•Ž••‘‡ˆ
CAN
’
•
€•‚ƒ„…ƒ†
”
• CAN
–„
‡¬-®¯ CAN
—
‘˜™š›œ• ConfigurežŸ
°±
¡¢£
¤¡¢£¥¦§¨©ª‘«
²³´µ
¶·¸•¹ º»²³ CAN
‘-•¼‚½¾” ¿ À³ Á ÃÄÅÆÇšÈ •É‘
œ• ConfigurežŸ
¡¢£‘Ê˲ÌÍΔ ¨©‘ÏЙ OKžÑÒ ›ÓÔ²Ì
ÍÕ¨©ª
GeneralžÍÕ
¨©ªÖ×›Ø
Ù
žÚÛÜÝ
Add Transceiver Enable Signalž
••à CAN ÜÝ
á
âã
Document Number: 001-79425 Rev. **
tx_en
ß
Þ
ß
á
Page 3 of 40
®
(CAN)
Ýäåæ
Òéê
PSoC Creator™
çè
ÝäçèëìÙ

í îž
– åæ ›ïÒé ðñòóÙ0-1-2 ... 7-0-1 ôÒ åæ õŠ
TxReq ÷øù«¨ú ÉëìÓûÀï¥åæ ü¥‹ý ê Ýäþÿ

!Ò"#$– åæ
%#Ýä*+ê
0 ü¥%&"#$
'(‘«•åæ
0 )Ò•*+ê
Àö
åæ
‘Óû
,-./0³á1
Ÿ


2345Ù
6 1ž
– ,-./•7‘ÄÅ0³á1 CAN
:1 – ,-./•7‘Š 128
'
89
11 Γ;<”3•7‘:10³á1 CAN
CAN ,-‹Œ=>
Ÿ


[email protected]Ù
‘R’ ‚ ‘D’ž
– ¸ ‘R’ž;<
‚ ‘D’žA¥
?@
BCó‹Œ
˜?@ – ˜?@ BCó‹Œ
Page 4 of 40
Document Number: 001-79425 Rev. **
®
PSoC Creator™
(CAN)
Òù¨©ª
Òù¨©ªÖ×›Ø
Ù

BRP –
7FFFh


Tseg1 – ùEF 1
K
Tseg2 – ùEF 2
STK 2
(»UÂ
K RSTK 0 … 1QõŠ•(
BD¯ùEF GôÿHIJ K
M 32767 ÎùNOP‘15 ÎGô
ØXYMÀ CAN GôÒù
Gô—L
B—LÉK
0
M 1 ÎùNOPQ
•V•¿( (1-Sample) ùW
MÙ
Nominal Bit Time = 8...25 TQ (Time Quanta)
SJW: 1...4TQ
Tseg1
prop_seg + phase_seg1
Synchronization
Segment
Document Number: 001-79425 Rev. **
Tseg2
phase_seg2
Sample Point
1 or 3 Sample Mode
Page 5 of 40
®
(CAN)
PSoC Creator™
—L




ùNJÿžÐ3ÙMHz – Z[ùNJÿýB BUS_CLK
\]
^ôÿžÐ3ÙKbps
SJW – ‹Œ`Æab Ÿ
2_3 â 4
(»UÂ – ¿(UÂ Ÿ
Š—LÀ3Òù•7‘”
g°˜™hi ó¨ú]Ûj
– ¨©•Ù10_20_62.5_125_ 250_500_800 â 1000
ž2 3
KRcdB Tseg1 eRcdB Tseg2
¨©•Ù1-Sample â 3-Sample
YMÀùEFžTseg1 … Tseg2 … BRP
K ¨ú KYMŠkà Settingsž
ƒ„£61ƒ„ Tseg1_Tseg2 … BRP
’«›¨úŠlm
no *+ 3Òù
p¬q CAN
ÓrŠ*+st
Ø
¶uvD:wx
My
YMÀï¥Òù
¨©•Ù1_
89fÔ
ƒ„£
«
K
3ùEF
ž‹ŒF
SYNC SEGž
ÉàI
3ùE
Page 6 of 40
,-z
{Î|}Ó~‹Œ
ÍÎ[email protected]ÉF
Document Number: 001-79425 Rev. **
®
PSoC Creator™
(CAN)
ž•ƒùEF
PROP SEGž
€
‚ƒ„€
•
PHASE SEG1
Ž•ˆ
•
…†
‡ˆ
PHASE SEG2‡
‰Š‹Œ•‘
’“ˆ
‰Š‹Œ 1/2•
•
”•
–—˜™š›œ
•žŸ
Ž•‹Œ
¡¢£
¡¢£
¤¥¦§¨©ª«¬-
®
‘ PHASE_SEG1 ¯°±
£
²±
²±
³‘«´µ¶·
¤¥¸¹º
¡¢£
Œ
Œ
Œ »¼½¾¿ ÀÁ ÂÃ
Ä
ÅÆÇ–ÈÉÊ
32767 »ÒÓ
ŒÔ³Ì
Œ•Õ–«
Œ = m × ÒÓ
Ö
m
Ê
Ë€ (BRP)ÌÍήÏЫ 1 Ñ
Œ
Ë€ ®
Œ•Õ




SYNC_SEG
•Õ« 1 Ç
PROP_SEG
•Õ–ÈÉ« 1
Œ
2
PHASE_SEG1
•Õ–ÈÉ« 1
PHASE_SEG2
PHASE_SEG1
Document Number: 001-79425 Rev. **
…
2
8Ç
…
Œ
8Ç
Œ
Ò×®• ²±
Page 7 of 40
®
ª«‡¬-®¯ (CAN)
PSoC Creator™
ù
²3,0X
[Ѳ3()
Basicˆ[Ñ•Interruptˆ²3•Configurationˆ()•,0X?\Í"À)Ÿ
‹Œ²3
] CAN ª«‡²Z·
Z· -
^·_`²3µaMZ·µ
‹· CAN_Start() Zá CAN
Z·_`²3µ
^· - ‹· CAN_Start() Zá CAN
¥Z·_`²3µ_`²3Z·NÀ)b¥ïcô
CAN ISRµd¿‹· CAN_GlobalIntEnable()
CAN_GlobalIntDisable() efQ²Z· ^·
_`²3µ
†›
‘’
Z·
,0
^·‘’šó²3 ‘’šó²3ùüA†›Ú7g‘’µaM^·µ^·‘’šó²3
ºh^·6éšóCD¬²3i
CAN 1üÍ"‘’Ÿº

º - Ø‘,² Message Transmittedˆ‘’Ašó•j,+
ˆšóCD¬•,0Xk 6élmšóCD¬²3µ

hˆaM•- Ø‘,² Message Transmittedˆ‘’Ašó•j,+
BuffersˆšóCD¬•,0Xk 6élmšóCD¬²3¥nµ

Ø‘ - oípµ
Page 8 of 40
´Ø‘,² Transmit Buffers
´Ì§ Transmit
Document Number: 001-79425 Rev. **
®
PSoC Creator™
A€…
Z·
,0
ª«‡¬-®¯ (CAN)
ù
‘’
^·‘’€…²3 ‘’€…²3ùüA€…Ú7g‘’µaMZ·µ^·‘’€…²3
ºh^·6逅CD¬²3i
CAN 1üÍ"‘’Ÿº

ºˆaM•- Ø‘,² Message Receivedˆ‘’A€…•j,+
Buffersˆ€…CD¬•,0Xk 6élm€…CD¬²3µ

h - Ø‘,² Message Receivedˆ‘’A€…•j,+
D¬•,0Xk 6élm€…CD¬²3¥nµ

Ø‘ - oípµ
AB
´Ì§ Receive Buffersˆ€…C
€…CD¬
Z· ^·‘’qV²3
^·µ
%
´Ø‘,² Receive
rùü
k7s‘’ÞhM
CAN ª«‡€…&7st‘’µaM
EFGH
Z·
^·%
ÈÉ&
Z·
Z·
Z·
rùü CAN ª«‡ÈÉ& CAN ‘’KLIJµaM^·µ
‘’ËMIJ
rùü CAN ª«‡ÈÉ& CAN ‘’ËMIJµaM^·µ
NOPIJ
^·NOPIJ²3
ÈÉ&
EFGHµaMZ·µ
‘’KLIJ
^·‘’ËMIJ²3
ÈÉ&
&%
rùü CAN ª«‡ÈÉ& CAN CRC IJµaM^·µ
^·‘’KLIJ²3
ÈÉ&
u
CRC IJ
^· CRC IJ²3
ÈÉ&
Z·
rùü CAN ˜
EF²3
rùü CAN ª«‡ÈÉ&NOPIJµaM^·µ
JQ
Z·
^·NIJ²3
€…
“RS
Z·
^·“R²3
rùü CAN ª«‡ÈÉ&NIJµaM^·µ
rùü CAN ª«‡€…&“RSµaM^·µ
Document Number: 001-79425 Rev. **
Page 9 of 40
®
ª«‡¬-®¯ (CAN)
ÈÉ&
Z·
PSoC Creator™
ù
TUVW
^·vwAxy‘’
TUŠØ‘µ2²3ùü†›‘’
qVTUµaM^·µ
ž²3()
Advancedˆ
ž•Interrupt Configurationˆ²3()•,0X?\Í"À)Ÿ
Z·ƒ„²3
Z· CAN z{²3
$•µ
ƒ„
|ÖŠ‚€µaM^·ˆ
CAN
û
}²
ƒ„²3
¥
^·~„ ISR
^·
•“~„ ISR
„ …†
ISR
’“”
‡ˆ‰
•
ISR
Š‹Œ
ISR
CAN API
ISR
/
Enable External Interrupt Line
€
•Ž •• € •‚ƒ ‘ •‚„ ˆ‰
•‚ƒ
ISR
– —’“” •˜™š
ISR ›
… œ„ CAN_ISR
PSoC 3 ES1/ES2 ISR ¡ ¢£š” •˜™¤¥¦§¨
•˜™žŸ•‰
š
/* Place your Interrupt code here. */
/* `#START CAN_ISR` */
/* `#END` */
Page 10 of 40
Document Number: 001-79425 Rev. **
®
PSoC Creator™
ISR
¬-®¯°±² (CAN)
©ª«
³ CAN v1.50 ISR ‘
´† ‡ ‰
‹Œ
Disable Internal ISR
ISR µ¶·¸¹
£
š•‚¹
ÃÄ
‘
ISR
º
»¼•‚½¤ ¾
CAN v1.50 •
‰ -·¸ ISR µ¶
ISR µ¶¹
•‚Ò Á
Disable Internal ISR
œÅÆ£
Ç
ÓŠ
ÔÕÖׯ
Èɉ
Š
›¿À•‚„
CAN ISR »¥Á
Ê ËÌ •Í‰ÎÏÐÑ •‚š” •
Full Custom Internal ISR ’“” •
ISR „ ÃÄ œˆ‰
ϯ
Receive Buffers
ÔÕÖׯ
œØŸ•ÙÚ½¤¨
ÛÜ
ÔÕÛÜÝ
Þß º Full ’“
RTRáRTRreply Ë IRQ âãÍÝä
Ç Basic
»¼
à•Á
ÛÜš IDEáIDá
Ð¥’“ÛÜ Mailbox ÛÜ âã‰åæ £‰çèéêšÛÜëì
¥
íîÛÜš
API ¢ïðÛÜâñò Ôóšñô•¨A–Záa–zá0–9 Ë _
£çèõöšëì ¢÷ø
õöùú Ó Mailbox ÛÜ âãûü
ý
Document Number: 001-79425 Rev. **
Page 11 of 40
®
¬-®¯°±² (CAN)
PSoC Creator™
©ª«
’“
Full ’“ „ ‰þÿ Mailbox ÛÜ áIDEáIDáRTRáRTRreplyáIRQ Ë
Linking !Ô âã ÃÄâã– ÙÚ
ý"¦#$%¨







ÛÜ = ÛÜåô 0 & 15
IDE = Á'(
ID = 0x001
RTR = Á'(
RTRreply = Á'(ËÁä
IRQ = Á
º
º
RTR „
Message Received
•‚
ùúÁÔÕ
ϯ
„‰
!Ô = Á'(
»¼
º
œ IDEáIDáRTR Ë RTRreply
»¼
‰
ÃÄâã–
ÙÚ
ý"¦#$
%¨






IDE = Á'(
ID = <“
>
‰
‰
RTR = Á'(
‰
RTRreply = Á'(
IRQ = Á'(
‰
º
Message Received
ùúÁÔÕ
•‚„‰
!Ô = Á'(
IDE
› IDE † ‡Ý'(„ )*ñ+,--³ 11 .
+,--³ 29 . 0x00000001 & 0x1FFFFFFE
RTR - /
º
IDE „
)*ñ
0ç12
3 ¥½¤³ÔÕ’“ CAN ùúšÛÜ
Á½¤ RTR .šùú
Page 12 of 40
0x001 & 0x7FE
º…
œ4
¢5¤Ôó67½¤
Ù
ÅÆÔÕ
Document Number: 001-79425 Rev. **
®
PSoC Creator™
(CAN)
RTRreply €• CAN ‚ƒ„…
RTR
‹
ˆ”•
† RTR ‡ˆ‰Š‹Œ•ŽŒ••„‘
’“
IRQ
žŸŒ• žˆ Message Received Interrupt¡‚ƒ
–—‰Š˜ IRQ ™„š›œ•†ž
•¨“‚
‚ƒ
žŸ”©
©ª ‹«¬˜ -®
žŸ¢„‘£¤¥¦‚ƒ§•

« - Œ• IRQ Œ¯„…Œ• Interrupt¡žŸ¢Œ•
¡‚ƒ
žŸ¢ Œ¯‹

¬±²
²‚ - Œ• IRQ Œ¯„…³´ Interrupt¡žŸ¢Œ•
Interrup¡‚ƒ
žŸ¢ Œ¯µ¶‹
°ˆ Message Received Interrupt
°ˆ Message Received
·
Œ• Linking¡· ¢ Œ¯„¸· ¹º»¼ˆ
‰Š„¥½¾
‰Š¿À‹Ž¿ÀÁ
FIFO ˆÂÃÄÅ‹ÆÇ¿ÀˆÈɉŠÊËÌÉÍƈ‚ƒÎÏ
„ÐÑ«Ò„Ó ÔÕÖ×
(AMR) ØÓ ÙÚÖ× (ACR) ÇÛ‹





¿ÀˆÜ•Çº‰Šµ¸
ܕǺ‰Š 15 µ¸
ÈÉ©·
·
ˆ‰Š
·
ÝÞ‹
· ÝÞ‹
ÆÇßàáâ㣤‹
žäÉåǺ‰Š¸Ùæ‹ÈÉç
–—ÈÉ©·
‰ŠêëǺì
è
éÆÇ¿ÀžÈÉ·
ˆ‰Š‹
‹
‚ƒì
íº€• RX ‰ŠîÉǺïðñˆ API‹CAN_1_TX_RX_func.c •òó žÉì À ‹ôõ
ì «ö÷ø Ùùˆ„ô²ú
‰Šˆ
‹äÉðñ €•ˆ‰ŠûÙùü ˆì ‹
ýþÝÿ! CAN_1_RXx_FUNC_ENABLE ðñ«¬Ùùì
ž‹
‹ðñÀ¤" CAN_1.h •òó

#$ꂃ
žŸ™„‘% CAN_MsgRXIsr() ì ‹Žì &'(ÎÈÉ
‰Š„…)
*+ü ˆ“‚ƒ¸ ÝÞ”¡MsgAv - ,²§0 -.‚ƒ¸ /1 É.‚ƒ¸ ¢Ø“žŸ0Ô
¡
žŸ0ç0 ª žŸêë„1 ˜ žŸê뢄¥ëÂ
CAN ‚ƒ‹

š›˜ † Message Receive¡‚ƒ
¢žŸ„#
邃™„‘%
CAN_ReceiveMsgX() ì „+ž X ¤€• CAN ‰ŠÙ1± 2ðñˆ34‹
Document Number: 001-79425 Rev. **
Page 13 of 40
®
(CAN)

PSoC Creator™
— ÈÉ5 žŸˆ56 CAN ‰Š„‘% CAN_ReceiveMsg(uint8 rxMailbox) ì
+ž„rxMailbox ç
¤
邃ˆ‰ŠˆÙ1‹
„
’“ 7
‚ƒ API ˆ
¥¦89Ò:
CAN_1.h ó
;‹
§
…
#define CAN_1_RX0_FUNC_ENABLE 1
#define CAN_1_RX1_FUNC_ENABLE 0
#define CAN_1_RX2_FUNC_ENABLE 1
…
CAN_1_TX_RX_func.c ó
§
#if(CAN_1_RX0_FUNC_ENABLE)
void CAN_1_ReceiveMsg0(void)
{
/* `#START MESSAGE_0_RECEIVED` */
/* `#END` */
CAN_1_RX[0].rxcmd.byte[0] |= CAN_1_RX_ACK_MSG;
}
#endif
#if(CAN_1_RX1_FUNC_ENABLE)
void CAN_ReceiveMsg1(void)
{
Page 14 of 40
Document Number: 001-79425 Rev. **
®
PSoC Creator™
(CAN)
/* `#START MESSAGE_1_RECEIVED` */
/* `#END` */
CAN_1_RX[1].rxcmd.byte[0] |= CAN_1_RX_ACK_MSG;
}
#endif
–— CAN
‚ƒ 2 %
¥¦ì
56 CAN …˜
„7
žŸ‹
void CAN_ReceiveMsg(uint8 rxMailbox)
{
if (CAN_1_RX[rxMailbox].rxcmd.byte[0] & CAN_1_RX_ACK_MSG)
{
/* `#START MESSAGE_BASIC_RECEIVED` */
/* `#END` */
CAN_1_RX[rxMailbox].rxcmd.byte[0] |= CAN_1_RX_ACK_MSG;
}
}
CAN_1_INT.c ó
void CAN_1_MsgRXIsr(void)
{
…
/* RX Full mailboxes handler */
switch(i)
{
case 0 : CAN_ReceiveMsg0();
break;
case 1 : CAN_ReceiveMsg1();
break;
default:
break;
}
…
}
š›<=†· „ø Ùùè
(MsgAv) ÝÞ>[email protected]
‹
šA
AMR Ø ACR "¸
¥¦« ACR/AMR Ö×
† IRQ ÝÞˆ‰Š‹ÈÉ
ì
(Îœ•‚ƒ¸
B ID 8C
¤9§
[31:3] – Identifier(ID[31:21] – identifier when IDE = 0, ID[31:3] - identifier when IDE = 1), [2] – IDE, [1] – RTR, [0]
– N/A;
Ó
ÔÕÖ×
AMR§ ‘0’
‘1’
(AMR) ðñ«¬–—Ó
–—üº ACR )*
ÙÚÖ×
D‡‹#
(ACR) )*
D‡µE7ü
D‡‹
ˆ ACR ‡™„µ
B‚ƒ‹
D‡-FGH‹
Document Number: 001-79425 Rev. **
Page 15 of 40
®
(CAN)
PSoC Creator™
9š„I
‰Š¥
" 0x180-187JIDE = 0¡©œ•¢JRTR = 0¡©œ•¢J‰Š 5 8C
žˆ ID„KL¥¦MNOP§
Q ID ˆRS8C„9š 0x180„¥TÍèˆ IDE Ø RTR‹—
Ø ACR Ö×
¥¦U§





ACR[31:21] = 0x180
AMR[31:21] = 0x0
ACR[ 20:3] = 0x0
AMR[20:3] = 0x3FFFF (all ones)
ACR[2] = 0
AMR[2] = 0
ACR[1] = 0
AMR[1] = 0
ACR[0] = 0
AMR[0] = 0
ðñ8C ID¡11 ‡¢ˆV




0
WX§
0x180 = 0`b001 1000 0000
0x187 = 0`b001 1000 0111
Mask = 0`b001 1000 0XXX
ACR[31:21] = 0’b000 0000 0111
YÊË" AMR Ö×





Ž IDJIDE Ø RTR U„AMR
ž
1 Z[“XXX”T\]!^_V
‡‹ô`„•¼U
ACR[31:21] = 0x180
AMR[31:21] = 0x7;
ACR[ 20:3] = 0x0
AMR[20:3] = 0x3FFFF - all ones;
ACR[2] = 0
AMR[2] = 0
ACR[1] = 0
AMR[1] = 0
ACR[0] = 0
AMR[0] = 0
CAN_RXRegisterInit() ì
aD‰ŠÙ1 5 ˆ AMR Ö×
§
§
uint8 result = FAIL;
uint16 temp_amr;
uint16 temp_acr;
/* Upper address value, so address is shifted */
temp_amr = (0x7 << 21);
/* obtain necessary value to put in AMR */
temp_acr = (0x180 << 21);
/* obtain necessary value to put in ACR */
if (CAN_RXRegisterInit(&CAN_1_RX[5].rxamr, temp_amr))
{
if ((CAN_RXRegisterInit(&CAN_1_RX[5].rxacr, temp_acr))
result = SUCCESS;
Page 16 of 40
Document Number: 001-79425 Rev. **
®
PSoC Creator™
}
return result;
(CAN)
/* error – if return no zero value; */
ÉG AMR Ø ACR 7 ˆb¹cdeƒ„
(CAN)”lm‹
’“
çf PSoC® 3 Ø PSoC 5® ghçijkžˆ“
Υ
Transmit Buffers¡
’“
¢Œ•
no¥¦
§
‰Š
— €•‰Š„Mailbox¡‰Š¢]p¸Ùæ„Y¸ DǺqLj‰Š34‹
rsüº‰Š
ˆì ‘MN‰Š]!t‹ Bˆ]!ɧA–ZJa–zJ0–9 Ø _‹š› Duv34„Mailbox
¡‰Š¢]pw
[email protected]
ۥ
Œð† Full¡€•¢™„¸yz Mailbox¡‰Š¢JIDEJIDJRTRJRTRreplyJIRQ Ø
Linking¡· ¢]p‹ôõ]p0 ¥¦[email protected]{L|}~§


‰Š = Ù1 0 é 7
IDE = ©œ•
Document Number: 001-79425 Rev. **
Page 17 of 40
®
(CAN)




ID = 0x01
RTR =
DLC = 8
IRQ =
Basic€
•ŒŽ••‘
Š‹Œ„…†
Ÿ ¡





PSoC Creator™
•‚ ƒ„…†
‡ IDˆRTR ‰ DLC
’“ CAN ”•–—„˜™–—•Œš
›œ•ž
IDE =
ID = ¢€Š‹Œ•
RTR =
€Š‹Œ•
DLC = 8€Š‹Œ•
IRQ =
IDE
…† IDE ‚ ƒ
£¤¥¦§Š‹¨© 11 ª€« 0x001 ¬ 0x7FE•„…†
IDE
-®•Œ 29 ª£¤¥€« 0x00000001 ¬ 0x1FFFFFFE•„Š‹
0x000 ¯ 0x7FF€11 ª•
¯ 0x1FFFFFFF€29 ª•£¤¥„
ID
”•£¤¥„
RTR
°”•±²³´•µ¶”•„
DLC
”•·¸“–¹
„
IRQ
IRQ ªº»¼ Message Transmitted€”•
Page 18 of 40
½¾
´••€½
‡¿•„
Document Number: 001-79425 Rev. **
®
PSoC Creator™
(CAN)
…† Message Transmitted€”• ´••‚
”•´•½¾” ÆŒ„±ÇÈŒÉÊ
“”


±-
ƒ
IRQ À
ÁÂÚ
ÄÅ
”•¡Ä
½¾ ‡¿½“ Message Transmitted Interrupt€”•´•½¾•‚
IRQ ‰½
ǯº
º” ƒËÌ
½¾
IRQ„½
Í΄
ƒ„
‡¿½“ Message Transmitted Interrupt€”•´•½¾•‚
CAN TX Ï
ÐÑÒÄ TX
Ï ±ÚÛÜ
ÓÑÔÕÖ“ API„CAN_1_TX_RX_func.c ‡×Ø ½ Ï Ù „˜™
ÝÞ“ ˜º»¼´•
“ßà„á ÕÖâÒÄ“
ãÝÞäå“Ï „
æ磤¥ CAN_1_TXx_FUNC_ENABLE ÕÖ±ÇÝÞÏ
CAN_SendMsgX() Ï
îÕÖ“ïð„
錼
êàâÄë“ Tx
„ÕÖÙÃè CAN_1.h ‡×Ø
ì½ X
ÃÄë CAN
½„
Ýí¯Œ
´•ñò êà
š
óôõö´• API “Œ÷„
CAN_1.h Ø
#define CAN_1_TX0_FUNC_ENABLE 1
#define CAN_1_TX1_FUNC_ENABLE 0
Document Number: 001-79425 Rev. **
Page 19 of 40
®
(CAN)
PSoC Creator™
CAN_1_TX_RX_func.c Ø
#if(CAN_1_TX0_FUNC_ENABLE)
uint8 CAN_1_SendMsg0(void)
{
uint8 result = SUCCESS;
if (CAN_1_TX[0u].txcmd.byte[0u] & CAN_1_TX_REQUEST_PENDING) ==
CAN_1_TX_REQUEST_PENDING)
{
result = CAN_FAIL;
}
else
{
/* `#START MESSAGE_0_TRANSMITTED` */
/* `#END` */
CY_SET_REG32((reg32 *) & CAN_1_TX[0u] |= txcmd CAN_SEND_MESSAGE);
}
return result;
}
#endif
â
´•
øù“úŒÏ
â¡
uint8 CAN_SendMsg(CAN_TX_MSG *message)
⌼ûü CAN ´•”•






ID - …† ID $·%š
“ýŒþÿÕÖ“Ó!"#¡
&'À“(
¡
 )¼£*”• (IDE = 0)
£¤¥¦§(
â 11 ª€0x001 ¬ 0x7FE•„
 )¼+,”• (IDE = 1)
£¤¥¦§(
â 29 ª€0x00000001 ¬ 0x1FFFFFFE•„
RTR€0 - £*”•
IDE€0 - £*”•
DLC€ÕÖ
1 - 0xFF¡”•½ßà“ RTR ª•
1 - 0xFF¡+,”••
–¹ 0 ¬ 8
IRQ€0 - IRQ •/
9 ¬ 0xFF “
-.¼ 8 Ñ
–¹•
1 - 0xFF¡IRQ ÆŒ•
DATA_BYTES€0102Ž
3Œ CAN_SendMsg() Ï
‹Œ
¡

’
À
´•
Ï
“ 8 –¹“"#•
4560Õâ
CAN
“´•”•
;9¬ÓÑ<à“
CAN
À =© CAN_TX_MSG "#“
6‚
´•
½„;”•œ‘´•?ÙÀ Á²³[email protected]ìýŒþÿ„
Page 20 of 40
789:ÓÑ
¬>ý“ CAN
Document Number: 001-79425 Rev. **
®
PSoC Creator™

(CAN)
…B9¬<à
¬ýŒþÿ„
Ï
ÁCœ•DEFG„…†
CAN_TX_MSG "#·¸´•”•
’“
FG
HI
Á²³“HI”0Ã
J•¡
typedef struct _CAN_TX_MSG
{
uint32 id;
uint8 rtr;
uint8 ide;
uint8 dlc;
uint8 irq;
CAN_DATA_BYTES_MSG *msg;
} CAN_TX_MSG;
èÓÜ”•½
CAN_DATA_BYTES "#·¸KÑ
–¹„
typedef struct CAN_DATA_BYTES_MSG
{
uint8 byte[8u];
} CAN_DATA_BYTES_MSG;
ÀL
CAN
VW„
MN¬ BUS_CLK ÀLJí„’OPQ 8 MHz šRÌ
ST 1 Mbps “£* CAN U
Xà
CAN
XàèYÕÏ
CAN Z[½„
Document Number: 001-79425 Rev. **
Page 21 of 40
®
(CAN)
PSoC Creator™
€\]•
Resources€
API Memory API ¸¾—€
» ¿€
Digital resources
»¼½€
Description
tx_en È
ªÄÅ
tx_en È
‹
tx_en È
*CAN
€
ŽÈ
ÄÅ
ªÄÅ
CAN IP -Æ
1*
1
4156
18
2
1*
1
4156
18
3
1*
1
4156
18
4
ɇ
ŽÈ
ŽÈ
‡
É‹
•Œ^_½“`Œ CAN a
Flash
Ç ¸€
Pins ÀÁ€
ÂÃÄÅ I/O€
€
Interrupts
Ž€
RAM
Z[„
ýŒþÿÝþNb
ýŒþÿÝþNb (API) cþÿ-®d•Œe
õö„š ä¹ÁghijklÐÑÏ „
êà
„
Ùf
ÐÑÏ
“Nb
7ϥ
PSoC Creator Ámôïð“CAN_1”nêo0Õßp½
“:ÓÑmô„d‹šÁ
qmôrsïâ¥t£¤¥u÷vw“xyzÓ›„môïð{@âÐÑÄÅÏ ïðˆ|-‰
“CAN”
Description
€
CAN_Start()
•‚ initVar ƒ
CAN_Stop()
‡
CAN_GlobalIntEnable()
Š CAN ˆ‰
‹
Υ
Ž
CAN_GlobalIntDisable()
Š CAN ˆ‰
‡
Υ
Ž
CAN_SetPreScaler()
•‚Š BUS_CLK ••‘’“
CAN_SetArbiter()
•‚˜™š›œ
CAN_SetTsegSample()
¡‚¢‘’“ 1£‘’“ 2£¤¥¦§¨©ª«¬-®
CAN_SetRestartType()
•‚¯°Ÿ
CAN_SetEdgeMode()
•‚±-®
CAN_RXRegisterInit()
²³´µ¶ CAN ·¸—
CAN_SetOpMode()
•‚¹º-®
Page 22 of 40
„
CAN_Init()
…†„
CAN_Enable()
CAN ˆ‰
”•–—
•žŸ
Document Number: 001-79425 Rev. **
®
PSoC Creator™
(CAN)
Description
CAN_GetTXErrorflag()
0x60
CAN_GetRXErrorflag()
0x60
ۥ
CAN_GetTXErrorCount()
CAN_GetRXErrorCount()
ۥ
CAN_GetErrorState()
CAN
‚
ƒ„
CAN_SetIrqMask()
…†‡ˆ‰Š‹‰Œ•‚Ž••
CAN_ArbLostIsr()
‘’“”•–Ž•
CAN_OvrLdErrrorIsr()
‘’ —
CAN_BitErrorIsr()
‘’˜
CAN_BitStuffErrorIsr()
‘’˜™š
CAN_AckErrorIsr()
‘’›œ
Ž•
CAN_MsgErrorIsr()
‘’•ž
Ž•
CAN_CrcErrorIsr()
‘’ CRC
CAN_BusOffIsr()
‘’Ÿ
CAN_MsgLostIsr()
‘’¨©•–Ž•
CAN_MsgTXIsr()
‘’
CAN_MsgRXIsr()
‘’€•¨©Ž•
CAN_RxBufConfig()
¤Œ•³´»†¼½€•¾¿
CAN_TxBufConfig()
¤Œ•³´»†¼½
CAN_SendMsg()
ÀÁÂ-¯³´ŽÃĨ©
CAN_SendMsg0-7()
ÅƳ´ 0-7
CAN_TxCancel()
ʨ
CAN_ReceiveMsg0-15()
›œ•ÏШ©
CAN_ReceiveMsg()
‘’€•Œ•¨©Ž•
CAN_Sleep()
Ñ CAN
ÒÓÔÕÖ×
CAN_Wakeup()
Ñ CAN
ÒÓØÙÖ×
CAN_Init()
Ú
CAN_Enable()
ˆ‰ CAN
CAN_SaveConfig()
â¿ã仆
Ž•
Ž•
Ž•
Ž•
£ CAN
¡¢Ž•
…¤¥¦§ž
¨©Ž•
ª«¬-®-¯°±²Ž•‚³´µ‰¶›‚·¸¹º
½Ç
ËÌÍÈÎ
“»†”¬ÛÜ…†
Document Number: 001-79425 Rev. **
¾¿
‚¨©ÈÉ“”
⬩
ÝÞߊàá CAN
Page 23 of 40
®
(CAN)
PSoC Creator™
Description
CAN_RestoreConfig()
¨
àỆ
0
åæçè‚
è“éê” 1
è“–ë” 2
è“ ìíî”
²ïðñ
Description
ðñ
CAN_initVar
CAN
ËÝÞß ðñ£ÝÞߤ 0 ªòóÁôµ‰ CAN_Start() õ…†¤ 1
òóÁôµ‰ CAN_Start() ø¹ºù
ú‰ûÐÝÞßüýûˆ
ýò CAN_Start() Š CAN_Enable()
þÿûÐÝÞß
ö÷
䵉 CAN_Init()
uint8 CAN_Start(void)
)
…† initVar ðñ µ‰ Init
#ùµ‰ CAN_Enable()
…¤$槞 ªò%&³´ý‰õˆ'(
!
"
!
None
"
£ CAN
*
Return Value
+ !
uint8!
Side Effects
0 1‰ !
þ2Ë…† initVar ðñ
¾¿
Ë,-°./
34
5µ‰ CAN_Enable()
uint8 CAN_Stop(void)
)
!
"
!
None
£ CAN
Return Value
+ !
uint8!
Side Effects
0 1‰ !
None
Page 24 of 40
…¤¥¦§ž
ªò%&³´ý‰õ¥¦(
*
¾¿
Ë,-°./
*
Document Number: 001-79425 Rev. **
®
PSoC Creator™
(CAN)
uint8 CAN_GlobalIntEnable(void)
)
!
"
!
None
À CAN
Žˆ‰²ïŽ•
*
Return Value
+ !
uint8!
Side Effects
0 1‰ !
None
¾¿
Ë,-°./
*
uint8 CAN_GlobalIntDisable(void)
)
!
"
!
None
À CAN
Ž‹‰²ïŽ•
*
Return Value
+ !
uint8!
Side Effects
0 1‰ !
None
¾¿
Ë,-°./
*
uint8 CAN_SetPreScaler(uint16 bitrate)
)
…†À BUS_CLK 6éõ78‚9:;
!
"
!
uint16 bitrate!9:;
Return Value
+ !
uint8!
Side Effects
0 1‰ !
None
¾¿
0x0 ° 0x7FFF <7‚+½=
+
Ë,-°./
*
uint8 CAN_SetArbiter(uint8 arbiter)
)
!
"
!
uint8 arbiter!“”
…†
Return Value
+ !
uint8!
Side Effects
0 1‰ !
None
>?
¾¿
[email protected]
“”
@A
BC°D•EFG
+ 0 ° 1 ½=
@A
Ë,-°./
*
Document Number: 001-79425 Rev. **
Page 25 of 40
®
(CAN)
PSoC Creator™
uint8 CAN_SetTsegSample(uint8 cfgTseg1, uint8 cfgTseg2, uint8 sjw,
uint8 sm)
)
»†!õ78 1Hõ78 2HIJKLMN°O÷§ž
!
"
!
uint8 cfgTseg1!õ78 1
P® 0x2 ° 0xF <7‚+½=
uint8 cfgTseg2!õ78 2
P® 0x1 ° 0x7 <7‚+½=
uint8 sjw!IJKLMN
uint8 sm!O÷§ž
Return Value
+ !
uint8!
Side Effects
0 1‰ !
None
P® 0x0 ° 0x3 <7‚+½=
щÁŠQÂO÷R
¾¿
Ë,-°./
*
uint8 CAN_SetRestartType(uint8 reset)
)
!
"
!
uint8 á˜!á[email protected]
…†á[email protected]
Return Value
+ !
uint8!
Side Effects
0 1‰ !
None
¾¿
á[email protected]¤S'°T'
T'ᘤUV…†
+ 0 ° 1 ½=
Ë,-°./
*
uint8 CAN_SetEdgeMode(uint8 edge)
)
!
"
!
uint8 edge!W§ž
…†W§ž
Return Value
+ !
uint8!
Side Effects
0 1‰ !
None
Page 26 of 40
¾¿
§ž¤“R”Ï“D”
XYÏZ½
Iõщ[\W
+ 0 ° 1 ½=
Ë,-°./
*
Document Number: 001-79425 Rev. **
®
PSoC Creator™
(CAN)
uint8 CAN_RXRegisterInit(uint32 *regAddr, uint32 config)
)
5,- CAN €•¾¿
!
"
!
uint32 * regAddr!ç«ç] CAN €•¾¿
uint32 configuration!£,-Ͼ¿
Return Value
+ !
uint8!
Side Effects
0 1‰ !
None
¾¿
Ž‚+
Ë,-°./
*
uint8 CAN_SetOpMode(uint8 opMode)
)
!
"
!
uint8 opMode!^1§ž+
…†^1§ž
Return Value
+ !
uint8!
Side Effects
0 1‰ !
None
¾¿
^1§ž¤“_'”Š“5`a”
+ 0 ° 1 ½=
Ë,-°./
*
uint8 CAN_GetTXErrorflag(void)
)
!
"
!
None
Return Value
+ !
uint8!
Side Effects
0 1‰ !
None
0x60
*
0x60
*
uint8 CAN_GetRXErrorflag(void)
)
!
"
!
None
Return Value
+ !
uint8!
Side Effects
0 1‰ !
None
0x60
ۥ
*
ۥ
0x60
*
Document Number: 001-79425 Rev. **
Page 27 of 40
®
(CAN)
PSoC Creator™
uint8 CAN_GetTXErrorCount(void)
)
!
"
!
None
*
Return Value
+ !
uint8!
Side Effects
0 1‰ !
None
*
uint8 CAN_GetRXErrorCount(void)
)
!
"
!
None
ۥ
*
Return Value
+ !
uint8!ۥ
Side Effects
0 1‰ !
None
*
uint8 CAN_GetErrorState(void)
)
!
"
!
None
CAN
‚
ƒ„
*
Return Value
+ !
uint8!
Side Effects
0 1‰ !
None
ƒ„
*
uint8 CAN_SetIrqMask(uint16 mask)
)
Ž•bcd€,-Ï CAN Ž•Ñe¾¿
!
"
!
uint8 request: Ž•ÑeŠ‹‰fg
ˆ‰Š‹‰Œ•Ž••
Return Value
+ !
uint8!
Side Effects
0 1‰ !
None
Page 28 of 40
¾¿
hÂŽ••Á˜i
Ë,-°./
*
Document Number: 001-79425 Rev. **
®
PSoC Creator™
(CAN)
void CAN_ArbLostIsr(void)
!
"
6é"
!
None
*
Return Value
+ !
None
*
Side Effects
0 1‰ !
None
*
)
“”•–Ž•‚-jR
k‘’“”•–Ž•
5ò“”•–Ž•)
ˆ‰õl
k‘’
5ò
ˆ‰õl
void CAN_OvrLdErrrorIsr(void)
!
"
6é"
!
None
*
Return Value
+ !
None
*
Side Effects
0 1‰ !
None
*
)
—
Ž•‚-jR
—
Ž•
—
Ž•)
void CAN_BitErrorIsr(void)
!
"
!
None
*
Return Value
+ !
None
*
Side Effects
0 1‰ !
None
*
)
˜
Document Number: 001-79425 Rev. **
Ž•‚-jR
k‘’˜
Ž•
5ò˜
Ž•)
ˆ‰õl6é"
Page 29 of 40
®
(CAN)
PSoC Creator™
void CAN_BitStuffErrorIsr(void)
!
"
˜™š
ˆ‰õl6é"
!
None
*
Return Value
+ !
None
*
Side Effects
0 1‰ !
None
*
)
Ž•‚-jR
k‘’˜™š
Ž•
5򘙚
Ž•)
void CAN_AckErrorIsr(void)
!
"
›œ
l6é"
!
None
*
Return Value
+ !
None
*
Side Effects
0 1‰ !
None
*
)
Ž•‚-jR
k‘’›œ
Ž•
5ò›œ
Ž•)
ˆ‰õ
k‘’•ž
Ž•
5ò•ž
Ž•)
ˆ‰õ
void CAN_MsgErrorIsr(void)
!
"
•ž
l6é"
!
None
*
Return Value
+ !
None
*
Side Effects
0 1‰ !
None
*
)
Page 30 of 40
Ž•‚-jR
Document Number: 001-79425 Rev. **
®
PSoC Creator™
(CAN)
void CAN_CrcErrorIsr(void)
!
"
CRC
‰õl6é"
!
None
*
Return Value
+ !
None
*
Side Effects
0 1‰ !
None
*
)
Ž•‚-jR
k‘’ CRC
5ò CRC
Ž•
Ž•)
ˆ
void CAN_BusOffIsr(void)
!
"
Ÿ ¡¢Ž•‚-jR k£ CAN
‰õl6é"
mnˆ‰"Ž•
!
None
*
Return Value
+ !
None
*
Side Effects
0 1‰ !
¥¦ CAN
)
…¤¥¦§ž
5òŸ
¡¢Ž•)
ˆ
^1
void CAN_MsgLostIsr(void)
!
"
¨©•–Ž•‚-jR
l6é"
!
None
*
Return Value
+ !
None
*
Side Effects
0 1‰ !
None
*
)
Document Number: 001-79425 Rev. **
k‘’¨©•–Ž•
5ò¨©•–Ž•)
ˆ‰õ
Page 31 of 40
®
(CAN)
PSoC Creator™
void CAN_MsgTXIsr(void)
!
"
l6é"
!
None
*
Return Value
+ !
None
*
Side Effects
0 1‰ !
None
*
)
¨©Ž•‚-jR
k‘’
¨©Ž•
5ò
¨©Ž•)
ˆ‰õ
void CAN_MsgRXIsr(void)
!
"
€•¨©Ž•‚-jR k‘’€•¨©Ž•
ª«¬-¯°±²Ž•³´µ
‰¶›‚·¸¹º 5ò€•¨©Ž•) ˆ‰õl6é"
mnˆ‰"Ž•
!
None
*
Return Value
+ !
None
*
Side Effects
0 1‰ !
None
*
)
uint8 CAN_RxBufConfig(CAN_RX_CFG *rxConfig)
)
³´opqr CAN_RX_CFG st
!
"
!
CAN_RX_CFG * rxConfig!ç]ust‚ç«
¼ÿ‚¼½+
¤Œ•³´»†¼½€•¾¿
Return Value
+ !
uint8!
Side Effects
0 1‰ !
None
Page 32 of 40
Ë€•ŠvwxŒ•‚€•¾¿
4stqr¤Œ•³´»†¼½€•¾¿
Ƞ
*
Document Number: 001-79425 Rev. **
®
PSoC Creator™
(CAN)
uint8 CAN_TxBufConfig(CAN_TX_CFG *txConfig)
€•‚ƒ CAN_TX_CFG „…
†
CAN_TX_CFG * txConfig
ŽŠ
•
Return Value
•‘’•“
uint8
Side Effects
••žŸ“
None•
‡ˆ‰„…Š‡‹Œ•„…‚ƒ
”•–—˜™š›œ
Š
“
uint8 CAN_SendMsg(CANTXMsg *message)
¡¢
±²¥¦
‡
£¤ CAN
³´©µ- £¤
†
CAN_TX_MSG * message
Return Value
•‘’•“
uint8
Side Effects
••žŸ“
None•
Š
¥¦
§¨©ª«¬Œ¶·¸¹º»¼½¸
‡‹Œ‡ˆ‚ƒ±²¥¦
ŽŠ
®Ÿ
Œ¯°•
Š„…
”•–±²¥¦
“
uint8 CAN_SendMsg0-7(void)
¾¿
”
¥¦ 0-7 ŠÀÁ §Ã¨Ä
07 ”• ´
Š¥¦ÅÆÇÈ
Œ§ÃÊË¥¦
Ì‹Í·
“ÏДŠ
ÑÒ¾¿
†
None•
Return Value
•‘’•“
uint8
Side Effects
••žŸ“
None•
³É
“
”•–±²¥¦
“
void CAN_TxCancel(uint8 bufferld)
Ó¥–ÔÕÅÖ
†
uint8 bufferld Tx
Return Value
•‘’•“
None•
“
Side Effects
••žŸ“
None•
“
Document Number: 001-79425 Rev. **
Š¥¦Š
וØÙÚÛ 0 Ü 15 ÝÞ
ß
Page 33 of 40
®
(CAN)
PSoC Creator™
void CAN_ReceiveMsg0-15(void)
”—० 0-15 áâŠÀÁ §Ããä—० 0-15 áâåæ
Дá⊗à
ÑÒ¾¿
†
None•
“
Return Value
•‘’•“
None•
“
Side Effects
••žŸ“
None•
“
͇̋
“Ï
void CAN_ReceiveMsg(uint8 rxMailbox)
”£¤
Š—०áâŠÀÁÂ
·
“£¤”èŒéÑÒ
†
uint8 rxMailbox
Return Value
•‘’•“
None•
“
Side Effects
••žŸ“
None•
“
걗०áâŠ
§ãä—à
¥¦áâåæ
Ì竬—à
ۥ
void CAN_Sleep(void)
¾”ëì
íîŠïðñòó CAN_Sleep() ñòóô õö
CAN_Stop()
Œ¯ûŸ CAN_SaveConfig()
ô ü
Š÷ø
ùú§ûŸ
çûŸ CyPmSleep() ™ CyPmHibernate()
ÝöûŸ CAN_Sleep()
ýþÿ!"
Š#¼$¦Œ%†& PSoC Creator System Reference Guide•'()†&‡*+“
†
None•
“
Return Value
•‘’•“
None•
“
Side Effects
••žŸ“
None•
“
Page 34 of 40
Document Number: 001-79425 Rev. **
®
PSoC Creator™
(CAN)
void CAN_Wakeup(void)
•
Ӧ
,-µûŸ CAN_Sleep() è÷øŠïðñòó CAN_Wakeup()
ûŸ
CAN_RestoreConfig()
.,-Ÿ/
³É
çûŸ CAN_Sleep()
ö–ÊŸŒ
0 CAN_Wakeup()
1¶23ÊŸ
†
None•
“
Return Value
•‘’•“
None•
“
Side Effects
••žŸ“
ûŸ CAN_Wakeup()
®89:
ö´ûŸ CAN_Sleep() ™ CAN_SaveConfig()
®456Ñ7
uint8 CAN_Init(void)
; < =òó Configure•
“Í>?@ ABCD™,ŽûŸ
CAN_Init()ŒE CAN_Start() ñòó5ûŸ•
¯”FC
GžŠïðHI
†
None•
Return Value
•‘’•“
uint8
Side Effects
••žŸ“
“
”•–—˜™š›
¶-JKBC•
¾¶23BCD
Œ7LŠ”Œ§7ãä
áŠ
MF CAN NOŠþÿ
uint8 CAN_Enable(void)
PQü ¯FCR:
5ûŸ•
Œ¾”FC
†
None•
“
Return Value
•‘’•“
None•
“
Side Effects
••žŸ“
None•
“
Document Number: 001-79425 Rev. **
Gž
ŽûŸ CAN_Enable()ŒE
GžŠïðHI
CAN_Start() ñòó
Page 35 of 40
®
(CAN)
PSoC Creator™
void CAN_SaveConfig(void)
5ô
ÜSôT
WX API YZŠõö
† •
†
None•
“
Return Value
•‘’•“
None•
“
Side Effects
••žŸ“
None•
“
•
§1ô Configure•
“Í>?á
[ CAN_Sleep()
ûŸ
=Š™UV
void CAN_RestoreConfig(void)
5,ÝöŠ•
†
None•
“
Return Value
•‘’•“
None•
“
Side Effects
••žŸ“
ûŸ
\
`
ÜSôT
§1¶
†
•,-
çûŸ CAN_Sleep()
ö´ûŸ CAN_Sleep() ™ CAN_SaveConfig()
®456Ñ7®89:
¶,- ]^• CAN_INT_SR_CAN_INT_EN_CAN_CMD Ü CAN_CFG
.
ÿabcd
PSoC Creator 瓨©cdef”Í>?ághœi¼‚jk"lÜabcdŠcdef mnÓ
ŠcdŒ%MF
foáŠÍ>?™k"láŠ
pd mnÓUŸŠcdŒ%M
F Start Page•FCq“™ File•r “stáŠÍ>? ; ŽmŒuŸÍ>?አFilter
Options•Vvðe“®wx®ðefŠy
ý#¼$¦Œ%†z PSoC Creator {|ናFind Example Project•¨©cdef“”}~
CAN




- CAN
…
…†‡
Page 36 of 40
- CAN
€•‚ƒ
ۥ
- CAN
„
ƒ…
ۥ
ƒ…†‡
Document Number: 001-79425 Rev. **
®
PSoC Creator™







€•‹Œ•Ž (CAN)
ˆ‰Š
••
- CAN
ۥ
ƒ CAN
••
‘’
- CAN
ۥ
ƒ CAN
‘’
CRC
- CAN
ƒ CAN CRC
ۥ
“”•– - CAN
€•—ƒ“”•–˜™
-š
ƒ—›œ•žŸ
¡¢
- £¤
¥
§‚
- §‚ƒ
¦
¨ ©ª
¿À·Á€•
«
¬-®¯°ˆ±›¨²³´µ¶
§‚
Â
ÃÄžÅ
ݮ
·¸
©ª°ˆ¹º»¼
½¾¥›©
ÇÈÉÊËÌÍÎÏÐÑÒÓ¥°ˆ
¢ÔÕÑÖ×
²Ø¹ CAN
Ý
Ù
Þ¥ßà¥Ù
¢Ô”Ú¥ÛÜÑ×
€
”³Ñ·áâãä¥å ›×æçè CAN “”é
ê ë CAN
Á€• ìÑ“
í¡¢”Ë“
í§‚”
›î´
”ï§ƒðˆ•›³çèÃÁ ññò “”Þ¥
ˆ ó ›æô
õö÷ ÃÁø›³ù§ëÙ
ú¿ûü
Ù
¢Ôý DMA ¥þÿ
CAN
!"#$% DMA &'›œ(³´ DMA
遼)"
”¯æôíìѱ
*+â DMA , Ë&' ó ›(Ó-./01ŵ¶ ¥Âª234'¯×曕•
6
78±›²9•žÅ CAN
(é
Ë5
:ÑÙ DMA ; •›(³ë <
§‚
žÅ=>•Ëˆ‰¡¢›?•@ CPU ¥å
AB +â&' žÅ RTR
C; •DE Ñ
¡¢
³Ñ·; DMA ¡¢›²
Ñšˆ‰FšG
HI‹›?•@ CPU JK
LÁM)"
LÁM)" ISR ³Ñ·NOPQµ!" ISR R)" ISR Ñ·NO!" ISR ›³S
TU
V²•ÁW ISR Uáâ¯!"P)"±›X?ë!" ISR ½¶¥&'YZPY[áâ&'
R)" ISR Ñ·Qµ!" ISR ›(\]9•žÅ CAN =>•ËÝ ¥¨ *å
Document Number: 001-79425 Rev. **
Page 37 of 40
®
(CAN)
PSoC Creator™
CAN




€•‚ƒ
„…†‡…ˆ‰
Š‹Œ
•Ž•
‡…†•‘’‰ ISR‹Œ
•Ž•
“”•Œ–’‰ ISR‹Œ
•Ž•
„…†‡…—„…˜™š
›œ’‰ ISR
•Œ
žŸ
¡…‹Œ
•Ž•¢£
¤ CAN
Œ
„…†‡…¥¦
‹§¨©ª «§¨©¬-«¬-®¯ °«±Š
™²³´µ•¢¶·„…œ¸¤’‰ CAN_ISR
˜™
¡…¢¹ºœ £‡…
‹»¼•½¾
¡…¢
¿À¤Œ
„…Áˆ‰
ÄÅƬÁˆ‰
ψ„ ¢
Š›œˆ‰
œˆ‰
ŠÂ£Ã¢
Ç‚È CAN_Start() API
¶‰É„
œÊË̤Í
Î
ÄÅƬÁˆ‰
œÊ’‰ ISR Ї…†ÑҜӥ
ÔƬÕÖ¶Š‘¢¤¹×
ØÙ€œ ÀÓ¥ÚÛ
žŸÖ¶
š ¢¹Ü¶¥•Œ ØÙœÝÞßÜÇàáâ
ØÙ¢
ÄÅ’‰ ISR ㇅†ÑÒ‹ä…Œ
•Ž•›œ’‰
¸¤åæÒÎ
㻼¢
ç•è¤’‰
ÎÏ ‡…¥¦
¡…‹éê©„…
š œÝÒä…Œ
•
Ž•œCAN ëì
¸íî‹—˜™š îœð’‰ CAN_ISR ÎÏ Ç
ñò’‰
¡…¢¶¥óô…õÜœ— öÝÒÇÖ ÷øùúûü…ý
¡…‹õÄœÝÒ DMA•
žŸ•Œš ›¢
ÄÅ•è“”•Œ–’‰ ISR‹ä…•Œ–•Ž•œCAN_ISR
ES1/ES2 ISR !"#ˆ ñò
¡…¢
¸Çþÿ¼£• PSoC 3
$%&'
À™“(
)*œ+,à PSoC® 3 - PSoC® 5 ./,012
“
(CAN)”34¢
56-7
˪56-7
4¢
Page 38 of 40
8¨œ+,à PSoC® 3 - PSoC 5® ./,012
“
(CAN)”3
Document Number: 001-79425 Rev. **
®
PSoC Creator™
(CAN)
,0
1. ISO-11898ƒ9‘:; - < 1 ‰Éƒ
(CAN)ƒ
=‘>-?Ÿ8@
 < 2 ‰ÉƒABCDEFÚG
 < 3 ‰ÉƒHB«IJ«CD˜™¬K
 < 4 ‰Éƒ›Líî
Ý8
 < 5 ‰ÉƒABCDEFÚGœMÀH$NëO
2. CAN PôQR 2 BOSCH
3. Inicore CANmodule-III-AHB
ST-UTVW•X
€Y
Z
óÁ[\X%œ]^_`ab•X
¢
CAN STPô
‹) *•
Description‹
,
ëìVT§N
c
de Z
fg Z
dh Z
Úi
500 kbps
--
--
285
A
1 Mbps
--
--
330
A
de Z
fg Z
dh Z
--
--
1
CAN UTPô
‹) *•
Description‹
,
c
dH 8 MHz ›l
j•k
Úi
Mbit
mn
R4op
—q QR
2.1
qQR˜j
römn¢
mn/s
stuv
mn )*
©wxyÀþz¤ .cyre {
|
•úyÀ API
CYREENTRANT ™}~ CAN API¢
’
Document Number: 001-79425 Rev. **
“•”•
API
€•‚ƒ„ …†‡ˆ‰Š‹Œ•Ž••‘
–—˜™š›œ
Page 39 of 40
®
¡¢ (CAN)
•žšŸ
PSoC Creator™
¥¦ §¨
«¬-®
/«
©ª
2.0.a
¯°±²³´•µ £¤¶·
¨
» £¤¼½
2.0
¯µ
¾¿˜ÀÁ
ÃĶ·
¸¹º
Â
ÅÆ
¯Ë
ÃÄ ¶·
ConnectExtInterruptLineÌ
IntISRDisableÌFullCastomIntISRÌ
AdvancedInterruptTab Í Á ISR Î
ÏÍ
¯Ë CAN_Init()
ÓÔ
¯ Â
à áË
£¤
ÐѶ·
ÅÚÛܳ
âãäå¦æ—
Ò•
ËÝÞß
ň‰
¯
 PSoC 3 CAN
ÇÈ
É Ê MRD
¯
 PSoC 3 CAN
ÇÈ
É
Ê MRD
ÕÖ CAN Ë×ØÙ²Ò•
çèé
‚ƒæ—
ň‰
¯ê—‡ëìí
1.50.a
µ £Ï
£¤
1.50
ïº
£
¨˜À
¯¶·ðñ/òó API
ôõ API ö÷øùúûƒ
¯¶· CAN_Init() Á CAN_Enable()
API
Ãüýþˆÿá•!" API ç#$
Ù/()
%&
'
×Ø
© *+,-./0ýþá2012
ÚÝ12 34 567²
á8•9½†: —*+,-;< =>?@åAá*+,-./0ýþ•»BCDE?@ „ FGBCHB I•J£KL
ŠDEMLçªNŠON ‚ƒPQBCR
—ST*+,-UVªÕ WXYZá[\*+,-;<•Ö]5^ _Š` _abÌcdö÷ÌecÌ‹Œ•žŠ€•f g
Aá»_
5‘chijkÁlm•» ânop qr cdö÷stá*+,-•PMuD;< v wst ‹Œ
xu*+,-;< _cdö÷st á\¤NžnyuFG® w„ z
PSoC
®
ۥ
‚ƒ„…
PSoC Creator™ † Programmable System-on-Chip™
ۥ
„…
‡ˆ‰
Š‹„…Œ‚ƒ„…•ŠŽ•
•
‘’“”•–†/Œ—–˜™•
€•”
˜
š›œ•žŸ” ¡† ¡¢£ œ•žŸ˜¤ ¡¥¦ž¢§¡¨©ªŸ«
¬†ª® ¯°±
²•³´µ‰ ¶· ¤¸¹º»¤¼²½¾ ±² ‰¢¿À¤Á‰¤ÂäÄÅ
‘’“ ÆÇÈɤÊË
‘’“†ÆÇÈÉ
ÌŠÍ ÎÏ ÄÅ•«Ð•–† /Œ—–
¢ÑÒ°±²•ÓÔŠ°Õ ÖÉ×ص‰ÙÚŸ« ÛÜÝ
ÞßàáâãÁ‰ äåæ « ‰çè£ éê
ë ìí±² ¼Õî ï‘’“ðñ
¿À¤Âä½ò¤
ÊËŒóô
õöë÷
à ¦•
BCD– EÔ
ÖÉÁ‰²Ï
¼øî ùúûü
ïý ëôŒþô ÿ
!”"¼Ó#
¼î ‡ æè
ÖÉŒàá 0‰ŒÁ‰12
õ
î
Öɉ Ç?ÑÒ@AF GHôÀ:„Ô12
ïÁ‰
µ‰
Page 40 of 40
˜øî$«‰ç µ%»†µ‰» þô ÿ
²Ï3Ç4½56†78 î‰9:ß;<=>
&'¼()*+ ,-.î ‡ æùúðñ/
Ç?ÑÒ@A
¼³¦ÔŠÖÉ‰È ï@A
•–±²ÙÚ#À
Document Number: 001-79425 Rev. **
Similar pages