STM32 USB CAN 学习笔记 - 共享RAM的用法

USB 时钟可以一直使能。 

如果CAN时钟没有使能,RAM 能被软件读写。(CANBus 不能发送和接受Message) 

如果CAN时钟使能,RAM不能软件被写。 CANBus Core 控制此RAM区域。(CANBus 可以发送和接受Message) 

CANBus 占用了 256 字节(地址范围 512 字节)。 

开始区域是Filters[14] = (F0R0、F0R1), (F1R0、F1R1),  ... (F13R0、F13R1). 

紧接着是 Rx0 FiFo[0], Tx0, Tx1, Tx2,  Rx0 FiFo[1], Rx0 FiFo[2], Rx1 FiFo[0], Rx1 FiFo[1], Rx1 FiFo[2]。 

USB 可以使用后面的 256 字节。 

具体分配可以是 : 8 个端点占用 8 * 8 = 64 Bytes (ADDR、CNT : TX、RX) 

最好只使用 3 个端点 : (1) 控制端点 0 (2) In 端点 1 (3)Out 端点 2 

控制端点 : 64 bytes 

In 端点: 64 Bytes 

Out 端点: 64 Bytes 

 



00006000 00 00 00 00 00 00 00 00 F8 FF 00 00 FF FF 00 00    // Filters[0]
00006010 08 00 00 00 00 00 00 00 F8 FF 00 00 FF FF 00 00
00006020 10 00 00 00 00 00 00 00 F8 FF 00 00 FF FF 00 00
00006030 18 00 00 00 00 00 00 00 F8 FF 00 00 FF FF 00 00
00006040 20 00 00 00 00 00 00 00 F8 FF 00 00 FF FF 00 00
00006050 28 00 00 00 00 00 00 00 F8 FF 00 00 FF FF 00 00
00006060 30 00 00 00 00 00 00 00 F8 FF 00 00 FF FF 00 00
00006070 38 00 00 00 00 00 00 00 F8 FF 00 00 FF FF 00 00
00006080 40 00 00 00 00 00 00 00 F8 FF 00 00 FF FF 00 00
00006090 48 00 00 00 00 00 00 00 F8 FF 00 00 FF FF 00 00
000060A0 50 00 00 00 00 00 00 00 F8 FF 00 00 FF FF 00 00
000060B0 58 00 00 00 00 00 00 00 F8 FF 00 00 FF FF 00 00
000060C0 60 00 00 00 00 00 00 00 F8 FF 00 00 FF FF 00 00
000060D0 68 00 00 00 00 00 00 00 F8 FF 00 00 FF FF 00 00    // Filters[13]

000060E0 04 00 00 00 00 00 00 00 08 00 00 00 00 00 00 00    //Rx0 FIFO[0]
000060F0 01 23 00 00 45 67 00 00 89 AB 00 00 CD EF 00 00

00006100 05 00 00 00 00 00 00 00 08 00 00 00 00 00 00 00    //Tx0
00006110 01 23 00 00 45 67 00 00 89 AB 00 00 CD EF 00 00

00006120 0D 00 00 00 00 00 00 00 08 00 00 00 00 00 00 00    //Tx1
00006130 01 23 00 00 45 67 00 00 89 AB 00 00 CD EF 00 00

00006140 15 00 00 00 00 00 00 00 08 00 00 00 00 00 00 00    //Tx2
00006150 01 23 00 00 45 67 00 00 89 AB 00 00 CD EF 00 00

00006160 0C 00 00 00 00 00 00 00 08 01 00 00 00 00 00 00    //Rx0 FIFO[1]
00006170 01 23 00 00 45 67 00 00 89 AB 00 00 CD EF 00 00

00006180 14 00 00 00 00 00 00 00 08 02 00 00 00 00 00 00    //Rx0 FIFO[2]
00006190 01 23 00 00 45 67 00 00 89 AB 00 00 CD EF 00 00

000061A0 1C 00 00 00 00 00 00 00 08 00 00 00 00 00 00 00    //Rx1 FIFO[0]
000061B0 01 23 00 00 45 67 00 00 89 AB 00 00 CD EF 00 00

000061C0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    //Rx1 FIFO[1]
000061D0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

000061E0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    //Rx1 FIFO[2]
000061F0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

00006200 22 22 00 00 22 22 00 00 22 22 00 00 22 22 00 00    //Unused Endpoint
00006210 22 22 00 00 22 22 00 00 22 22 00 00 22 22 00 00
00006220 22 22 00 00 22 22 00 00 22 22 00 00 22 22 00 00
00006230 22 22 00 00 22 22 00 00 22 22 00 00 22 22 00 00
00006240 22 22 00 00 22 22 00 00 22 22 00 00 22 22 00 00

00006250 40 01 00 00 00 00 00 00 40 01 00 00 00 84 00 00    //EP0 -- Buffer Table @ 0x0250
00006260 80 01 00 00 00 00 00 00 C0 01 00 00 40 00 00 00    //EP1
00006270 C0 01 00 00 00 84 00 00 C0 01 00 00 00 84 00 00    //EP2

00006280 00 09 00 00 00 00 00 00 00 00 00 00 00 00 00 00    //EP0 Buffer
00006290 26 26 00 00 FF FF 00 00 00 01 00 00 00 01 00 00
000062A0 02 01 00 00 65 00 00 00 72 00 00 00 40 00 00 00
000062B0 00 07 00 00 05 02 00 00 02 40 00 00 00 00 00 00
000062C0 22 22 00 00 22 22 00 00 22 22 00 00 22 22 00 00
000062D0 22 22 00 00 22 22 00 00 22 22 00 00 22 22 00 00
000062E0 22 22 00 00 22 22 00 00 22 22 00 00 22 22 00 00
000062F0 22 22 00 00 22 22 00 00 22 22 00 00 22 22 00 00

00006300 22 22 00 00 22 22 00 00 22 22 00 00 22 22 00 00    //EP1 Buffer
00006310 22 22 00 00 22 22 00 00 22 22 00 00 22 22 00 00
00006320 22 22 00 00 22 22 00 00 22 22 00 00 22 22 00 00
00006330 22 22 00 00 22 22 00 00 22 22 00 00 22 22 00 00
00006340 22 22 00 00 22 22 00 00 22 22 00 00 22 22 00 00
00006350 C0 01 00 00 00 00 00 00 C0 01 00 00 00 84 00 00
00006360 C0 01 00 00 00 00 00 00 FD 67 00 00 0A 6C 00 00
00006370 34 78 00 00 68 FD 00 00 C0 01 00 00 00 84 00 00

00006380 00 09 00 00 01 00 00 00 00 00 00 00 00 00 00 00    //EP2 Buffer
00006390 27 27 00 00 04 00 00 00 00 02 00 00 00 00 00 00
000063A0 00 00 00 00 07 05 00 00 81 02 00 00 40 00 00 00
000063B0 00 07 00 00 05 02 00 00 02 40 00 00 00 00 00 00
000063C0 89 8E 00 00 82 83 00 00 C2 47 00 00 B4 69 00 00
000063D0 EA 7C 00 00 16 29 00 00 93 C3 00 00 79 25 00 00
000063E0 4A E1 00 00 F9 AC 00 00 39 CB 00 00 47 3A 00 00
000063F0 F1 32 00 00 C0 22 00 00 7B 03 00 00 4F A2 00 00
USB    CAN          RAM

Dis    Dis     软件 (不可写入, 读取无意义) 硬件 (没有控制)
Dis    En      软件 (不可写入, 读取无意义) 硬件 (CANBus控制)
En     Dis     软件 (可写入, 可读取)      硬件 (USB控制)
En     En      软件 (不可写入, 读取无意义) 硬件 (CANBus控制)

 

posted @ 2015-10-27 07:58 carprog 阅读(...) 评论(...) 编辑 收藏