mcp2517fd 2.0.0.0
mcp2517fd.h
Go to the documentation of this file.
1/****************************************************************************
2** Copyright (C) 2020 MikroElektronika d.o.o.
3** Contact: https://www.mikroe.com/contact
4**
5** Permission is hereby granted, free of charge, to any person obtaining a copy
6** of this software and associated documentation files (the "Software"), to deal
7** in the Software without restriction, including without limitation the rights
8** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9** copies of the Software, and to permit persons to whom the Software is
10** furnished to do so, subject to the following conditions:
11** The above copyright notice and this permission notice shall be
12** included in all copies or substantial portions of the Software.
13**
14** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
16** OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18** DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
19** OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20** USE OR OTHER DEALINGS IN THE SOFTWARE.
21****************************************************************************/
22
28#ifndef MCP2517FD_H
29#define MCP2517FD_H
30
31#ifdef __cplusplus
32extern "C"{
33#endif
34
39#ifdef PREINIT_SUPPORTED
40#include "preinit.h"
41#endif
42
43#ifdef MikroCCoreVersion
44 #if MikroCCoreVersion >= 1
45 #include "delays.h"
46 #endif
47#endif
48
49#include "drv_digital_out.h"
50#include "drv_digital_in.h"
51#include "drv_spi_master.h"
52#include "spi_specifics.h"
53
64#define MCP2517FD
65
70//#define REV_A
71#define REV_B
72
73#ifdef REV_A
74 #define FIXED_FILTER_ADDRESS
75#endif
76
81#ifndef FPGA
82 #define MCP2517FD_FIFO_08TO15_IMPLEMENTED
83 #define MCP2517FD_FIFO_16TO31_IMPLEMENTED
84#endif
85
90#ifndef FPGA
91 #define MCP2517FD_FILT_08TO15_IMPLEMENTED
92 #define MCP2517FD_FILT_16TO31_IMPLEMENTED
93#endif
94
99#ifdef MCP2520FD
100 #define CAN_INTERNAL_OSC_PRESENT
101#endif
102
107#ifdef REV_B
108 #define CAN_RESTRICTED_MODE_PRESENT
109#endif
110
115#ifdef REV_B
116 #define CAN_TXQUEUE_IMPLEMENTED
117#endif
118
124#ifdef REV_A
125 #define USERADDRESS_TIMES_FOUR
126#endif
127
128#ifdef MCP2517FD
129 #define N_MCP2518_CTRL_REGS 5
130#endif
131
132#define MCP2517FD_MAX_TXQUEUE_ATTEMPTS 50
133#define MCP2517FD_TX_REQUEST_ID 0x300
134#define MCP2517FD_TX_RESPONSE_ID 0x301
135
136#define MCP2517FD_CRCBASE 0xFFFF
137#define MCP2517FD_CRCUPPER 1
138#define MCP2517FD_DRV_CANFDSPI_INDEX_0 0
139#define MCP2517FD_SPI_DEFAULT_BUFFER_LENGTH 96
140
141#define MCP2517FD_ISO_CRC 1
142
143#define MCP2517FD_MAX_MSG_SIZE 76
144
145#define MCP2517FD_MAX_DATA_BYTES 64
146
147#define MCP2517FD_INS_RESET 0x00
148#define MCP2517FD_INS_READ 0x03
149#define MCP2517FD_INS_READ_CRC 0x0B
150#define MCP2517FD_INS_WRITE 0x02
151#define MCP2517FD_INS_WRITE_CRC 0x0A
152#define MCP2517FD_INS_WRITE_SAFE 0x0C
153
154
155#define MCP2517FD_FIFO_OFFSET ( 3 * 4 )
156#define MCP2517FD_FILTER_OFFSET ( 2 * 4 )
157
158#ifdef CAN_TXQUEUE_IMPLEMENTED
159 #define MCP2517FD_REG_CITXQCON 0x050
160 #define MCP2517FD_REG_CITXQSTA 0x054
161 #define MCP2517FD_REG_CITXQUA 0x058
162#endif
163
164#ifdef FIXED_FILTER_ADDRESS
165 #define MCP2517FD_REG_CIFLTCON 0x1D0
166 #define MCP2517FD_REG_CIFLTOBJ 0x1F0
167 #define MCP2517FD_REG_CIMASK 0x1F4
168#else
169 #define MCP2517FD_REG_CIFLTCON ( MCP2517FD_REG_CIFIFOCON + ( MCP2517FD_FIFO_OFFSET * MCP2517FD_FIFO_TOTAL_CHANNELS ) )
170 #define MCP2517FD_REG_CIFLTOBJ ( MCP2517FD_REG_CIFLTCON + MCP2517FD_FIFO_TOTAL_CHANNELS )
171 #define MCP2517FD_REG_CIMASK ( MCP2517FD_REG_CIFLTOBJ + 4 )
172#endif
173
174#define MCP2517FD_REG_OSC 0xE00
175#define MCP2517FD_REG_IOCON 0xE04
176#define MCP2517FD_REG_CRC 0xE08
177#define MCP2517FD_REG_ECCCON 0xE0C
178#define MCP2517FD_REG_ECCSTA 0xE10
179
180#define MCP2517FD_RAM_SIZE 2048
181#define MCP2517FD_RAMADDR_START 0x400
182#define MCP2517FD_RAMADDR_END ( MCP2517FD_RAMADDR_START + MCP2517FD_RAM_SIZE )
183
184#define MCP2517FD_LOW_POWER_MODE_EN 0x08
185#define MCP2517FD_LOW_POWER_MODE_DIS 0x00
186#define MCP2517FD_WAKEUP_INTERR_EN 0x40
187
188#define MCP2517FD_REG_CICON 0x000
189#define MCP2517FD_REG_CINBTCFG 0x004
190#define MCP2517FD_REG_CIDBTCFG 0x008
191#define MCP2517FD_REG_CITDC 0x00C
192
193#define MCP2517FD_REG_CITBC 0x010
194#define MCP2517FD_REG_CITSCON 0x014
195#define MCP2517FD_REG_CIVEC 0x018
196#define MCP2517FD_REG_CIINT 0x01C
197#define MCP2517FD_REG_CIINTFLAG MCP2517FD_REG_CIINT
198#define MCP2517FD_REG_CIINTENABLE ( MCP2517FD_REG_CIINT + 2 )
199
200#define MCP2517FD_REG_CIRXIF 0x020
201#define MCP2517FD_REG_CITXIF 0x024
202#define MCP2517FD_REG_CIRXOVIF 0x028
203#define MCP2517FD_REG_CITXATIF 0x02C
204
205#define MCP2517FD_REG_CITXREQ 0x030
206#define MCP2517FD_REG_CITREC 0x034
207#define MCP2517FD_REG_CIBDIAG0 0x038
208#define MCP2517FD_REG_CIBDIAG1 0x03C
209
210#define MCP2517FD_REG_CITEFCON 0x040
211#define MCP2517FD_REG_CITEFSTA 0x044
212#define MCP2517FD_REG_CITEFUA 0x048
213#define MCP2517FD_REG_CIFIFOBA 0x04C
214
215#define MCP2517FD_REG_CIFIFOCON 0x050
216#define MCP2517FD_REG_CIFIFOSTA 0x054
217#define MCP2517FD_REG_CIFIFOUA 0x058
218
229 // mcp2517fd_reg
230
250#define MCP2517FD_FIFO_CH0 0
251#define MCP2517FD_FIFO_CH1 1
252#define MCP2517FD_FIFO_CH2 2
253#define MCP2517FD_FIFO_CH3 3
254#define MCP2517FD_FIFO_CH4 4
255#define MCP2517FD_FIFO_CH5 5
256#define MCP2517FD_FIFO_CH6 6
257#define MCP2517FD_FIFO_CH7 7
258
259#ifdef MCP2517FD_FIFO_08TO15_IMPLEMENTED
260 #define MCP2517FD_FIFO_CH8 8
261 #define MCP2517FD_FIFO_CH9 9
262 #define MCP2517FD_FIFO_CH10 10
263 #define MCP2517FD_FIFO_CH11 11
264 #define MCP2517FD_FIFO_CH12 12
265 #define MCP2517FD_FIFO_CH13 13
266 #define MCP2517FD_FIFO_CH14 14
267 #define MCP2517FD_FIFO_CH15 15
268#endif
269
270#ifdef MCP2517FD_FIFO_16TO31_IMPLEMENTED
271 #define MCP2517FD_FIFO_CH16 16
272 #define MCP2517FD_FIFO_CH17 17
273 #define MCP2517FD_FIFO_CH18 18
274 #define MCP2517FD_FIFO_CH19 19
275 #define MCP2517FD_FIFO_CH20 20
276 #define MCP2517FD_FIFO_CH21 21
277 #define MCP2517FD_FIFO_CH22 22
278 #define MCP2517FD_FIFO_CH23 23
279 #define MCP2517FD_FIFO_CH24 24
280 #define MCP2517FD_FIFO_CH25 25
281 #define MCP2517FD_FIFO_CH26 26
282 #define MCP2517FD_FIFO_CH27 27
283 #define MCP2517FD_FIFO_CH28 28
284 #define MCP2517FD_FIFO_CH29 29
285 #define MCP2517FD_FIFO_CH30 30
286 #define MCP2517FD_FIFO_CH31 31
287#endif
288
289
290#define MCP2517FD_FIFO_TOTAL_CHANNELS 32
291
292#ifdef CAN_TXQUEUE_IMPLEMENTED
293 #define MCP2517FD_FIFO_FIRST_CHANNEL MCP2517FD_FIFO_CH1
294 #define CAN_TXQUEUE_CH0 MCP2517FD_FIFO_CH0
295#else
296 #define MCP2517FD_FIFO_FIRST_CHANNEL MCP2517FD_FIFO_CH0
297#endif
298
303#define MCP2517FD_FILT0 0
304#define MCP2517FD_FILT1 1
305#define MCP2517FD_FILT2 2
306#define MCP2517FD_FILT3 3
307#define MCP2517FD_FILT4 4
308#define MCP2517FD_FILT5 5
309#define MCP2517FD_FILT6 6
310#define MCP2517FD_FILT7 7
311
312#ifdef MCP2517FD_FILT_08TO15_IMPLEMENTED
313 #define MCP2517FD_FILT8 8
314 #define MCP2517FD_FILT9 9
315 #define MCP2517FD_FILT10 10
316 #define MCP2517FD_FILT11 11
317 #define MCP2517FD_FILT12 12
318 #define MCP2517FD_FILT13 13
319 #define MCP2517FD_FILT14 14
320 #define MCP2517FD_FILT15 15
321#endif
322
323#ifdef MCP2517FD_FILT_16TO31_IMPLEMENTED
324 #define MCP2517FD_FILT16 16
325 #define MCP2517FD_FILT17 17
326 #define MCP2517FD_FILT18 18
327 #define MCP2517FD_FILT19 19
328 #define MCP2517FD_FILT20 20
329 #define MCP2517FD_FILT21 21
330 #define MCP2517FD_FILT22 22
331 #define MCP2517FD_FILT23 23
332 #define MCP2517FD_FILT24 24
333 #define MCP2517FD_FILT25 25
334 #define MCP2517FD_FILT26 26
335 #define MCP2517FD_FILT27 27
336 #define MCP2517FD_FILT28 28
337 #define MCP2517FD_FILT29 29
338 #define MCP2517FD_FILT30 30
339 #define MCP2517FD_FILT31 31
340#endif
341
342#define MCP2517FD_FILT_TOTAL 32
343
348#define MCP2517FD_NORMAL_MODE 0x00
349#define MCP2517FD_SLEEP_MODE 0x01
350#define MCP2517FD_INT_LOOP_MODE 0x02
351#define MCP2517FD_LISTEN_ONLY_MODE 0x03
352#define MCP2517FD_CONFIG_MODE 0x04
353#define MCP2517FD_EXT_LOOP_MODE 0x05
354#define MCP2517FD_CLASSIC_MODE 0x06
355#define MCP2517FD_RESTRICT_MODE 0x07
356#define MCP2517FD_INVALID_MODE 0xFF
357
362#define MCP2517FD_TXBWS_NO_DELAY 0
363#define MCP2517FD_TXBWS_2 1
364#define MCP2517FD_TXBWS_4 2
365#define MCP2517FD_TXBWS_8 3
366#define MCP2517FD_TXBWS_16 4
367#define MCP2517FD_TXBWS_32 5
368#define MCP2517FD_TXBWS_64 6
369#define MCP2517FD_TXBWS_128 7
370#define MCP2517FD_TXBWS_256 8
371#define MCP2517FD_TXBWS_512 9
372#define MCP2517FD_TXBWS_1024 10
373#define MCP2517FD_TXBWS_2048 11
374#define MCP2517FD_TXBWS_4096 12
375
380#define MCP2517FD_WFT00 0
381#define MCP2517FD_WFT01 1
382#define MCP2517FD_WFT10 2
383#define MCP2517FD_WFT11 3
384
389#define MCP2517FD_DNET_FILT_DISABLE 0
390#define MCP2517FD_DNET_FILT_SIZE_1_BIT 1
391#define MCP2517FD_DNET_FILT_SIZE_2_BIT 2
392#define MCP2517FD_DNET_FILT_SIZE_3_BIT 3
393#define MCP2517FD_DNET_FILT_SIZE_4_BIT 4
394#define MCP2517FD_DNET_FILT_SIZE_5_BIT 5
395#define MCP2517FD_DNET_FILT_SIZE_6_BIT 6
396#define MCP2517FD_DNET_FILT_SIZE_7_BIT 7
397#define MCP2517FD_DNET_FILT_SIZE_8_BIT 8
398#define MCP2517FD_DNET_FILT_SIZE_9_BIT 9
399#define MCP2517FD_DNET_FILT_SIZE_10_BIT 10
400#define MCP2517FD_DNET_FILT_SIZE_11_BIT 11
401#define MCP2517FD_DNET_FILT_SIZE_12_BIT 12
402#define MCP2517FD_DNET_FILT_SIZE_13_BIT 13
403#define MCP2517FD_DNET_FILT_SIZE_14_BIT 14
404#define MCP2517FD_DNET_FILT_SIZE_15_BIT 15
405#define MCP2517FD_DNET_FILT_SIZE_16_BIT 16
406#define MCP2517FD_DNET_FILT_SIZE_17_BIT 17
407#define MCP2517FD_DNET_FILT_SIZE_18_BIT 18
408
413#define MCP2517FD_PLSIZE_8 0
414#define MCP2517FD_PLSIZE_12 1
415#define MCP2517FD_PLSIZE_16 2
416#define MCP2517FD_PLSIZE_20 3
417#define MCP2517FD_PLSIZE_24 4
418#define MCP2517FD_PLSIZE_32 5
419#define MCP2517FD_PLSIZE_48 6
420#define MCP2517FD_PLSIZE_64 7
421
426#define MCP2517FD_DLC_0 0
427#define MCP2517FD_DLC_1 1
428#define MCP2517FD_DLC_2 2
429#define MCP2517FD_DLC_3 3
430#define MCP2517FD_DLC_4 4
431#define MCP2517FD_DLC_5 5
432#define MCP2517FD_DLC_6 6
433#define MCP2517FD_DLC_7 7
434#define MCP2517FD_DLC_8 8
435#define MCP2517FD_DLC_12 9
436#define MCP2517FD_DLC_16 10
437#define MCP2517FD_DLC_20 11
438#define MCP2517FD_DLC_24 12
439#define MCP2517FD_DLC_32 13
440#define MCP2517FD_DLC_48 14
441#define MCP2517FD_DLC_64 15
442
447#define MCP2517FD_RX_FIFO_EMPTY 0
448#define MCP2517FD_RX_FIFO_STATUS_MASK 0x0F
449#define MCP2517FD_RX_FIFO_NOT_EMPTY 0x01
450#define MCP2517FD_RX_FIFO_HALF_FULL 0x02
451#define MCP2517FD_RX_FIFO_FULL 0x04
452#define MCP2517FD_RX_FIFO_OVERFLOW 0x08
453
458#define MCP2517FD_TX_FIFO_FULL 0
459#define MCP2517FD_TX_FIFO_STATUS_MASK 0x1F7
460#define MCP2517FD_TX_FIFO_NOT_FULL 0x01
461#define MCP2517FD_TX_FIFO_HALF_FULL 0x02
462#define MCP2517FD_TX_FIFO_EMPTY 0x04
463#define MCP2517FD_TX_FIFO_ATTEMPTS_EXHAUSTED 0x10
464#define MCP2517FD_TX_FIFO_ERROR 0x20
465#define MCP2517FD_TX_FIFO_ARBITRATION_LOST 0x40
466#define MCP2517FD_TX_FIFO_ABORTED 0x80
467#define MCP2517FD_TX_FIFO_TRANSMITTING 0x100
468
473#define MCP2517FD_TEF_FIFO_EMPTY 0
474#define MCP2517FD_TEF_FIFO_STATUS_MASK 0x0F
475#define MCP2517FD_TEF_FIFO_NOT_EMPTY 0x01
476#define MCP2517FD_TEF_FIFO_HALF_FULL 0x02
477#define MCP2517FD_TEF_FIFO_FULL 0x04
478#define MCP2517FD_TEF_FIFO_OVERFLOW 0x08
479
484#define MCP2517FD_TX_FIFO_NO_EVENT 0
485#define MCP2517FD_TX_FIFO_ALL_EVENTS 0x17
486#define MCP2517FD_TX_FIFO_NOT_FULL_EVENT 0x01
487#define MCP2517FD_TX_FIFO_HALF_FULL_EVENT 0x02
488#define MCP2517FD_TX_FIFO_EMPTY_EVENT 0x04
489#define MCP2517FD_TX_FIFO_ATTEMPTS_EXHAUSTED_EVENT 0x10
490
491#define MCP2517FD_RX_FIFO_NO_EVENT 0
492#define MCP2517FD_RX_FIFO_ALL_EVENTS 0x0F
493#define MCP2517FD_RX_FIFO_NOT_EMPTY_EVENT 0x01
494#define MCP2517FD_RX_FIFO_HALF_FULL_EVENT 0x02
495#define MCP2517FD_RX_FIFO_FULL_EVENT 0x04
496#define MCP2517FD_RX_FIFO_OVERFLOW_EVENT 0x08
497
498#define MCP2517FD_TEF_FIFO_NO_EVENT 0
499#define MCP2517FD_TEF_FIFO_ALL_EVENTS 0x0F
500#define MCP2517FD_TEF_FIFO_NOT_EMPTY_EVENT 0x01
501#define MCP2517FD_TEF_FIFO_HALF_FULL_EVENT 0x02
502#define MCP2517FD_TEF_FIFO_FULL_EVENT 0x04
503#define MCP2517FD_TEF_FIFO_OVERFLOW_EVENT 0x08
504
505#define MCP2517FD_NO_EVENT 0
506#define MCP2517FD_ALL_EVENTS 0xFF1F
507#define MCP2517FD_TX_EVENT 0x0001
508#define MCP2517FD_RX_EVENT 0x0002
509#define MCP2517FD_TIME_BASE_COUNTER_EVENT 0x0004
510#define MCP2517FD_OPERATION_MODE_CHANGE_EVENT 0x0008
511#define MCP2517FD_TEF_EVENT 0x0010
512
513#define MCP2517FD_RAM_ECC_EVENT 0x0100
514#define MCP2517FD_SPI_CRC_EVENT 0x0200
515#define MCP2517FD_TX_ATTEMPTS_EVENT 0x0400
516#define MCP2517FD_RX_OVERFLOW_EVENT 0x0800
517#define MCP2517FD_SYSTEM_ERROR_EVENT 0x1000
518#define MCP2517FD_BUS_ERROR_EVENT 0x2000
519#define MCP2517FD_BUS_WAKEUP_EVENT 0x4000
520#define MCP2517FD_RX_INVALID_MESSAGE_EVENT 0x8000
521
522#define MCP2517FD_500K_1M 0
523#define MCP2517FD_500K_2M 1
524#define MCP2517FD_500K_3M 2
525#define MCP2517FD_500K_4M 3
526#define MCP2517FD_500K_5M 4
527#define MCP2517FD_500K_6M7 5
528#define MCP2517FD_500K_8M 6
529#define MCP2517FD_500K_10M 7
530#define MCP2517FD_250K_500K 8
531#define MCP2517FD_250K_833K 9
532#define MCP2517FD_250K_1M 10
533#define MCP2517FD_250K_1M5 11
534#define MCP2517FD_250K_2M 12
535#define MCP2517FD_250K_3M 13
536#define MCP2517FD_250K_4M 14
537#define MCP2517FD_1000K_4M 15
538#define MCP2517FD_1000K_8M 16
539#define MCP2517FD_125K_500K 17
540
541#define MCP2517FD_NBT_125K 0
542#define MCP2517FD_NBT_250K 1
543#define MCP2517FD_NBT_500K 2
544#define MCP2517FD_NBT_1M 3
545
546#define MCP2517FD_DBT_500K 0
547#define MCP2517FD_DBT_833K 1
548#define MCP2517FD_DBT_1M 2
549#define MCP2517FD_DBT_1M5 3
550#define MCP2517FD_DBT_2M 4
551#define MCP2517FD_DBT_3M 5
552#define MCP2517FD_DBT_4M 6
553#define MCP2517FD_DBT_5M 7
554#define MCP2517FD_DBT_6M7 8
555#define MCP2517FD_DBT_8M 9
556#define MCP2517FD_DBT_10M 10
557
558#define MCP2517FD_SSP_MODE_OFF 0
559#define MCP2517FD_SSP_MODE_MANUAL 1
560#define MCP2517FD_SSP_MODE_AUTO 2
561
562#define MCP2517FD_ERROR_FREE_STATE 0
563#define MCP2517FD_ERROR_ALL 0x3F
564#define MCP2517FD_TX_RX_WARNING_STATE 0x01
565#define MCP2517FD_RX_WARNING_STATE 0x02
566#define MCP2517FD_TX_WARNING_STATE 0x04
567#define MCP2517FD_RX_BUS_PASSIVE_STATE 0x08
568#define MCP2517FD_TX_BUS_PASSIVE_STATE 0x10
569#define MCP2517FD_TX_BUS_OFF_STATE 0x20
570
571#define MCP2517FD_TS_SOF 0x00
572#define MCP2517FD_TS_EOF 0x01
573#define MCP2517FD_TS_RES 0x02
574
575#define MCP2518_ECC_NO_EVENT 0x00
576#define MCP2518_ECC_ALL_EVENTS 0x06
577#define MCP2518_ECC_SEC_EVENT 0x02
578#define MCP2518_ECC_DED_EVENT 0x04
579
580#define MCP2517FD_CRC_NO_EVENT 0x00
581#define MCP2517FD_CRC_ALL_EVENTS 0x03
582#define MCP2517FD_CRC_CRCERR_EVENT 0x01
583#define MCP2517FD_CRC_FORMERR_EVENT 0x02
584
589#define MCP2517FD_PIN_0 0
590#define MCP2517FD_PIN_1 1
591
592#define MCP2517FD_PINMODE_INT 0
593#define MCP2517FD_PINMODE_GPIO 1
594
595#define MCP2517FD_PINOUT 0
596#define MCP2517FD_PININ 1
597
598#define MCP2517FD_PINLOW 0
599#define MCP2517FD_PINHIGH 1
600
601#define MCP2517FD_PUSHPULL 0
602#define MCP2517FD_OPENDRAIN 1
603
604#define MCP2517FD_CLKO_CLOCK 0
605#define MCP2517FD_CLKO_SOF 1
606
611#define MCP2517FD_TXREQ_CH0 0x00000001
612#define MCP2517FD_TXREQ_CH1 0x00000002
613#define MCP2517FD_TXREQ_CH2 0x00000004
614#define MCP2517FD_TXREQ_CH3 0x00000008
615#define MCP2517FD_TXREQ_CH4 0x00000010
616#define MCP2517FD_TXREQ_CH5 0x00000020
617#define MCP2517FD_TXREQ_CH6 0x00000040
618#define MCP2517FD_TXREQ_CH7 0x00000080
619
620#define MCP2517FD_TXREQ_CH8 0x00000100
621#define MCP2517FD_TXREQ_CH9 0x00000200
622#define MCP2517FD_TXREQ_CH10 0x00000400
623#define MCP2517FD_TXREQ_CH11 0x00000800
624#define MCP2517FD_TXREQ_CH12 0x00001000
625#define MCP2517FD_TXREQ_CH13 0x00002000
626#define MCP2517FD_TXREQ_CH14 0x00004000
627#define MCP2517FD_TXREQ_CH15 0x00008000
628
629#define MCP2517FD_TXREQ_CH16 0x00010000
630#define MCP2517FD_TXREQ_CH17 0x00020000
631#define MCP2517FD_TXREQ_CH18 0x00040000
632#define MCP2517FD_TXREQ_CH19 0x00080000
633#define MCP2517FD_TXREQ_CH20 0x00100000
634#define MCP2517FD_TXREQ_CH21 0x00200000
635#define MCP2517FD_TXREQ_CH22 0x00400000
636#define MCP2517FD_TXREQ_CH23 0x00800000
637
638#define MCP2517FD_TXREQ_CH24 0x01000000
639#define MCP2517FD_TXREQ_CH25 0x02000000
640#define MCP2517FD_TXREQ_CH26 0x04000000
641#define MCP2517FD_TXREQ_CH27 0x08000000
642#define MCP2517FD_TXREQ_CH28 0x10000000
643#define MCP2517FD_TXREQ_CH29 0x20000000
644#define MCP2517FD_TXREQ_CH30 0x40000000
645#define MCP2517FD_TXREQ_CH31 0x80000000
646
651#define MCP2517FD_ICODE_FIFO_CH0 0
652#define MCP2517FD_ICODE_FIFO_CH1 1
653#define MCP2517FD_ICODE_FIFO_CH2 2
654#define MCP2517FD_ICODE_FIFO_CH3 3
655#define MCP2517FD_ICODE_FIFO_CH4 4
656#define MCP2517FD_ICODE_FIFO_CH5 5
657#define MCP2517FD_ICODE_FIFO_CH6 6
658#define MCP2517FD_ICODE_FIFO_CH7 7
659
660#ifdef MCP2517FD_FIFO_08TO15_IMPLEMENTED
661 #define MCP2517FD_ICODE_FIFO_CH8 8
662 #define MCP2517FD_ICODE_FIFO_CH9 9
663 #define MCP2517FD_ICODE_FIFO_CH10 10
664 #define MCP2517FD_ICODE_FIFO_CH11 11
665 #define MCP2517FD_ICODE_FIFO_CH12 12
666 #define MCP2517FD_ICODE_FIFO_CH13 13
667 #define MCP2517FD_ICODE_FIFO_CH14 14
668 #define MCP2517FD_ICODE_FIFO_CH15 15
669#endif
670
671#ifdef MCP2517FD_FIFO_16TO31_IMPLEMENTED
672 #define MCP2517FD_ICODE_FIFO_CH16 16
673 #define MCP2517FD_ICODE_FIFO_CH17 17
674 #define MCP2517FD_ICODE_FIFO_CH18 18
675 #define MCP2517FD_ICODE_FIFO_CH19 19
676 #define MCP2517FD_ICODE_FIFO_CH20 20
677 #define MCP2517FD_ICODE_FIFO_CH21 21
678 #define MCP2517FD_ICODE_FIFO_CH22 22
679 #define MCP2517FD_ICODE_FIFO_CH23 23
680 #define MCP2517FD_ICODE_FIFO_CH24 24
681 #define MCP2517FD_ICODE_FIFO_CH25 25
682 #define MCP2517FD_ICODE_FIFO_CH26 26
683 #define MCP2517FD_ICODE_FIFO_CH27 27
684 #define MCP2517FD_ICODE_FIFO_CH28 28
685 #define MCP2517FD_ICODE_FIFO_CH29 29
686 #define MCP2517FD_ICODE_FIFO_CH30 30
687 #define MCP2517FD_ICODE_FIFO_CH31 31
688#endif
689
690#define MCP2517FD_ICODE_TOTAL_CHANNELS 32
691#define MCP2517FD_ICODE_NO_INT 64
692#define MCP2517FD_ICODE_CERRIF 65
693#define MCP2517FD_ICODE_WAKIF 66
694#define MCP2517FD_ICODE_RXOVIF 67
695#define MCP2517FD_ICODE_ADDRERR_SERRIF 68
696#define MCP2517FD_ICODE_MABOV_SERRIF 69
697#define MCP2517FD_ICODE_TBCIF 70
698#define MCP2517FD_ICODE_MODIF 71
699#define MCP2517FD_ICODE_IVMIF 72
700#define MCP2517FD_ICODE_TEFIF 73
701#define MCP2517FD_ICODE_TXATIF 74
702#define MCP2517FD_ICODE_RESERVED 75
703
708#define MCP2517FD_RXCODE_FIFO_CH0 0
709#define MCP2517FD_RXCODE_FIFO_CH1 1
710#define MCP2517FD_RXCODE_FIFO_CH2 2
711#define MCP2517FD_RXCODE_FIFO_CH3 3
712#define MCP2517FD_RXCODE_FIFO_CH4 4
713#define MCP2517FD_RXCODE_FIFO_CH5 5
714#define MCP2517FD_RXCODE_FIFO_CH6 6
715#define MCP2517FD_RXCODE_FIFO_CH7 7
716
717#ifdef MCP2517FD_FIFO_08TO15_IMPLEMENTED
718 #define MCP2517FD_RXCODE_FIFO_CH8 8
719 #define MCP2517FD_RXCODE_FIFO_CH9 9
720 #define MCP2517FD_RXCODE_FIFO_CH10 10
721 #define MCP2517FD_RXCODE_FIFO_CH11 11
722 #define MCP2517FD_RXCODE_FIFO_CH12 12
723 #define MCP2517FD_RXCODE_FIFO_CH13 13
724 #define MCP2517FD_RXCODE_FIFO_CH14 14
725 #define MCP2517FD_RXCODE_FIFO_CH15 15
726#endif
727
728#ifdef MCP2517FD_FIFO_16TO31_IMPLEMENTED
729 #define MCP2517FD_RXCODE_FIFO_CH16 16
730 #define MCP2517FD_RXCODE_FIFO_CH17 17
731 #define MCP2517FD_RXCODE_FIFO_CH18 18
732 #define MCP2517FD_RXCODE_FIFO_CH19 19
733 #define MCP2517FD_RXCODE_FIFO_CH20 20
734 #define MCP2517FD_RXCODE_FIFO_CH21 21
735 #define MCP2517FD_RXCODE_FIFO_CH22 22
736 #define MCP2517FD_RXCODE_FIFO_CH23 23
737 #define MCP2517FD_RXCODE_FIFO_CH24 24
738 #define MCP2517FD_RXCODE_FIFO_CH25 25
739 #define MCP2517FD_RXCODE_FIFO_CH26 26
740 #define MCP2517FD_RXCODE_FIFO_CH27 27
741 #define MCP2517FD_RXCODE_FIFO_CH28 28
742 #define MCP2517FD_RXCODE_FIFO_CH29 29
743 #define MCP2517FD_RXCODE_FIFO_CH30 30
744 #define MCP2517FD_RXCODE_FIFO_CH31 31
745#endif
746
747#define MCP2517FD_RXCODE_TOTAL_CHANNELS 32
748#define MCP2517FD_RXCODE_NO_INT 64
749#define MCP2517FD_RXCODE_RESERVED 65
750
755#define MCP2517FD_TXCODE_FIFO_CH0 0
756#define MCP2517FD_TXCODE_FIFO_CH1 1
757#define MCP2517FD_TXCODE_FIFO_CH2 2
758#define MCP2517FD_TXCODE_FIFO_CH3 3
759#define MCP2517FD_TXCODE_FIFO_CH4 4
760#define MCP2517FD_TXCODE_FIFO_CH5 5
761#define MCP2517FD_TXCODE_FIFO_CH6 6
762#define MCP2517FD_TXCODE_FIFO_CH7 7
763
764#ifdef MCP2517FD_FIFO_08TO15_IMPLEMENTED
765 #define MCP2517FD_TXCODE_FIFO_CH8 8
766 #define MCP2517FD_TXCODE_FIFO_CH9 9
767 #define MCP2517FD_TXCODE_FIFO_CH10 10
768 #define MCP2517FD_TXCODE_FIFO_CH11 11
769 #define MCP2517FD_TXCODE_FIFO_CH12 12
770 #define MCP2517FD_TXCODE_FIFO_CH13 13
771 #define MCP2517FD_TXCODE_FIFO_CH14 14
772 #define MCP2517FD_TXCODE_FIFO_CH15 15
773#endif
774
775#ifdef MCP2517FD_FIFO_16TO31_IMPLEMENTED
776 #define MCP2517FD_TXCODE_FIFO_CH16 16
777 #define MCP2517FD_TXCODE_FIFO_CH17 17
778 #define MCP2517FD_TXCODE_FIFO_CH18 18
779 #define MCP2517FD_TXCODE_FIFO_CH19 19
780 #define MCP2517FD_TXCODE_FIFO_CH20 20
781 #define MCP2517FD_TXCODE_FIFO_CH21 21
782 #define MCP2517FD_TXCODE_FIFO_CH22 22
783 #define MCP2517FD_TXCODE_FIFO_CH23 23
784 #define MCP2517FD_TXCODE_FIFO_CH24 24
785 #define MCP2517FD_TXCODE_FIFO_CH25 25
786 #define MCP2517FD_TXCODE_FIFO_CH26 26
787 #define MCP2517FD_TXCODE_FIFO_CH27 27
788 #define MCP2517FD_TXCODE_FIFO_CH28 28
789 #define MCP2517FD_TXCODE_FIFO_CH29 29
790 #define MCP2517FD_TXCODE_FIFO_CH30 30
791 #define MCP2517FD_TXCODE_FIFO_CH31 31
792#endif
793
794#define MCP2517FD_TXCODE_TOTAL_CHANNELS 32
795#define MCP2517FD_TXCODE_NO_INT 64
796#define MCP2517FD_TXCODE_RESERVED 65
797
802#define MCP2517FD_SYSCLK_40M 0
803#define MCP2517FD_SYSCLK_20M 1
804#define MCP2517FD_SYSCLK_10M 2
805
810#define MCP2517FD_CLKO_DIV1 0
811#define MCP2517FD_CLKO_DIV2 1
812#define MCP2517FD_CLKO_DIV4 2
813#define MCP2517FD_CLKO_DIV10 3
814
815#define N_MCP2517FD_FIFO_REGS ( MCP2517FD_FIFO_TOTAL_CHANNELS * MCP2517FD_FIFO_OFFSET )
816#define N_MCP2517FD_FILT_CTRL_REGS ( MCP2517FD_FILT_TOTAL / 4 )
817#define N_MCP2517FD_FILT_OBJ_REGS ( MCP2517FD_FILT_TOTAL * MCP2517FD_FILTER_OFFSET )
818
827#define MCP2517FD_SET_DATA_SAMPLE_EDGE SET_SPI_DATA_SAMPLE_EDGE
828#define MCP2517FD_SET_DATA_SAMPLE_MIDDLE SET_SPI_DATA_SAMPLE_MIDDLE
829
830 // mcp2517fd_set
831
846#define MCP2517FD_MAP_MIKROBUS( cfg, mikrobus ) \
847 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
848 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
849 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
850 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
851 cfg.stby = MIKROBUS( mikrobus, MIKROBUS_AN ); \
852 cfg.clk = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
853 cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT )
854
855 // mcp2517fd_map
856 // mcp2517fd
857
878
883typedef struct
884{
889 uint8_t tx_priority;
892 uint16_t standard_id;
893 uint32_t extended_id;
894 uint8_t fd_frame;
896 uint8_t ide;
898 uint8_t seq;
899
901
906typedef uint8_t mcp2517fd_id_t;
907
913
918typedef struct
919{
920 uint32_t sid : 11;
921 uint32_t eid : 18;
922 uint32_t sid11 : 1;
923 uint32_t unimplemented1 : 2;
924
926
931typedef struct
932{
933 uint32_t dlc;
934 uint32_t ide;
935 uint32_t rtr;
936 uint32_t brs;
937 uint32_t fdf;
938 uint32_t esi;
939 uint32_t seq;
941
943
948typedef union
949{
950 struct {
954 } bf;
955 uint32_t word[ 3 ];
956 uint8_t byte[ 12 ];
957
959
964typedef struct
965{
966 uint32_t dlc : 4;
967 uint32_t ide : 1;
968 uint32_t rtr : 1;
969 uint32_t brs : 1;
970 uint32_t fdf : 1;
971 uint32_t esi : 1;
972 uint32_t unimplemented1 : 2;
973 uint32_t filter_hit : 5;
974 uint32_t unimplemented2 : 16;
975
977
982typedef union
983{
984 struct {
988 } bf;
989 uint32_t word[ 3 ];
990 uint8_t byte[ 12 ];
991
993
998typedef union
999{
1000 struct {
1004 } bf;
1005 uint32_t word[ 3 ];
1006 uint8_t byte[ 12 ];
1007
1009
1014typedef struct
1015{
1016 uint32_t sid;
1017 uint32_t eid;
1018 uint32_t sid11;
1019 uint32_t exide;
1021
1023
1028typedef union
1029{
1031 uint32_t word;
1032 uint8_t byte[ 4 ];
1033
1035
1040typedef struct
1041{
1042 uint32_t msid;
1043 uint32_t meid;
1044 uint32_t msid11;
1045 uint32_t mide;
1047
1049
1054typedef union
1055{
1057 uint32_t word;
1058 uint8_t byte[ 4 ];
1059
1061
1062typedef union
1063{
1064 uint8_t byte[ 4 ];
1065 uint32_t word;
1066
1068
1073typedef union
1074{
1075 struct {
1077 uint32_t iso_crc_enable : 1;
1079 uint32_t unimplemented1 : 1;
1082 uint32_t unimplemented2 : 1;
1084 uint32_t unimplemented3 : 3;
1088 uint32_t store_in_tef : 1;
1089 uint32_t txq_enable : 1;
1090 uint32_t op_mode : 3;
1091 uint32_t request_op_mode : 3;
1092 uint32_t abort_all_tx : 1;
1094 } bf;
1095 uint32_t word;
1096 uint8_t byte[ 4 ];
1097
1099
1104typedef union
1105{
1106 struct {
1107 uint32_t tx_not_full_ie : 1;
1108 uint32_t unimplemented1 : 1;
1109 uint32_t tx_empty_ie : 1;
1110 uint32_t unimplemented2 : 1;
1111 uint32_t tx_attempt_ie : 1;
1112 uint32_t unimplemented3 : 2;
1113 uint32_t tx_enable : 1;
1114 uint32_t uinc : 1;
1115 uint32_t tx_request : 1;
1116 uint32_t freset : 1;
1117 uint32_t unimplemented4 : 5;
1118 uint32_t tx_priority : 5;
1119 uint32_t tx_attempts : 2;
1120 uint32_t unimplemented5 : 1;
1121 uint32_t fifo_size : 5;
1122 uint32_t pay_load_size : 3;
1123 } tx_bf;
1124 uint32_t word;
1125 uint8_t byte[ 4 ];
1126
1128
1133typedef union
1134{
1135 struct {
1136 uint32_t tefneie : 1;
1137 uint32_t tefhfie : 1;
1138 uint32_t teffulie : 1;
1139 uint32_t tefovie : 1;
1140 uint32_t unimplemented1 : 1;
1141 uint32_t time_stamp_enable : 1;
1142 uint32_t unimplemented2 : 2;
1143 uint32_t uinc : 1;
1144 uint32_t unimplemented3 : 1;
1145 uint32_t freset : 1;
1146 uint32_t unimplemented4 : 13;
1147 uint32_t fifo_size : 5;
1148 uint32_t unimplemented5 : 3;
1149 } bf;
1150 uint32_t word;
1151 uint8_t byte[ 4 ];
1152
1154
1159typedef union
1160{
1161 struct {
1162 uint32_t rx_not_empty_ie : 1;
1163 uint32_t rx_half_full_ie : 1;
1164 uint32_t rx_full_ie : 1;
1165 uint32_t rx_over_flow_ie : 1;
1166 uint32_t unimplemented1 : 1;
1168 uint32_t unimplemented2 : 1;
1169 uint32_t tx_enable : 1;
1170 uint32_t uinc : 1;
1171 uint32_t unimplemented3 : 1;
1172 uint32_t freset : 1;
1173 uint32_t unimplemented4 : 13;
1174 uint32_t fifo_size : 5;
1175 uint32_t pay_load_size : 3;
1176 } rx_bf;
1177
1178 struct {
1179 uint32_t tx_not_full_ie : 1;
1180 uint32_t tx_half_full_ie : 1;
1181 uint32_t tx_empty_ie : 1;
1182 uint32_t unimplemented1 : 1;
1183 uint32_t tx_attempt_ie : 1;
1184 uint32_t unimplemented2 : 1;
1185 uint32_t rtr_enable : 1;
1186 uint32_t tx_enable : 1;
1187 uint32_t uinc : 1;
1188 uint32_t tx_request : 1;
1189 uint32_t freset : 1;
1190 uint32_t unimplemented3 : 5;
1191 uint32_t tx_priority : 5;
1192 uint32_t tx_attempts : 2;
1193 uint32_t unimplemented4 : 1;
1194 uint32_t fifo_size : 5;
1195 uint32_t pay_load_size : 3;
1196 } tx_bf;
1197 uint32_t word;
1198 uint8_t byte[ 4 ];
1199
1201
1206typedef union
1207{
1208 struct {
1209 uint32_t buffer_pointer : 5;
1210 uint32_t unimplemented1 : 2;
1211 uint32_t enable : 1;
1212 } bf;
1213 uint8_t byte;
1214
1216
1221typedef union
1222{
1223 struct {
1224 uint32_t pll_enable : 1;
1225 uint32_t unimplemented1 : 1;
1226 uint32_t osc_disable : 1;
1227 uint32_t unimplemented2 : 1;
1228 uint32_t sclk_divide : 1;
1229 uint32_t clk_out_divide : 2;
1230 uint32_t unimplemented3 : 1;
1231 uint32_t pll_ready : 1;
1232 uint32_t unimplemented4 : 1;
1233 uint32_t osc_ready : 1;
1234 uint32_t unimplemented5 : 1;
1235 uint32_t sclk_ready : 1;
1236 uint32_t unimplemented6 : 19;
1237 } bf;
1238 uint32_t word;
1239 uint8_t byte[ 4 ];
1240
1242
1247typedef struct
1248{
1249 uint32_t pll_enable;
1250 uint32_t osc_disable;
1251 uint32_t sclk_divide;
1253
1255
1260typedef union
1261{
1262 struct {
1263 uint32_t tris0 : 1;
1264 uint32_t tris1 : 1;
1265 uint32_t unimplemented1 : 2;
1267 uint32_t auto_sleep_enable : 1;
1268 uint32_t xcr_stby_enable : 1;
1269 uint32_t unimplemented2 : 1;
1270 uint32_t lat0 : 1;
1271 uint32_t lat1 : 1;
1272 uint32_t unimplemented3 : 5;
1273 uint32_t hvdetsel : 1;
1274 uint32_t gpio0 : 1;
1275 uint32_t gpio1 : 1;
1276 uint32_t unimplemented4 : 6;
1277 uint32_t pin_mode0 : 1;
1278 uint32_t pin_mode1 : 1;
1279 uint32_t unimplemented5 : 2;
1280 uint32_t tx_can_open_drain : 1;
1281 uint32_t sof_output_enable : 1;
1283 uint32_t unimplemented6 : 1;
1284 } bf;
1285 uint32_t word;
1286 uint8_t byte[ 4 ];
1287
1289
1294typedef union
1295{
1296 struct {/* can_fd_ubp */
1297 uint32_t ecc_en : 1;
1298 uint32_t secie : 1;
1299 uint32_t dedie : 1;
1300 uint32_t unimplemented1 : 5;
1301 uint32_t parity : 7;
1302 uint32_t unimplemented2 : 17;
1303 } bf;
1304 uint32_t word;
1305 uint8_t byte[ 4 ];
1306
1308
1313typedef struct
1314{
1316 uint32_t iso_crc_enable : 1;
1324 uint32_t store_in_tef : 1;
1325 uint32_t txq_enable : 1;
1327
1329
1334typedef struct
1335{
1336 uint32_t rtr_enable;
1337 uint32_t tx_priority;
1338 uint32_t tx_attempts;
1339 uint32_t fifo_size;
1341
1343
1348typedef struct
1349{
1350 uint32_t tx_priority : 5;
1351 uint32_t tx_attempts : 2;
1352 uint32_t fifo_size : 5;
1353 uint32_t pay_load_size : 3;
1354
1356
1361typedef struct
1362{
1364 uint32_t fifo_size;
1366
1368
1369
1374typedef union
1375{
1376 struct {
1377 uint32_t user_address : 12;
1378 uint32_t unimplemented1 : 20;
1379 } bf;
1380 uint32_t word;
1381 uint8_t byte[ 4 ];
1382
1384
1389typedef struct
1390{
1392 uint32_t fifo_size;
1393
1395
1400typedef union
1401{
1402 struct {
1403 uint32_t swj : 7;
1404 uint32_t unimplemented1 : 1;
1405 uint32_t tseg2 : 7;
1406 uint32_t unimplemented2 : 1;
1407 uint32_t tseg1 : 8;
1408 uint32_t brp : 8;
1409 } bf;
1410 uint32_t word;
1411 uint8_t byte[ 4 ];
1412
1414
1419typedef union
1420{
1421 struct {
1422 uint32_t swj : 4;
1423 uint32_t unimplemented1 : 4;
1424 uint32_t tseg2 : 4;
1425 uint32_t unimplemented2 : 4;
1426 uint32_t tseg1 : 5;
1427 uint32_t unimplemented3 : 3;
1428 uint32_t brp : 8;
1429 } bf;
1430 uint32_t word;
1431 uint8_t byte[ 4 ];
1432
1434
1439typedef union
1440{
1441 struct {
1442 uint32_t tdc_value : 6;
1443 uint32_t unimplemented1 : 2;
1444 uint32_t tdc_offset : 7;
1445 uint32_t unimplemented2 : 1;
1446 uint32_t tdc_mode : 2;
1447 uint32_t unimplemented3 : 6;
1448 uint32_t sid11_enable : 1;
1450 uint32_t unimplemented4 : 6;
1451 } bf;
1452 uint32_t word;
1453 uint8_t byte[ 4 ];
1454
1456
1461typedef union
1462{
1463 struct {
1464 uint32_t tbc_prescaler : 10;
1465 uint32_t unimplemented1 : 6;
1466 uint32_t tbc_enable : 1;
1467 uint32_t time_stamp_eof : 1;
1468 uint32_t unimplemented2 : 14;
1469 } bf;
1470 uint32_t word;
1471 uint8_t byte[ 4 ];
1472
1474
1479typedef struct
1480{
1481 uint32_t txie : 1;
1482 uint32_t rxie : 1;
1483 uint32_t tbcie : 1;
1484 uint32_t modie : 1;
1485 uint32_t tefie : 1;
1486 uint32_t unimplemented2 : 3;
1487
1488 uint32_t eccie : 1;
1489 uint32_t spicrcie : 1;
1490 uint32_t txatie : 1;
1491 uint32_t rxovie : 1;
1492 uint32_t serrie : 1;
1493 uint32_t cerrie : 1;
1494 uint32_t wakie : 1;
1495 uint32_t ivmie : 1;
1496
1498
1503typedef union
1504{
1506 uint16_t word;
1507 uint8_t byte[ 2 ];
1508
1510
1515typedef union
1516{
1517 struct {
1518 uint32_t icode : 7;
1519 uint32_t unimplemented1 : 1;
1520 uint32_t filter_hit : 5;
1521 uint32_t unimplemented2 : 3;
1522 uint32_t tx_code : 7;
1523 uint32_t unimplemented3 : 1;
1524 uint32_t rx_code : 7;
1525 uint32_t unimplemented4 : 1;
1526 } bf;
1527 uint32_t word;
1528 uint8_t byte[ 4 ];
1529
1531
1536typedef struct
1537{
1538 uint32_t TXIF : 1;
1539 uint32_t RXIF : 1;
1540 uint32_t TBCIF : 1;
1541 uint32_t MODIF : 1;
1542 uint32_t TEFIF : 1;
1543 uint32_t unimplemented1 : 3;
1544
1545 uint32_t ECCIF : 1;
1546 uint32_t SPICRCIF : 1;
1547 uint32_t TXATIF : 1;
1548 uint32_t RXOVIF : 1;
1549 uint32_t SERRIF : 1;
1550 uint32_t CERRIF : 1;
1551 uint32_t WAKIF : 1;
1552 uint32_t IVMIF : 1;
1553
1555
1560typedef union
1561{
1563 uint16_t word;
1564 uint8_t byte[ 2 ];
1565
1567
1572typedef union
1573{
1574 struct {
1577 } bf;
1578 uint32_t word;
1579 uint8_t byte[ 4 ];
1580
1582
1587typedef union
1588{
1589 struct {
1590 uint32_t rx_error_count : 8;
1591 uint32_t tx_error_count : 8;
1598 uint32_t unimplemented1 : 10;
1599 } bf;
1600 uint32_t word;
1601 uint8_t byte[ 4 ];
1602
1604
1609typedef union
1610{
1611 struct {
1612 uint32_t tef_not_empty_if : 1;
1613 uint32_t tef_half_full_if : 1;
1614 uint32_t tef_full_if : 1;
1615 uint32_t tef_ov_if : 1;
1616 uint32_t unimplemented1 : 28;
1617 } bf;
1618 uint32_t word;
1619 uint8_t byte[ 4 ];
1620
1622
1627typedef union
1628{
1629 struct {
1630 uint32_t tx_not_full_if : 1;
1631 uint32_t unimplemented1 : 1;
1632 uint32_t tx_empty_if : 1;
1633 uint32_t unimplemented2 : 1;
1634 uint32_t tx_attempt_if : 1;
1635 uint32_t tx_error : 1;
1637 uint32_t tx_aborted : 1;
1638 uint32_t fifo_index : 5;
1639 uint32_t unimplemented3 : 19;
1640 } tx_bf;
1641 uint32_t word;
1642 uint8_t byte[ 4 ];
1643
1645
1650typedef union
1651{
1652 struct {
1653 uint32_t rx_not_empty_if : 1;
1654 uint32_t rx_half_full_if : 1;
1655 uint32_t rx_full_if : 1;
1656 uint32_t rx_over_flow_if : 1;
1657 uint32_t unimplemented1 : 4;
1658 uint32_t fifo_index : 5;
1659 uint32_t unimplemented2 : 19;
1660 } rx_bf;
1661
1662 struct {
1663 uint32_t tx_not_full_if : 1;
1664 uint32_t tx_half_full_if : 1;
1665 uint32_t tx_empty_if : 1;
1666 uint32_t unimplemented1 : 1;
1667 uint32_t tx_attempt_if : 1;
1668 uint32_t tx_error : 1;
1670 uint32_t tx_aborted : 1;
1671 uint32_t fifo_index : 5;
1672 uint32_t unimplemented2 : 19;
1673 } tx_bf;
1674 uint32_t word;
1675 uint8_t byte[ 4 ];
1676
1678
1683typedef union
1684{
1685 struct {
1686 uint32_t crc : 16;
1687 uint32_t crcerrif : 1;
1688 uint32_t ferrif : 1;
1689 uint32_t unimplemented1 : 6;
1690 uint32_t crcerrie : 1;
1691 uint32_t ferrie : 1;
1692 uint32_t unimplemented2 : 6;
1693 } bf;
1694 uint32_t word;
1695 uint8_t byte[ 4 ];
1696
1698
1703typedef union
1704{
1705 struct {
1706 uint32_t unimplemented1 : 1;
1707 uint32_t secif : 1;
1708 uint32_t dedif : 1;
1709 uint32_t unimplemented2 : 13;
1710 uint32_t error_address : 12;
1711 uint32_t unimplemented3 : 4;
1712 } bf;
1713 uint32_t word;
1714 uint8_t byte[ 4 ];
1715
1717
1722typedef struct
1723{
1724 uint32_t pll_ready : 1;
1725 uint32_t osc_ready : 1;
1726 uint32_t sclk_ready : 1;
1727
1729
1734typedef struct
1735{
1736 uint32_t n_bit0_err : 1;
1737 uint32_t n_bit1_err : 1;
1738 uint32_t n_ack_err : 1;
1739 uint32_t n_form_err : 1;
1740 uint32_t n_stuff_err : 1;
1741 uint32_t n_crc_err : 1;
1742 uint32_t unimplemented1 : 1;
1743 uint32_t txbo_err : 1;
1744 uint32_t d_bit0_err : 1;
1745 uint32_t d_bit1_err : 1;
1746 uint32_t unimplemented2 : 1;
1747 uint32_t d_form_err : 1;
1748 uint32_t d_stuff_err : 1;
1749 uint32_t d_crc_err : 1;
1750 uint32_t esi : 1;
1751 uint32_t dlc_mismatch : 1;
1752
1754
1759typedef struct
1760{
1761 uint8_t n_rec;
1762 uint8_t n_tec;
1763 uint8_t d_rec;
1764 uint8_t d_tec;
1765
1767
1772typedef union
1773{
1774 struct {
1778 } bf;
1779 uint32_t word[ 2 ];
1780 uint8_t byte[ 8 ];
1781
1783
1788typedef union
1789{
1790 struct {
1791 uint32_t n_rx_error_count : 8;
1792 uint32_t n_tx_error_count : 8;
1793 uint32_t d_rx_error_count : 8;
1794 uint32_t d_tx_error_count : 8;
1795 } bf;
1796 uint32_t word;
1797 uint8_t byte[ 4 ];
1798
1800
1805typedef union
1806{
1807 struct {
1809 uint32_t n_bit0_error : 1;
1810 uint32_t n_bit1_error : 1;
1811 uint32_t n_ack_error : 1;
1812 uint32_t n_form_error : 1;
1813 uint32_t n_stuff_error : 1;
1814 uint32_t n_crc_error : 1;
1815 uint32_t unimplemented1 : 1;
1816 uint32_t txbo_error : 1;
1817 uint32_t d_bit0_error : 1;
1818 uint32_t d_bit1_error : 1;
1819 uint32_t d_ack_error : 1;
1820 uint32_t d_form_error : 1;
1821 uint32_t d_stuff_error : 1;
1822 uint32_t d_crc_error : 1;
1823 uint32_t esi : 1;
1824 uint32_t unimplemented2 : 1;
1825 } bf;
1826 uint32_t word;
1827 uint8_t byte[ 4 ];
1828
1830
1835typedef struct
1836{
1837 uint16_t address;
1838 uint8_t *rxd;
1839 uint16_t n_bytes;
1840 uint8_t *txd;
1842
1844
1870
1875typedef struct
1876{
1877 // Output pins
1878 digital_out_t stby;
1880 // Input pins
1881 digital_in_t clk;
1882 digital_in_t int_pin;
1884 // Modules
1885 spi_master_t spi;
1887 pin_name_t chip_select;
1891
1892} mcp2517fd_t;
1893
1898typedef struct
1899{
1900 // Communication gpio pins
1901 pin_name_t miso;
1902 pin_name_t mosi;
1903 pin_name_t sck;
1904 pin_name_t cs;
1906 // Additional gpio pins
1907 pin_name_t stby;
1908 pin_name_t clk;
1909 pin_name_t int_pin;
1911 // static variable
1912 uint32_t spi_speed;
1913 spi_master_mode_t spi_mode;
1914 spi_master_chip_select_polarity_t cs_polarity;
1917
1922typedef enum
1923{
1925 MCP2517FD_ERROR = -1
1926
1928
1945
1960
1975
1990err_t mcp2517fd_generic_write ( mcp2517fd_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len );
1991
2006err_t mcp2517fd_generic_read ( mcp2517fd_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len );
2007
2019err_t mcp2517fd_transmit_message ( mcp2517fd_t *ctx, uint8_t *data_in, uint16_t data_len );
2020
2032err_t mcp2517fd_receive_message ( mcp2517fd_t *ctx, uint8_t *data_out, uint16_t *data_len );
2033
2045
2058err_t mcp2517fd_read_byte ( mcp2517fd_t *ctx, uint16_t address, uint8_t *data_out );
2059
2072err_t mcp2517fd_write_byte ( mcp2517fd_t *ctx, uint16_t address, uint8_t data_in );
2073
2086err_t mcp2517fd_read_word ( mcp2517fd_t *ctx, uint16_t address, uint32_t *data_out );
2087
2100err_t mcp2517fd_write_word ( mcp2517fd_t *ctx, uint16_t address, uint32_t data_in );
2101
2114err_t mcp2517fd_read_half_word ( mcp2517fd_t *ctx, uint16_t address, uint16_t *data_out );
2115
2128err_t mcp2517fd_write_half_word ( mcp2517fd_t *ctx, uint16_t address, uint16_t data_in );
2129
2145err_t mcp2517fd_write_byte_safe ( mcp2517fd_t *ctx, uint16_t address, uint8_t data_in );
2146
2162err_t mcp2517fd_write_word_safe ( mcp2517fd_t *ctx, uint16_t address, uint32_t data_in );
2163
2177err_t mcp2517fd_read_byte_array ( mcp2517fd_t *ctx, uint16_t address, uint8_t *data_out, uint16_t n_bytes );
2178
2191err_t mcp2517fd_read_byte_array_with_crc ( mcp2517fd_t *ctx, bool from_ram, bool *crc_is_correct );
2192
2206err_t mcp2517fd_write_byte_array ( mcp2517fd_t *ctx, uint16_t address, uint8_t *data_in, uint16_t n_bytes );
2207
2220
2234err_t mcp2517fd_read_word_array ( mcp2517fd_t *ctx, uint16_t address, uint32_t *data_out, uint16_t n_words );
2235
2249err_t mcp2517fd_write_word_array ( mcp2517fd_t *ctx, uint16_t address, uint32_t *data_in, uint16_t n_words );
2250
2263
2271
2284err_t mcp2517fd_operation_mode_select ( mcp2517fd_t *ctx, uint8_t op_mode );
2285
2294
2308
2316
2329
2337
2351err_t mcp2517fd_transmit_channel_load ( mcp2517fd_t *ctx, uint8_t channel, mcp2517fd_tx_msg_obj_t *tx_obj, bool flush );
2352
2364err_t mcp2517fd_transmit_channel_flush ( mcp2517fd_t *ctx, uint8_t channel );
2365
2378err_t mcp2517fd_transmit_channel_status_get ( mcp2517fd_t *ctx, uint8_t channel, uint16_t *status );
2379
2391err_t mcp2517fd_transmit_channel_reset ( mcp2517fd_t *ctx, uint8_t channel );
2392
2405err_t mcp2517fd_transmit_channel_update ( mcp2517fd_t *ctx, uint8_t channel, bool flush );
2406
2418err_t mcp2517fd_transmit_request_set ( mcp2517fd_t *ctx, uint32_t tx_req );
2419
2431err_t mcp2517fd_transmit_request_get ( mcp2517fd_t *ctx, uint32_t* tx_req );
2432
2444err_t mcp2517fd_transmit_channel_abort ( mcp2517fd_t *ctx, uint8_t channel );
2445
2457
2470
2484
2498
2512err_t mcp2517fd_filter_to_fifo_link ( mcp2517fd_t *ctx, uint8_t filter, uint8_t channel, bool enable );
2513
2525err_t mcp2517fd_filter_enable ( mcp2517fd_t *ctx, uint8_t filter );
2526
2539err_t mcp2517fd_filter_disable ( mcp2517fd_t *ctx, uint8_t filter );
2540
2554
2568 mcp2517fd_rx_fifo_cfg_t *config );
2569
2577
2590err_t mcp2517fd_receive_channel_status_get ( mcp2517fd_t *ctx, uint8_t channel, uint8_t *status );
2591
2608
2620err_t mcp2517fd_receive_channel_reset ( mcp2517fd_t *ctx, uint8_t channel );
2621
2633err_t mcp2517fd_receive_channel_update ( mcp2517fd_t *ctx, uint8_t channel );
2634
2646err_t mcp2517fd_tef_status_get ( mcp2517fd_t *ctx, uint8_t *status );
2647
2662
2674
2686
2699
2709
2721err_t mcp2517fd_module_event_get ( mcp2517fd_t *ctx, uint16_t *flags );
2722
2735err_t mcp2517fd_module_event_enable ( mcp2517fd_t *ctx, uint16_t flags );
2736
2749err_t mcp2517fd_module_event_disable ( mcp2517fd_t *ctx, uint16_t flags );
2750
2764err_t mcp2517fd_module_event_clear ( mcp2517fd_t *ctx, uint16_t flags );
2765
2777err_t mcp2517fd_module_event_rx_code_get ( mcp2517fd_t *ctx, uint8_t *rx_code );
2778
2790err_t mcp2517fd_module_event_tx_code_get ( mcp2517fd_t *ctx, uint8_t *tx_code );
2791
2803err_t mcp2517fd_module_event_filter_hit_get ( mcp2517fd_t *ctx, uint8_t* filter_hit );
2804
2816err_t mcp2517fd_module_event_icode_get ( mcp2517fd_t *ctx, uint8_t *icode );
2817
2830err_t mcp2517fd_transmit_channel_event_get ( mcp2517fd_t *ctx, uint8_t channel, uint8_t *flags );
2831
2843err_t mcp2517fd_transmit_event_get ( mcp2517fd_t *ctx, uint32_t *txif );
2844
2856err_t mcp2517fd_transmit_event_attempt_get ( mcp2517fd_t *ctx, uint32_t *txatif );
2857
2870err_t mcp2517fd_transmit_channel_index_get ( mcp2517fd_t *ctx, uint8_t channel, uint8_t *idx );
2871
2885err_t mcp2517fd_transmit_channel_event_enable( mcp2517fd_t *ctx, uint8_t channel, uint8_t flags );
2886
2900err_t mcp2517fd_transmit_channel_event_disable ( mcp2517fd_t *ctx, uint8_t channel, uint8_t flags );
2901
2915
2928err_t mcp2517fd_receive_channel_event_get ( mcp2517fd_t *ctx, uint8_t channel, uint8_t *flags );
2929
2941err_t mcp2517fd_receive_event_get ( mcp2517fd_t *ctx, uint32_t *rxif );
2942
2954err_t mcp2517fd_receive_event_overflow_get ( mcp2517fd_t *ctx, uint32_t *rxovif );
2955
2965err_t mcp2517fd_receive_channel_index_get ( mcp2517fd_t *ctx, uint8_t channel, uint8_t *idx );
2966
2980err_t mcp2517fd_receive_channel_event_enable ( mcp2517fd_t *ctx, uint8_t channel, uint8_t flags );
2981
2995err_t mcp2517fd_receive_channel_event_disable ( mcp2517fd_t *ctx, uint8_t channel, uint8_t flags );
2996
3010
3023err_t mcp2517fd_tef_event_get ( mcp2517fd_t *ctx, uint8_t* flags );
3024
3037err_t mcp2517fd_tef_event_enable ( mcp2517fd_t *ctx, uint8_t flags );
3038
3051err_t mcp2517fd_tef_event_disable ( mcp2517fd_t *ctx, uint8_t flags );
3052
3066
3079
3092
3104err_t mcp2517fd_error_state_get ( mcp2517fd_t *ctx, uint8_t *flags );
3105
3119err_t mcp2517fd_error_count_state_get ( mcp2517fd_t *ctx, uint8_t *tec, uint8_t *rec, uint8_t *flags );
3120
3134
3146
3159
3172
3185err_t mcp2517fd_ecc_event_get ( mcp2517fd_t *ctx, uint8_t *flags );
3186
3198err_t mcp2517fd_ecc_parity_set ( mcp2517fd_t *ctx, uint8_t parity );
3199
3211err_t mcp2517fd_ecc_parity_get ( mcp2517fd_t *ctx, uint8_t *parity );
3212
3224err_t mcp2517fd_ecc_error_address_get ( mcp2517fd_t *ctx, uint16_t *address );
3225
3238err_t mcp2517fd_ecc_event_enable ( mcp2517fd_t *ctx, uint8_t flags );
3239
3252err_t mcp2517fd_ecc_event_disable ( mcp2517fd_t *ctx, uint8_t flags );
3253
3266err_t mcp2517fd_ecc_event_clear ( mcp2517fd_t *ctx, uint8_t flags );
3267
3280err_t mcp2517fd_crc_event_enable ( mcp2517fd_t *ctx, uint8_t flags );
3281
3294err_t mcp2517fd_crc_event_disable ( mcp2517fd_t *ctx, uint8_t flags );
3295
3308err_t mcp2517fd_crc_event_clear ( mcp2517fd_t *ctx, uint8_t flags );
3309
3321err_t mcp2517fd_crc_event_get ( mcp2517fd_t *ctx, uint8_t *flags );
3322
3334err_t mcp2517fd_crc_value_get ( mcp2517fd_t *ctx, uint16_t *crc );
3335
3347err_t mcp2517fd_ram_init ( mcp2517fd_t *ctx, uint8_t rx_data );
3348
3361
3374
3386err_t mcp2517fd_time_stamp_get ( mcp2517fd_t *ctx, uint32_t *time_stamp );
3387
3399err_t mcp2517fd_time_stamp_set ( mcp2517fd_t *ctx, uint32_t ts );
3400
3414
3426err_t mcp2517fd_time_stamp_prescaler_set ( mcp2517fd_t *ctx, uint16_t time_stamp );
3427
3441
3457
3465
3478
3491err_t mcp2517fd_bit_time_configure ( mcp2517fd_t *ctx, uint8_t bit_time, uint8_t clk );
3492
3505
3518
3531
3544
3557
3570
3584err_t mcp2517fd_gpio_mode_configure ( mcp2517fd_t *ctx, uint8_t gpio0, uint8_t gpio1 );
3585
3599err_t mcp2517fd_gpio_direction_configure ( mcp2517fd_t *ctx, uint8_t gpio0, uint8_t gpio1 );
3600
3613
3626
3640
3654
3668err_t mcp2517fd_gpio_pin_set ( mcp2517fd_t *ctx, uint8_t pos, uint8_t latch );
3669
3682err_t mcp2517fd_gpio_pin_read ( mcp2517fd_t *ctx, uint8_t pos, uint8_t *state );
3683
3697
3704uint32_t mcp2517fd_dlc_to_data_bytes ( uint8_t dlc );
3705
3718err_t mcp2517fd_fifo_index_get ( mcp2517fd_t *ctx, uint8_t channel, uint8_t *data_out );
3719
3729uint16_t mcp2517fd_calculate_crc16 ( uint8_t *data_pointer, uint16_t size );
3730
3737uint8_t mcp2517fd_data_bytes_to_dlc ( uint8_t num );
3738
3739#ifdef __cplusplus
3740}
3741#endif
3742#endif // MCP2517FD_H
3743
3744 // mcp2517fd
3745
3746// ------------------------------------------------------------------------ END
err_t mcp2517fd_gpio_clock_output_configure(mcp2517fd_t *ctx, uint8_t mode)
Configure CLKO Pin.
err_t mcp2517fd_receive_event_get(mcp2517fd_t *ctx, uint32_t *rxif)
Get pending interrupts of all receive FIFOs.
err_t mcp2517fd_tef_event_get(mcp2517fd_t *ctx, uint8_t *flags)
Transmit Event FIFO Event Get.
err_t mcp2517fd_receive_message_get(mcp2517fd_t *ctx, uint8_t channel, mcp2517fd_rx_msg_obj_t *rx_obj)
Get Received Message.
err_t mcp2517fd_module_event_filter_hit_get(mcp2517fd_t *ctx, uint8_t *filter_hit)
Get Filter Hit.
err_t mcp2517fd_fifo_index_get(mcp2517fd_t *ctx, uint8_t channel, uint8_t *data_out)
FIFO Index Get.
err_t mcp2517fd_tef_event_disable(mcp2517fd_t *ctx, uint8_t flags)
Transmit Event FIFO Event Disable.
err_t mcp2517fd_gpio_pin_set(mcp2517fd_t *ctx, uint8_t pos, uint8_t latch)
GPIO Output Pin Set.
err_t mcp2517fd_read_byte_array(mcp2517fd_t *ctx, uint16_t address, uint8_t *data_out, uint16_t n_bytes)
SPI Read Byte Array.
err_t mcp2517fd_transmit_channel_update(mcp2517fd_t *ctx, uint8_t channel, bool flush)
Transmit FIFO Update.
err_t mcp2517fd_transmit_queue_configure(mcp2517fd_t *ctx, mcp2517fd_tx_que_cfg_t *config)
Configure Transmit Queue.
err_t mcp2517fd_ecc_event_clear(mcp2517fd_t *ctx, uint8_t flags)
ECC Event Clear.
err_t mcp2517fd_transmit_request_set(mcp2517fd_t *ctx, uint32_t tx_req)
Request transmissions using TXREQ register.
err_t mcp2517fd_bit_time_configure_data_40_mhz(mcp2517fd_t *ctx, uint8_t bit_time)
Configure Data bit time for 40MHz system clock.
err_t mcp2517fd_transmit_event_get(mcp2517fd_t *ctx, uint32_t *txif)
Get pending interrupts of all transmit FIFOs.
err_t mcp2517fd_tef_message_get(mcp2517fd_t *ctx, mcp2517fd_tef_msg_obj_t *tef_obj)
Get Transmit Event FIFO Message.
err_t mcp2517fd_crc_event_enable(mcp2517fd_t *ctx, uint8_t flags)
CRC Event Enable.
err_t mcp2517fd_transmit_channel_flush(mcp2517fd_t *ctx, uint8_t channel)
TX Channel Flush.
err_t mcp2517fd_write_word_safe(mcp2517fd_t *ctx, uint16_t address, uint32_t data_in)
SPI RAM Write Word Safe.
void mcp2517fd_tef_configure_object_reset(mcp2517fd_tef_cfg_t *config)
Reset TefConfigure object to reset value.
err_t mcp2517fd_bus_diagnostics_clear(mcp2517fd_t *ctx)
Clear Bus Diagnostic Registers.
err_t mcp2517fd_gpio_mode_configure(mcp2517fd_t *ctx, uint8_t gpio0, uint8_t gpio1)
Initialize GPIO Mode.
err_t mcp2517fd_write_byte_array_with_crc(mcp2517fd_t *ctx, bool from_ram)
SPI Write Byte Array with CRC.
err_t mcp2517fd_ram_init(mcp2517fd_t *ctx, uint8_t rx_data)
Initialize RAM.
err_t mcp2517fd_time_stamp_set(mcp2517fd_t *ctx, uint32_t ts)
Time Stamp Set.
err_t mcp2517fd_time_stamp_disable(mcp2517fd_t *ctx)
Time Stamp Disable.
err_t mcp2517fd_write_byte_array(mcp2517fd_t *ctx, uint16_t address, uint8_t *data_in, uint16_t n_bytes)
SPI Write Byte Array.
err_t mcp2517fd_transmit_channel_load(mcp2517fd_t *ctx, uint8_t channel, mcp2517fd_tx_msg_obj_t *tx_obj, bool flush)
TX Channel Load.
err_t mcp2517fd_transmit_channel_event_enable(mcp2517fd_t *ctx, uint8_t channel, uint8_t flags)
Transmit FIFO Event Enable.
err_t mcp2517fd_module_event_enable(mcp2517fd_t *ctx, uint16_t flags)
Module Event Enable.
err_t mcp2517fd_receive_channel_index_get(mcp2517fd_t *ctx, uint8_t channel, uint8_t *idx)
Receive FIFO Index Get.
err_t mcp2517fd_read_word(mcp2517fd_t *ctx, uint16_t address, uint32_t *data_out)
SPI Read Word.
err_t mcp2517fd_transmit_channel_reset(mcp2517fd_t *ctx, uint8_t channel)
Transmit FIFO Reset.
err_t mcp2517fd_gpio_standby_control_enable(mcp2517fd_t *ctx)
Enable Transceiver Standby Control.
err_t mcp2517fd_bit_time_configure(mcp2517fd_t *ctx, uint8_t bit_time, uint8_t clk)
Configure Bit Time registers (based on CAN clock speed).
err_t mcp2517fd_module_event_rx_code_get(mcp2517fd_t *ctx, uint8_t *rx_code)
Get RX Code.
err_t mcp2517fd_module_event_clear(mcp2517fd_t *ctx, uint16_t flags)
Module Event Clear.
err_t mcp2517fd_filter_mask_configure(mcp2517fd_t *ctx, uint8_t filter, mcp2517fd_mask_obj_id_t *mask)
Filter Mask Configuration.
err_t mcp2517fd_gpio_standby_control_disable(mcp2517fd_t *ctx)
Disable Transceiver Standby Control.
err_t mcp2517fd_transmit_channel_event_attempt_clear(mcp2517fd_t *ctx, uint8_t channel)
Transmit FIFO Event Clear.
err_t mcp2517fd_module_event_tx_code_get(mcp2517fd_t *ctx, uint8_t *tx_code)
Get TX Code.
err_t mcp2517fd_receive_channel_configure(mcp2517fd_t *ctx, uint8_t channel, mcp2517fd_rx_fifo_cfg_t *config)
Configure Receive FIFO.
err_t mcp2517fd_error_state_get(mcp2517fd_t *ctx, uint8_t *flags)
Error State Get.
err_t mcp2517fd_oscillator_status_get(mcp2517fd_t *ctx, mcp2517fd_osc_sta_t *status)
Get Oscillator Status.
err_t mcp2517fd_filter_to_fifo_link(mcp2517fd_t *ctx, uint8_t filter, uint8_t channel, bool enable)
Link Filter to FIFO.
err_t mcp2517fd_bit_time_configure_data_10_mhz(mcp2517fd_t *ctx, uint8_t bit_time)
Configure Data bit time for 10MHz system clock.
err_t mcp2517fd_transmit_request_get(mcp2517fd_t *ctx, uint32_t *tx_req)
Get TXREQ register.
err_t mcp2517fd_write_half_word(mcp2517fd_t *ctx, uint16_t address, uint16_t data_in)
SPI Write Half Word.
err_t mcp2517fd_receive_message(mcp2517fd_t *ctx, uint8_t *data_out, uint16_t *data_len)
Message Receive function.
err_t mcp2517fd_crc_event_disable(mcp2517fd_t *ctx, uint8_t flags)
CRC Event Disnable.
err_t mcp2517fd_tef_configure(mcp2517fd_t *ctx, mcp2517fd_tef_cfg_t *config)
Configure Transmit Event FIFO.
err_t mcp2517fd_transmit_channel_event_disable(mcp2517fd_t *ctx, uint8_t channel, uint8_t flags)
Transmit FIFO Event Disable.
err_t mcp2517fd_receive_channel_reset(mcp2517fd_t *ctx, uint8_t channel)
Receive FIFO Reset.
err_t mcp2517fd_ecc_event_get(mcp2517fd_t *ctx, uint8_t *flags)
ECC Event Get.
err_t mcp2517fd_receive_channel_event_enable(mcp2517fd_t *ctx, uint8_t channel, uint8_t flags)
Receive FIFO Event Enable.
err_t mcp2517fd_ecc_event_disable(mcp2517fd_t *ctx, uint8_t flags)
ECC Event Disable.
err_t mcp2517fd_error_count_state_get(mcp2517fd_t *ctx, uint8_t *tec, uint8_t *rec, uint8_t *flags)
Error Counts and Error State Get.
err_t mcp2517fd_generic_write(mcp2517fd_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
MCP2517FD data writing function.
err_t mcp2517fd_transmit_band_width_sharing_set(mcp2517fd_t *ctx, uint8_t tx_bws)
Set Transmit Bandwidth Sharing Delay.
err_t mcp2517fd_reset(mcp2517fd_t *ctx)
Reset function.
err_t mcp2517fd_error_count_transmit_get(mcp2517fd_t *ctx, uint8_t *tec)
Transmit Error Count Get.
err_t mcp2517fd_bit_time_configure_data_20_mhz(mcp2517fd_t *ctx, uint8_t bit_time)
Configure Nominal bit time for 20MHz system clock.
err_t mcp2517fd_receive_event_overflow_get(mcp2517fd_t *ctx, uint32_t *rxovif)
Get pending RXOVIF of all receive FIFOs.
void mcp2517fd_oscillator_control_object_reset(mcp2517fd_div_ctl_t *ctrl)
Reset Oscillator Control.
uint16_t mcp2517fd_calculate_crc16(uint8_t *data_pointer, uint16_t size)
Calculate CRC16.
err_t mcp2517fd_write_byte(mcp2517fd_t *ctx, uint16_t address, uint8_t data_in)
SPI Write Byte.
err_t mcp2517fd_transmit_channel_abort(mcp2517fd_t *ctx, uint8_t channel)
Abort transmission of single FIFO.
err_t mcp2517fd_receive_channel_update(mcp2517fd_t *ctx, uint8_t channel)
Receive FIFO Update.
err_t mcp2517fd_ecc_enable(mcp2517fd_t *ctx)
Enable ECC.
err_t mcp2517fd_module_event_icode_get(mcp2517fd_t *ctx, uint8_t *icode)
Get ICODE.
err_t mcp2517fd_oscillator_control_set(mcp2517fd_t *ctx, mcp2517fd_div_ctl_t ctrl)
Set Oscillator Control.
err_t mcp2517fd_device_net_filter_count_set(mcp2517fd_t *ctx, uint8_t dnfc)
Set Device Net Filter Count.
err_t mcp2517fd_default_cfg(mcp2517fd_t *ctx)
MCP2517FD default configuration function.
err_t mcp2517fd_gpio_interrupt_pins_open_drain_configure(mcp2517fd_t *ctx, uint8_t mode)
Configure Open Drain Interrupts.
err_t mcp2517fd_tef_event_enable(mcp2517fd_t *ctx, uint8_t flags)
Transmit Event FIFO Event Enable.
err_t mcp2517fd_time_stamp_prescaler_set(mcp2517fd_t *ctx, uint16_t time_stamp)
Time Stamp Prescaler Set.
void mcp2517fd_configure_object_reset(mcp2517fd_can_cfg_t *config)
Reset Configure object to reset values.
err_t mcp2517fd_transmit_event_attempt_get(mcp2517fd_t *ctx, uint32_t *txatif)
Get pending TXATIF of all transmit FIFOs.
err_t mcp2517fd_init(mcp2517fd_t *ctx, mcp2517fd_cfg_t *cfg)
MCP2517FD initialization function.
err_t mcp2517fd_transmit_message(mcp2517fd_t *ctx, uint8_t *data_in, uint16_t data_len)
Message Transmit function.
err_t mcp2517fd_error_count_receive_get(mcp2517fd_t *ctx, uint8_t *rec)
Receive Error Count Get.
err_t mcp2517fd_ecc_event_enable(mcp2517fd_t *ctx, uint8_t flags)
ECC Event Enable.
void mcp2517fd_transmit_queue_configure_object_reset(mcp2517fd_tx_que_cfg_t *config)
Reset Transmit Queue Configure object to reset values.
err_t mcp2517fd_transmit_channel_status_get(mcp2517fd_t *ctx, uint8_t channel, uint16_t *status)
Transmit Channel Status Get.
err_t mcp2517fd_bus_diagnostics_get(mcp2517fd_t *ctx, mcp2517fd_bus_diag_t *bus_diag)
Get Bus Diagnostic Registers: all data_ at once, since we want to keep them in synch.
err_t mcp2517fd_transmit_channel_configure(mcp2517fd_t *ctx, uint8_t channel, mcp2517fd_tx_fifo_cfg_t *config)
Configure Transmit FIFO.
err_t mcp2517fd_bit_time_configure_nominal_10_mhz(mcp2517fd_t *ctx, uint8_t bit_time)
Configure Nominal bit time for 10MHz system clock.
err_t mcp2517fd_crc_event_clear(mcp2517fd_t *ctx, uint8_t flags)
CRC Event Clear.
err_t mcp2517fd_tef_update(mcp2517fd_t *ctx)
Transmit Event FIFO Update.
err_t mcp2517fd_receive_channel_event_get(mcp2517fd_t *ctx, uint8_t channel, uint8_t *flags)
Receive FIFO Event Get.
err_t mcp2517fd_time_stamp_mode_configure(mcp2517fd_t *ctx, uint8_t mode)
Time Stamp Mode Configure.
err_t mcp2517fd_time_stamp_enable(mcp2517fd_t *ctx)
Time Stamp Enable.
err_t mcp2517fd_configure(mcp2517fd_t *ctx, mcp2517fd_can_cfg_t *config)
CAN Control register configuration.
err_t mcp2517fd_ecc_disable(mcp2517fd_t *ctx)
Disable ECC.
err_t mcp2517fd_transmit_abort_all(mcp2517fd_t *ctx)
Abort All transmissions.
uint8_t mcp2517fd_data_bytes_to_dlc(uint8_t num)
Data bytes to DLC conversion.
uint32_t mcp2517fd_dlc_to_data_bytes(uint8_t dlc)
DLC to number of actual data_bytes conversion.
err_t mcp2517fd_crc_event_get(mcp2517fd_t *ctx, uint8_t *flags)
CRC Event Get.
err_t mcp2517fd_read_half_word(mcp2517fd_t *ctx, uint16_t address, uint16_t *data_out)
SPI Read Half Word.
void mcp2517fd_cfg_setup(mcp2517fd_cfg_t *cfg)
MCP2517FD configuration object setup function.
err_t mcp2517fd_filter_disable(mcp2517fd_t *ctx, uint8_t filter)
Filter Disable.
err_t mcp2517fd_operation_mode_select(mcp2517fd_t *ctx, uint8_t op_mode)
Select Operation Mode.
err_t mcp2517fd_oscillator_enable(mcp2517fd_t *ctx)
Enable oscillator to wake-up from sleep.
err_t mcp2517fd_bit_time_configure_nominal_40_mhz(mcp2517fd_t *ctx, uint8_t bit_time)
Configure Nominal bit time for 40MHz system clock.
err_t mcp2517fd_transmit_channel_index_get(mcp2517fd_t *ctx, uint8_t channel, uint8_t *idx)
Transmit FIFO Index Get.
void mcp2517fd_receive_channel_configure_object_reset(mcp2517fd_rx_fifo_cfg_t *config)
Reset Receive Channel Configure object to reset value.
err_t mcp2517fd_write_word(mcp2517fd_t *ctx, uint16_t address, uint32_t data_in)
SPI Write Word.
err_t mcp2517fd_ecc_parity_get(mcp2517fd_t *ctx, uint8_t *parity)
Get ECC Parity.
err_t mcp2517fd_write_byte_safe(mcp2517fd_t *ctx, uint16_t address, uint8_t data_in)
SPI SFR Write Byte Safe.
err_t mcp2517fd_tef_reset(mcp2517fd_t *ctx)
Transmit Event FIFO Reset.
err_t mcp2517fd_crc_value_get(mcp2517fd_t *ctx, uint16_t *crc)
Get CRC Value from device.
err_t mcp2517fd_read_byte(mcp2517fd_t *ctx, uint16_t address, uint8_t *data_out)
SPI Read Byte function.
err_t mcp2517fd_time_stamp_get(mcp2517fd_t *ctx, uint32_t *time_stamp)
Time Stamp Get.
err_t mcp2517fd_receive_channel_status_get(mcp2517fd_t *ctx, uint8_t channel, uint8_t *status)
Receive Channel Status Get.
err_t mcp2517fd_tef_event_overflow_clear(mcp2517fd_t *ctx)
Transmit Event FIFO Event Clear.
err_t mcp2517fd_transmit_channel_event_get(mcp2517fd_t *ctx, uint8_t channel, uint8_t *flags)
Transmit FIFO Event Get.
err_t mcp2517fd_tef_status_get(mcp2517fd_t *ctx, uint8_t *status)
Transmit Event FIFO Status Get.
err_t mcp2517fd_ecc_parity_set(mcp2517fd_t *ctx, uint8_t parity)
Set ECC Parity.
err_t mcp2517fd_write_word_array(mcp2517fd_t *ctx, uint16_t address, uint32_t *data_in, uint16_t n_words)
SPI Write Word Array.
err_t mcp2517fd_operation_mode_get(mcp2517fd_t *ctx)
Get Operation Mode.
err_t mcp2517fd_ecc_error_address_get(mcp2517fd_t *ctx, uint16_t *address)
Get ECC Error Address.
err_t mcp2517fd_gpio_transmit_pin_open_drain_configure(mcp2517fd_t *ctx, uint8_t mode)
Configure Open Drain TXCAN.
void mcp2517fd_transmit_channel_configure_object_reset(mcp2517fd_tx_fifo_cfg_t *config)
Reset Transmit Channel Configure object to reset values.
err_t mcp2517fd_filter_object_configure(mcp2517fd_t *ctx, uint8_t filter, mcp2517fd_filt_obj_id_t *id)
Filter Object Configuration.
err_t mcp2517fd_module_event_get(mcp2517fd_t *ctx, uint16_t *flags)
Module Event Get.
err_t mcp2517fd_filter_enable(mcp2517fd_t *ctx, uint8_t filter)
Filter Enable.
err_t mcp2517fd_read_word_array(mcp2517fd_t *ctx, uint16_t address, uint32_t *data_out, uint16_t n_words)
SPI Read Word Array.
err_t mcp2517fd_read_byte_array_with_crc(mcp2517fd_t *ctx, bool from_ram, bool *crc_is_correct)
SPI Read Byte Array with CRC.
err_t mcp2517fd_receive_channel_event_overflow_clear(mcp2517fd_t *ctx, uint8_t channel)
Receive FIFO Event Clear.
err_t mcp2517fd_module_event_disable(mcp2517fd_t *ctx, uint16_t flags)
Module Event Disable.
err_t mcp2517fd_gpio_pin_read(mcp2517fd_t *ctx, uint8_t pos, uint8_t *state)
Input Pin Read.
err_t mcp2517fd_gpio_direction_configure(mcp2517fd_t *ctx, uint8_t gpio0, uint8_t gpio1)
Initialize GPIO Direction.
err_t mcp2517fd_bit_time_configure_nominal_20_mhz(mcp2517fd_t *ctx, uint8_t bit_time)
Configure Nominal bit time for 20MHz system clock.
err_t mcp2517fd_generic_read(mcp2517fd_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
MCP2517FD data reading function.
err_t mcp2517fd_receive_channel_event_disable(mcp2517fd_t *ctx, uint8_t channel, uint8_t flags)
Receive FIFO Event Disable.
uint8_t mcp2517fd_id_t
MCP2517FD Click Module ID.
Definition mcp2517fd.h:906
uint32_t mcp2517fd_msg_time_stamp_t
MCP2517FD Click CAN Message Time Stamp.
Definition mcp2517fd.h:912
mcp2517fd_return_value_t
MCP2517FD Click return value data.
Definition mcp2517fd.h:1923
@ MCP2517FD_OK
Definition mcp2517fd.h:1924
@ MCP2517FD_ERROR
Definition mcp2517fd.h:1925
This file contains SPI specific macros, functions, etc.
MCP2517FD Click CAN Configure.
Definition mcp2517fd.h:1314
uint32_t iso_crc_enable
Definition mcp2517fd.h:1316
uint32_t bit_rate_switch_disable
Definition mcp2517fd.h:1320
uint32_t protocol_expection_event_disable
Definition mcp2517fd.h:1317
uint32_t wake_up_filter_enable
Definition mcp2517fd.h:1318
uint32_t esi_in_gateway_mode
Definition mcp2517fd.h:1322
uint32_t wake_up_filter_time
Definition mcp2517fd.h:1319
uint32_t txq_enable
Definition mcp2517fd.h:1325
uint32_t store_in_tef
Definition mcp2517fd.h:1324
uint32_t system_error_to_listen_only
Definition mcp2517fd.h:1323
uint32_t d_net_filter_count
Definition mcp2517fd.h:1315
uint32_t tx_band_width_sharing
Definition mcp2517fd.h:1326
uint32_t restrict_re_tx_attempts
Definition mcp2517fd.h:1321
MCP2517FD Click CAN Bus Diagnostic flags.
Definition mcp2517fd.h:1735
uint32_t d_crc_err
Definition mcp2517fd.h:1749
uint32_t n_form_err
Definition mcp2517fd.h:1739
uint32_t d_stuff_err
Definition mcp2517fd.h:1748
uint32_t n_ack_err
Definition mcp2517fd.h:1738
uint32_t unimplemented1
Definition mcp2517fd.h:1742
uint32_t d_bit0_err
Definition mcp2517fd.h:1744
uint32_t d_form_err
Definition mcp2517fd.h:1747
uint32_t n_bit0_err
Definition mcp2517fd.h:1736
uint32_t txbo_err
Definition mcp2517fd.h:1743
uint32_t n_bit1_err
Definition mcp2517fd.h:1737
uint32_t dlc_mismatch
Definition mcp2517fd.h:1751
uint32_t n_stuff_err
Definition mcp2517fd.h:1740
uint32_t n_crc_err
Definition mcp2517fd.h:1741
uint32_t d_bit1_err
Definition mcp2517fd.h:1745
uint32_t unimplemented2
Definition mcp2517fd.h:1746
uint32_t esi
Definition mcp2517fd.h:1750
MCP2517FD Click CAN Bus Diagnostic Error Counts.
Definition mcp2517fd.h:1760
uint8_t d_rec
Definition mcp2517fd.h:1763
uint8_t d_tec
Definition mcp2517fd.h:1764
uint8_t n_tec
Definition mcp2517fd.h:1762
uint8_t n_rec
Definition mcp2517fd.h:1761
MCP2517FD Click CAN Configure.
Definition mcp2517fd.h:863
uint32_t iso_crc_enable
Definition mcp2517fd.h:865
uint32_t bit_rate_switch_disable
Definition mcp2517fd.h:869
uint32_t protocol_expection_event_disable
Definition mcp2517fd.h:866
uint32_t wake_up_filter_enable
Definition mcp2517fd.h:867
uint32_t esi_in_gateway_mode
Definition mcp2517fd.h:871
uint32_t wake_up_filter_time
Definition mcp2517fd.h:868
uint32_t txq_enable
Definition mcp2517fd.h:874
uint32_t store_in_tef
Definition mcp2517fd.h:873
uint32_t system_error_to_listen_only
Definition mcp2517fd.h:872
uint32_t d_net_filter_count
Definition mcp2517fd.h:864
uint32_t tx_band_width_sharing
Definition mcp2517fd.h:875
uint32_t restrict_re_tx_attempts
Definition mcp2517fd.h:870
MCP2517FD Click configuration object.
Definition mcp2517fd.h:1899
pin_name_t clk
Definition mcp2517fd.h:1908
pin_name_t stby
Definition mcp2517fd.h:1907
spi_master_chip_select_polarity_t cs_polarity
Definition mcp2517fd.h:1914
pin_name_t sck
Definition mcp2517fd.h:1903
spi_master_mode_t spi_mode
Definition mcp2517fd.h:1913
pin_name_t mosi
Definition mcp2517fd.h:1902
uint32_t spi_speed
Definition mcp2517fd.h:1912
pin_name_t int_pin
Definition mcp2517fd.h:1909
pin_name_t miso
Definition mcp2517fd.h:1901
pin_name_t cs
Definition mcp2517fd.h:1904
MCP2517FD Click CAN Message Configuration.
Definition mcp2517fd.h:884
uint16_t standard_id
Definition mcp2517fd.h:892
uint8_t seq
Definition mcp2517fd.h:898
uint8_t tx_fifo_size
Definition mcp2517fd.h:887
uint8_t switch_bit_rate
Definition mcp2517fd.h:895
uint8_t fd_frame
Definition mcp2517fd.h:894
uint8_t rx_pay_load_size
Definition mcp2517fd.h:891
uint8_t rx_fifo_size
Definition mcp2517fd.h:890
uint8_t ide
Definition mcp2517fd.h:896
uint8_t tx_pay_load_size
Definition mcp2517fd.h:888
uint8_t remote_frame_req
Definition mcp2517fd.h:897
uint8_t iso_crc_enable
Definition mcp2517fd.h:885
uint8_t tx_priority
Definition mcp2517fd.h:889
uint32_t extended_id
Definition mcp2517fd.h:893
uint8_t store_in_tef
Definition mcp2517fd.h:886
MCP2517FD Click CAN message configuration.
Definition mcp2517fd.h:1850
uint8_t error_flags
Definition mcp2517fd.h:1854
uint8_t tx_flags
Definition mcp2517fd.h:1852
uint8_t rx_flags
Definition mcp2517fd.h:1853
uint8_t selected_bit_time
Definition mcp2517fd.h:1851
mcp2517fd_filt_obj_t f_obj
Definition mcp2517fd.h:1865
mcp2517fd_tx_fifo_cfg_t tx_config
Definition mcp2517fd.h:1861
uint32_t tx_id
Definition mcp2517fd.h:1858
uint8_t tec
Definition mcp2517fd.h:1855
mcp2517fd_mask_obj_t m_obj
Definition mcp2517fd.h:1866
uint8_t rec
Definition mcp2517fd.h:1856
mcp2517fd_tx_msg_obj_t tx_obj
Definition mcp2517fd.h:1863
mcp2517fd_bus_diag_t bus_diagnostics
Definition mcp2517fd.h:1867
mcp2517fd_rx_fifo_cfg_t rx_config
Definition mcp2517fd.h:1862
mcp2517fd_rx_msg_obj_t rx_obj
Definition mcp2517fd.h:1864
mcp2517fd_can_cfg_t config
Definition mcp2517fd.h:1860
uint8_t op_mode
Definition mcp2517fd.h:1857
MCP2517FD Click Oscillator Control.
Definition mcp2517fd.h:1248
uint32_t pll_enable
Definition mcp2517fd.h:1249
uint32_t clk_out_divide
Definition mcp2517fd.h:1252
uint32_t osc_disable
Definition mcp2517fd.h:1250
uint32_t sclk_divide
Definition mcp2517fd.h:1251
MCP2517FD Click CAN Filter Object ID.
Definition mcp2517fd.h:1015
uint32_t sid11
Definition mcp2517fd.h:1018
uint32_t eid
Definition mcp2517fd.h:1017
uint32_t unimplemented1
Definition mcp2517fd.h:1020
uint32_t exide
Definition mcp2517fd.h:1019
uint32_t sid
Definition mcp2517fd.h:1016
MCP2517FD Click CAN message configuration.
Definition mcp2517fd.h:1836
uint32_t txd_num_bytes
Definition mcp2517fd.h:1841
uint8_t * rxd
Definition mcp2517fd.h:1838
uint16_t n_bytes
Definition mcp2517fd.h:1839
uint16_t address
Definition mcp2517fd.h:1837
uint8_t * txd
Definition mcp2517fd.h:1840
MCP2517FD Click Interrupt Enables.
Definition mcp2517fd.h:1480
uint32_t txatie
Definition mcp2517fd.h:1490
uint32_t tbcie
Definition mcp2517fd.h:1483
uint32_t eccie
Definition mcp2517fd.h:1488
uint32_t modie
Definition mcp2517fd.h:1484
uint32_t rxie
Definition mcp2517fd.h:1482
uint32_t txie
Definition mcp2517fd.h:1481
uint32_t wakie
Definition mcp2517fd.h:1494
uint32_t ivmie
Definition mcp2517fd.h:1495
uint32_t serrie
Definition mcp2517fd.h:1492
uint32_t rxovie
Definition mcp2517fd.h:1491
uint32_t spicrcie
Definition mcp2517fd.h:1489
uint32_t tefie
Definition mcp2517fd.h:1485
uint32_t unimplemented2
Definition mcp2517fd.h:1486
uint32_t cerrie
Definition mcp2517fd.h:1493
MCP2517FD Click Interrupt Flags.
Definition mcp2517fd.h:1537
uint32_t IVMIF
Definition mcp2517fd.h:1552
uint32_t TBCIF
Definition mcp2517fd.h:1540
uint32_t WAKIF
Definition mcp2517fd.h:1551
uint32_t unimplemented1
Definition mcp2517fd.h:1543
uint32_t TXIF
Definition mcp2517fd.h:1538
uint32_t ECCIF
Definition mcp2517fd.h:1545
uint32_t RXOVIF
Definition mcp2517fd.h:1548
uint32_t RXIF
Definition mcp2517fd.h:1539
uint32_t SERRIF
Definition mcp2517fd.h:1549
uint32_t TEFIF
Definition mcp2517fd.h:1542
uint32_t MODIF
Definition mcp2517fd.h:1541
uint32_t SPICRCIF
Definition mcp2517fd.h:1546
uint32_t CERRIF
Definition mcp2517fd.h:1550
uint32_t TXATIF
Definition mcp2517fd.h:1547
MCP2517FD Click CAN Mask Object ID.
Definition mcp2517fd.h:1041
uint32_t msid
Definition mcp2517fd.h:1042
uint32_t mide
Definition mcp2517fd.h:1045
uint32_t unimplemented1
Definition mcp2517fd.h:1046
uint32_t msid11
Definition mcp2517fd.h:1044
uint32_t meid
Definition mcp2517fd.h:1043
MCP2517FD Click CAN Message Object ID.
Definition mcp2517fd.h:919
uint32_t sid11
Definition mcp2517fd.h:922
uint32_t eid
Definition mcp2517fd.h:921
uint32_t unimplemented1
Definition mcp2517fd.h:923
uint32_t sid
Definition mcp2517fd.h:920
MCP2517FD Click Oscillator Status.
Definition mcp2517fd.h:1723
uint32_t osc_ready
Definition mcp2517fd.h:1725
uint32_t pll_ready
Definition mcp2517fd.h:1724
uint32_t sclk_ready
Definition mcp2517fd.h:1726
MCP2517FD Click CAN Receive Channel Configure.
Definition mcp2517fd.h:1362
uint32_t pay_load_size
Definition mcp2517fd.h:1365
uint32_t rx_time_stamp_enable
Definition mcp2517fd.h:1363
uint32_t fifo_size
Definition mcp2517fd.h:1364
MCP2517FD Click CAN RX Message Object Control.
Definition mcp2517fd.h:965
uint32_t ide
Definition mcp2517fd.h:967
uint32_t rtr
Definition mcp2517fd.h:968
uint32_t brs
Definition mcp2517fd.h:969
uint32_t unimplemented1
Definition mcp2517fd.h:972
uint32_t fdf
Definition mcp2517fd.h:970
uint32_t dlc
Definition mcp2517fd.h:966
uint32_t unimplemented2
Definition mcp2517fd.h:974
uint32_t filter_hit
Definition mcp2517fd.h:973
uint32_t esi
Definition mcp2517fd.h:971
MCP2517FD Click context object.
Definition mcp2517fd.h:1876
spi_master_t spi
Definition mcp2517fd.h:1885
mcp2517fd_func_data_t func_data
Definition mcp2517fd.h:1890
digital_in_t int_pin
Definition mcp2517fd.h:1882
digital_out_t stby
Definition mcp2517fd.h:1878
mcp2517fd_data_t glb_data
Definition mcp2517fd.h:1889
pin_name_t chip_select
Definition mcp2517fd.h:1887
digital_in_t clk
Definition mcp2517fd.h:1881
MCP2517FD Click CAN Transmit Event FIFO Configure.
Definition mcp2517fd.h:1390
uint32_t time_stamp_enable
Definition mcp2517fd.h:1391
uint32_t fifo_size
Definition mcp2517fd.h:1392
MCP2517FD Click CAN Transmit Channel Configure.
Definition mcp2517fd.h:1335
uint32_t pay_load_size
Definition mcp2517fd.h:1340
uint32_t tx_priority
Definition mcp2517fd.h:1337
uint32_t rtr_enable
Definition mcp2517fd.h:1336
uint32_t fifo_size
Definition mcp2517fd.h:1339
uint32_t tx_attempts
Definition mcp2517fd.h:1338
MCP2517FD Click CAN TX Message Object Control.
Definition mcp2517fd.h:932
uint32_t ide
Definition mcp2517fd.h:934
uint32_t rtr
Definition mcp2517fd.h:935
uint32_t brs
Definition mcp2517fd.h:936
uint32_t unimplemented1
Definition mcp2517fd.h:940
uint32_t fdf
Definition mcp2517fd.h:937
uint32_t dlc
Definition mcp2517fd.h:933
uint32_t seq
Definition mcp2517fd.h:939
uint32_t esi
Definition mcp2517fd.h:938
MCP2517FD Click CAN Transmit Queue Configure.
Definition mcp2517fd.h:1349
uint32_t pay_load_size
Definition mcp2517fd.h:1353
uint32_t tx_priority
Definition mcp2517fd.h:1350
uint32_t fifo_size
Definition mcp2517fd.h:1352
uint32_t tx_attempts
Definition mcp2517fd.h:1351
MCP2517FD Click Diagnostic register 0.
Definition mcp2517fd.h:1789
uint32_t d_tx_error_count
Definition mcp2517fd.h:1794
uint32_t word
Definition mcp2517fd.h:1796
uint32_t n_tx_error_count
Definition mcp2517fd.h:1792
uint32_t d_rx_error_count
Definition mcp2517fd.h:1793
uint32_t n_rx_error_count
Definition mcp2517fd.h:1791
MCP2517FD Click Diagnostic register 1.
Definition mcp2517fd.h:1806
uint32_t error_free_msg_count
Definition mcp2517fd.h:1808
uint32_t n_bit0_error
Definition mcp2517fd.h:1809
uint32_t d_stuff_error
Definition mcp2517fd.h:1821
uint32_t n_form_error
Definition mcp2517fd.h:1812
uint32_t d_form_error
Definition mcp2517fd.h:1820
uint32_t d_crc_error
Definition mcp2517fd.h:1822
uint32_t d_ack_error
Definition mcp2517fd.h:1819
uint32_t word
Definition mcp2517fd.h:1826
uint32_t unimplemented1
Definition mcp2517fd.h:1815
uint32_t d_bit1_error
Definition mcp2517fd.h:1818
uint32_t n_bit1_error
Definition mcp2517fd.h:1810
uint32_t n_ack_error
Definition mcp2517fd.h:1811
uint32_t d_bit0_error
Definition mcp2517fd.h:1817
uint32_t n_stuff_error
Definition mcp2517fd.h:1813
uint32_t n_crc_error
Definition mcp2517fd.h:1814
uint32_t unimplemented2
Definition mcp2517fd.h:1824
uint32_t esi
Definition mcp2517fd.h:1823
uint32_t txbo_error
Definition mcp2517fd.h:1816
MCP2517FD Click CAN BUS DIAGNOSTICS.
Definition mcp2517fd.h:1773
mcp2517fd_bus_error_count_t error_count
Definition mcp2517fd.h:1775
mcp2517fd_bus_diag_flags_t flag
Definition mcp2517fd.h:1777
uint16_t error_free_msg_count
Definition mcp2517fd.h:1776
MCP2517FD Click CRC Regsiter.
Definition mcp2517fd.h:1684
uint32_t crcerrif
Definition mcp2517fd.h:1687
uint32_t word
Definition mcp2517fd.h:1694
uint32_t unimplemented1
Definition mcp2517fd.h:1689
uint32_t ferrie
Definition mcp2517fd.h:1691
uint32_t crc
Definition mcp2517fd.h:1686
uint32_t crcerrie
Definition mcp2517fd.h:1690
uint32_t ferrif
Definition mcp2517fd.h:1688
uint32_t unimplemented2
Definition mcp2517fd.h:1692
MCP2517FD Click CAN Control Register.
Definition mcp2517fd.h:1074
uint32_t iso_crc_enable
Definition mcp2517fd.h:1077
uint32_t bit_rate_switch_disable
Definition mcp2517fd.h:1083
uint32_t word
Definition mcp2517fd.h:1095
uint32_t unimplemented1
Definition mcp2517fd.h:1079
uint32_t wake_up_filter_enable
Definition mcp2517fd.h:1080
uint32_t esi_in_gateway_mode
Definition mcp2517fd.h:1086
uint32_t wake_up_filter_time
Definition mcp2517fd.h:1081
uint32_t txq_enable
Definition mcp2517fd.h:1089
uint32_t protocol_exception_event_disable
Definition mcp2517fd.h:1078
uint32_t store_in_tef
Definition mcp2517fd.h:1088
uint32_t system_error_to_listen_only
Definition mcp2517fd.h:1087
uint32_t d_net_filter_count
Definition mcp2517fd.h:1076
uint32_t unimplemented2
Definition mcp2517fd.h:1082
uint32_t op_mode
Definition mcp2517fd.h:1090
uint32_t request_op_mode
Definition mcp2517fd.h:1091
uint32_t abort_all_tx
Definition mcp2517fd.h:1092
uint32_t tx_band_width_sharing
Definition mcp2517fd.h:1093
uint32_t unimplemented3
Definition mcp2517fd.h:1084
uint32_t restrict_re_tx_attempts
Definition mcp2517fd.h:1085
MCP2517FD Click Data Bit Time Configuration Register.
Definition mcp2517fd.h:1420
uint32_t brp
Definition mcp2517fd.h:1428
uint32_t swj
Definition mcp2517fd.h:1422
uint32_t word
Definition mcp2517fd.h:1430
uint32_t unimplemented1
Definition mcp2517fd.h:1423
uint32_t tseg1
Definition mcp2517fd.h:1426
uint32_t tseg2
Definition mcp2517fd.h:1424
uint32_t unimplemented2
Definition mcp2517fd.h:1425
uint32_t unimplemented3
Definition mcp2517fd.h:1427
MCP2517FD Click ECC Control Register.
Definition mcp2517fd.h:1295
uint32_t word
Definition mcp2517fd.h:1304
uint32_t unimplemented1
Definition mcp2517fd.h:1300
uint32_t secie
Definition mcp2517fd.h:1298
uint32_t parity
Definition mcp2517fd.h:1301
uint32_t ecc_en
Definition mcp2517fd.h:1297
uint32_t unimplemented2
Definition mcp2517fd.h:1302
uint32_t dedie
Definition mcp2517fd.h:1299
MCP2517FD Click ECC Status Register.
Definition mcp2517fd.h:1704
uint32_t error_address
Definition mcp2517fd.h:1710
uint32_t word
Definition mcp2517fd.h:1713
uint32_t unimplemented1
Definition mcp2517fd.h:1706
uint32_t dedif
Definition mcp2517fd.h:1708
uint32_t secif
Definition mcp2517fd.h:1707
uint32_t unimplemented2
Definition mcp2517fd.h:1709
uint32_t unimplemented3
Definition mcp2517fd.h:1711
MCP2517FD Click FIFO Control Register.
Definition mcp2517fd.h:1160
uint32_t unimplemented4
Definition mcp2517fd.h:1173
uint32_t word
Definition mcp2517fd.h:1197
uint32_t pay_load_size
Definition mcp2517fd.h:1175
uint32_t unimplemented1
Definition mcp2517fd.h:1166
uint32_t rx_over_flow_ie
Definition mcp2517fd.h:1165
uint32_t uinc
Definition mcp2517fd.h:1170
uint32_t tx_not_full_ie
Definition mcp2517fd.h:1179
uint32_t tx_priority
Definition mcp2517fd.h:1191
uint32_t rtr_enable
Definition mcp2517fd.h:1185
uint32_t tx_attempt_ie
Definition mcp2517fd.h:1183
uint32_t rx_time_stamp_enable
Definition mcp2517fd.h:1167
uint32_t fifo_size
Definition mcp2517fd.h:1174
uint32_t unimplemented2
Definition mcp2517fd.h:1168
uint32_t tx_empty_ie
Definition mcp2517fd.h:1181
uint32_t tx_attempts
Definition mcp2517fd.h:1192
uint32_t rx_not_empty_ie
Definition mcp2517fd.h:1162
uint32_t tx_request
Definition mcp2517fd.h:1188
uint32_t tx_enable
Definition mcp2517fd.h:1169
uint32_t tx_half_full_ie
Definition mcp2517fd.h:1180
uint32_t rx_full_ie
Definition mcp2517fd.h:1164
uint32_t freset
Definition mcp2517fd.h:1172
uint32_t unimplemented3
Definition mcp2517fd.h:1171
uint32_t rx_half_full_ie
Definition mcp2517fd.h:1163
MCP2517FD Click FIFO Status Register.
Definition mcp2517fd.h:1651
uint32_t fifo_index
Definition mcp2517fd.h:1658
uint32_t tx_not_full_if
Definition mcp2517fd.h:1663
uint32_t tx_error
Definition mcp2517fd.h:1668
uint32_t word
Definition mcp2517fd.h:1674
uint32_t rx_full_if
Definition mcp2517fd.h:1655
uint32_t unimplemented1
Definition mcp2517fd.h:1657
uint32_t tx_half_full_if
Definition mcp2517fd.h:1664
uint32_t tx_attempt_if
Definition mcp2517fd.h:1667
uint32_t rx_not_empty_if
Definition mcp2517fd.h:1653
uint32_t tx_empty_if
Definition mcp2517fd.h:1665
uint32_t unimplemented2
Definition mcp2517fd.h:1659
uint32_t tx_lost_arbitration
Definition mcp2517fd.h:1669
uint32_t rx_half_full_if
Definition mcp2517fd.h:1654
uint32_t tx_aborted
Definition mcp2517fd.h:1670
uint32_t rx_over_flow_if
Definition mcp2517fd.h:1656
MCP2517FD Click FIFO User Address Register.
Definition mcp2517fd.h:1375
uint32_t user_address
Definition mcp2517fd.h:1377
uint32_t word
Definition mcp2517fd.h:1380
uint32_t unimplemented1
Definition mcp2517fd.h:1378
MCP2517FD Click Filter Control Register.
Definition mcp2517fd.h:1207
uint32_t enable
Definition mcp2517fd.h:1211
uint32_t buffer_pointer
Definition mcp2517fd.h:1209
uint32_t unimplemented1
Definition mcp2517fd.h:1210
uint8_t byte
Definition mcp2517fd.h:1213
MCP2517FD Click Filter Object Register.
Definition mcp2517fd.h:1029
uint32_t word
Definition mcp2517fd.h:1031
mcp2517fd_filt_obj_id_t bf
Definition mcp2517fd.h:1030
MCP2517FD Click Interrupt Configuration.
Definition mcp2517fd.h:1504
mcp2517fd_int_en_t ie
Definition mcp2517fd.h:1505
uint16_t word
Definition mcp2517fd.h:1506
MCP2517FD Click Interrupt Flag Register.
Definition mcp2517fd.h:1561
mcp2517fd_int_flags_stat_t if_stat
Definition mcp2517fd.h:1562
uint16_t word
Definition mcp2517fd.h:1563
MCP2517FD Click Interrupt Register.
Definition mcp2517fd.h:1573
mcp2517fd_int_en_t ie
Definition mcp2517fd.h:1576
uint32_t word
Definition mcp2517fd.h:1578
mcp2517fd_int_flags_stat_t if_stat
Definition mcp2517fd.h:1575
MCP2517FD Click Interrupt Vector Register.
Definition mcp2517fd.h:1516
uint32_t tx_code
Definition mcp2517fd.h:1522
uint32_t icode
Definition mcp2517fd.h:1518
uint32_t unimplemented4
Definition mcp2517fd.h:1525
uint32_t word
Definition mcp2517fd.h:1527
uint32_t unimplemented1
Definition mcp2517fd.h:1519
uint32_t unimplemented2
Definition mcp2517fd.h:1521
uint32_t rx_code
Definition mcp2517fd.h:1524
uint32_t filter_hit
Definition mcp2517fd.h:1520
uint32_t unimplemented3
Definition mcp2517fd.h:1523
MCP2517FD Click I/O Control Register.
Definition mcp2517fd.h:1261
uint32_t pin_mode1
Definition mcp2517fd.h:1278
uint32_t tris1
Definition mcp2517fd.h:1264
uint32_t unimplemented5
Definition mcp2517fd.h:1279
uint32_t pin_mode0
Definition mcp2517fd.h:1277
uint32_t tris0
Definition mcp2517fd.h:1263
uint32_t clear_auto_sleep_on_match
Definition mcp2517fd.h:1266
uint32_t unimplemented4
Definition mcp2517fd.h:1276
uint32_t unimplemented6
Definition mcp2517fd.h:1283
uint32_t word
Definition mcp2517fd.h:1285
uint32_t unimplemented1
Definition mcp2517fd.h:1265
uint32_t tx_can_open_drain
Definition mcp2517fd.h:1280
uint32_t int_pin_open_drain
Definition mcp2517fd.h:1282
uint32_t auto_sleep_enable
Definition mcp2517fd.h:1267
uint32_t sof_output_enable
Definition mcp2517fd.h:1281
uint32_t lat1
Definition mcp2517fd.h:1271
uint32_t xcr_stby_enable
Definition mcp2517fd.h:1268
uint32_t gpio0
Definition mcp2517fd.h:1274
uint32_t gpio1
Definition mcp2517fd.h:1275
uint32_t unimplemented2
Definition mcp2517fd.h:1269
uint32_t hvdetsel
Definition mcp2517fd.h:1273
uint32_t unimplemented3
Definition mcp2517fd.h:1272
uint32_t lat0
Definition mcp2517fd.h:1270
MCP2517FD Click Mask Object Register.
Definition mcp2517fd.h:1055
uint32_t word
Definition mcp2517fd.h:1057
mcp2517fd_mask_obj_id_t bf
Definition mcp2517fd.h:1056
MCP2517FD Click Nominal Bit Time Configuration Register.
Definition mcp2517fd.h:1401
uint32_t brp
Definition mcp2517fd.h:1408
uint32_t swj
Definition mcp2517fd.h:1403
uint32_t word
Definition mcp2517fd.h:1410
uint32_t unimplemented1
Definition mcp2517fd.h:1404
uint32_t tseg1
Definition mcp2517fd.h:1407
uint32_t tseg2
Definition mcp2517fd.h:1405
uint32_t unimplemented2
Definition mcp2517fd.h:1406
MCP2517FD Click Oscillator Control Register.
Definition mcp2517fd.h:1222
uint32_t osc_ready
Definition mcp2517fd.h:1233
uint32_t pll_enable
Definition mcp2517fd.h:1224
uint32_t unimplemented5
Definition mcp2517fd.h:1234
uint32_t unimplemented4
Definition mcp2517fd.h:1232
uint32_t unimplemented6
Definition mcp2517fd.h:1236
uint32_t word
Definition mcp2517fd.h:1238
uint32_t unimplemented1
Definition mcp2517fd.h:1225
uint32_t pll_ready
Definition mcp2517fd.h:1231
uint32_t clk_out_divide
Definition mcp2517fd.h:1229
uint32_t unimplemented2
Definition mcp2517fd.h:1227
uint32_t sclk_ready
Definition mcp2517fd.h:1235
uint32_t osc_disable
Definition mcp2517fd.h:1226
uint32_t unimplemented3
Definition mcp2517fd.h:1230
uint32_t sclk_divide
Definition mcp2517fd.h:1228
Definition mcp2517fd.h:1063
uint32_t word
Definition mcp2517fd.h:1065
MCP2517FD Click CAN RX Message Object.
Definition mcp2517fd.h:983
mcp2517fd_msg_obj_id_t id
Definition mcp2517fd.h:985
mcp2517fd_msg_time_stamp_t time_stamp
Definition mcp2517fd.h:987
mcp2517fd_rx_msg_obj_ctl_t ctrl
Definition mcp2517fd.h:986
MCP2517FD Click Transmitter Delay Compensation Register.
Definition mcp2517fd.h:1440
uint32_t tdc_offset
Definition mcp2517fd.h:1444
uint32_t unimplemented4
Definition mcp2517fd.h:1450
uint32_t tdc_value
Definition mcp2517fd.h:1442
uint32_t word
Definition mcp2517fd.h:1452
uint32_t unimplemented1
Definition mcp2517fd.h:1443
uint32_t sid11_enable
Definition mcp2517fd.h:1448
uint32_t edge_filter_enable
Definition mcp2517fd.h:1449
uint32_t tdc_mode
Definition mcp2517fd.h:1446
uint32_t unimplemented2
Definition mcp2517fd.h:1445
uint32_t unimplemented3
Definition mcp2517fd.h:1447
MCP2517FD Click Transmit Event FIFO Control Register.
Definition mcp2517fd.h:1134
uint32_t tefovie
Definition mcp2517fd.h:1139
uint32_t unimplemented5
Definition mcp2517fd.h:1148
uint32_t unimplemented4
Definition mcp2517fd.h:1146
uint32_t word
Definition mcp2517fd.h:1150
uint32_t unimplemented1
Definition mcp2517fd.h:1140
uint32_t uinc
Definition mcp2517fd.h:1143
uint32_t time_stamp_enable
Definition mcp2517fd.h:1141
uint32_t teffulie
Definition mcp2517fd.h:1138
uint32_t fifo_size
Definition mcp2517fd.h:1147
uint32_t unimplemented2
Definition mcp2517fd.h:1142
uint32_t tefneie
Definition mcp2517fd.h:1136
uint32_t freset
Definition mcp2517fd.h:1145
uint32_t unimplemented3
Definition mcp2517fd.h:1144
uint32_t tefhfie
Definition mcp2517fd.h:1137
MCP2517FD Click CAN TEF Message Object.
Definition mcp2517fd.h:999
mcp2517fd_msg_obj_id_t id
Definition mcp2517fd.h:1001
mcp2517fd_msg_time_stamp_t time_stamp
Definition mcp2517fd.h:1003
mcp2517fd_tx_msg_obj_ctl_t ctrl
Definition mcp2517fd.h:1002
MCP2517FD Click Transmit Event FIFO Status Register.
Definition mcp2517fd.h:1610
uint32_t tef_full_if
Definition mcp2517fd.h:1614
uint32_t word
Definition mcp2517fd.h:1618
uint32_t unimplemented1
Definition mcp2517fd.h:1616
uint32_t tef_not_empty_if
Definition mcp2517fd.h:1612
uint32_t tef_ov_if
Definition mcp2517fd.h:1615
uint32_t tef_half_full_if
Definition mcp2517fd.h:1613
MCP2517FD Click Transmit/Receive Error Count Register.
Definition mcp2517fd.h:1588
uint32_t word
Definition mcp2517fd.h:1600
uint32_t tx_error_state_bus_off
Definition mcp2517fd.h:1597
uint32_t unimplemented1
Definition mcp2517fd.h:1598
uint32_t rx_error_state_passive
Definition mcp2517fd.h:1595
uint32_t tx_error_count
Definition mcp2517fd.h:1591
uint32_t tx_error_state_warning
Definition mcp2517fd.h:1594
uint32_t error_state_warning
Definition mcp2517fd.h:1592
uint32_t rx_error_count
Definition mcp2517fd.h:1590
uint32_t rx_error_state_warning
Definition mcp2517fd.h:1593
uint32_t tx_error_state_passive
Definition mcp2517fd.h:1596
MCP2517FD Click Time Stamp Configuration Register.
Definition mcp2517fd.h:1462
uint32_t tbc_enable
Definition mcp2517fd.h:1466
uint32_t word
Definition mcp2517fd.h:1470
uint32_t unimplemented1
Definition mcp2517fd.h:1465
uint32_t tbc_prescaler
Definition mcp2517fd.h:1464
uint32_t unimplemented2
Definition mcp2517fd.h:1468
uint32_t time_stamp_eof
Definition mcp2517fd.h:1467
MCP2517FD Click CAN TX Message Object.
Definition mcp2517fd.h:949
mcp2517fd_msg_obj_id_t id
Definition mcp2517fd.h:951
mcp2517fd_msg_time_stamp_t time_stamp
Definition mcp2517fd.h:953
mcp2517fd_tx_msg_obj_ctl_t ctrl
Definition mcp2517fd.h:952
MCP2517FD Click Transmit Queue Control Register.
Definition mcp2517fd.h:1105
uint32_t unimplemented5
Definition mcp2517fd.h:1120
uint32_t unimplemented4
Definition mcp2517fd.h:1117
uint32_t word
Definition mcp2517fd.h:1124
uint32_t pay_load_size
Definition mcp2517fd.h:1122
uint32_t unimplemented1
Definition mcp2517fd.h:1108
uint32_t uinc
Definition mcp2517fd.h:1114
uint32_t tx_not_full_ie
Definition mcp2517fd.h:1107
uint32_t tx_priority
Definition mcp2517fd.h:1118
uint32_t tx_attempt_ie
Definition mcp2517fd.h:1111
uint32_t fifo_size
Definition mcp2517fd.h:1121
uint32_t unimplemented2
Definition mcp2517fd.h:1110
uint32_t tx_empty_ie
Definition mcp2517fd.h:1109
uint32_t tx_attempts
Definition mcp2517fd.h:1119
uint32_t tx_request
Definition mcp2517fd.h:1115
uint32_t tx_enable
Definition mcp2517fd.h:1113
uint32_t freset
Definition mcp2517fd.h:1116
uint32_t unimplemented3
Definition mcp2517fd.h:1112
MCP2517FD Click Transmit Queue Status Register.
Definition mcp2517fd.h:1628
uint32_t fifo_index
Definition mcp2517fd.h:1638
uint32_t tx_not_full_if
Definition mcp2517fd.h:1630
uint32_t tx_error
Definition mcp2517fd.h:1635
uint32_t word
Definition mcp2517fd.h:1641
uint32_t unimplemented1
Definition mcp2517fd.h:1631
uint32_t tx_attempt_if
Definition mcp2517fd.h:1634
uint32_t tx_empty_if
Definition mcp2517fd.h:1632
uint32_t unimplemented2
Definition mcp2517fd.h:1633
uint32_t tx_lost_arbitration
Definition mcp2517fd.h:1636
uint32_t unimplemented3
Definition mcp2517fd.h:1639
uint32_t tx_aborted
Definition mcp2517fd.h:1637