Bar Logo 3.8/7.6 kw Totem pole Demonstration Application (Part-No. (not specified))
 
Content
     
Loading...
Searching...
No Matches
can1.c
Go to the documentation of this file.
1
17/*
18© [2024] Microchip Technology Inc. and its subsidiaries.
19
20 Subject to your compliance with these terms, you may use Microchip
21 software and any derivatives exclusively with Microchip products.
22 You are responsible for complying with 3rd party license terms
23 applicable to your use of 3rd party software (including open source
24 software) that may accompany Microchip software. SOFTWARE IS ?AS IS.?
25 NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS
26 SOFTWARE, INCLUDING ANY IMPLIED WARRANTIES OF NON-INFRINGEMENT,
27 MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
28 WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
29 INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY
30 KIND WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF
31 MICROCHIP HAS BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE
32 FORESEEABLE. TO THE FULLEST EXTENT ALLOWED BY LAW, MICROCHIP?S
33 TOTAL LIABILITY ON ALL CLAIMS RELATED TO THE SOFTWARE WILL NOT
34 EXCEED AMOUNT OF FEES, IF ANY, YOU PAID DIRECTLY TO MICROCHIP FOR
35 THIS SOFTWARE.
36*/
37
38// Section: Included Files
39
40#include <string.h>
41#include "../can_types.h"
42#include "../can1.h"
43#include "../../sources_common/Totempole_Application_Setup.h"
44
45// CAN Bus FIFO Memory information
46#define CAN1_FIFO_ALLOCATE_RAM_SIZE 144U // CAN FIFO allocated ram size based on (number of FIFO x FIFO message Payload size x Message object DLC size)
47
48// CAN Bus receive FIFO Memory information
49#define CAN1_NUM_OF_RX_FIFO 1U // No of RX FIFO's configured
50#define CAN1_RX_FIFO_MSG_DATA 64U // CAN RX FIFO Message object data field size
51#define CAN_RX_FIFO_WORD_0 0
52#define CAN_RX_FIFO_WORD_1 1
53#define CAN_RX_FIFO_WORD_2 2
54#define CAN_RX_FIFO_WORD_4 4
55
56// CAN Bus Transmit FIFO Memory information
57#define CAN1_TX_MSG_SEND_REQ_BIT_POS 0x200U // CAN FIFO TX Message Send Request bit
58#define CAN1_TX_INC_FIFO_PTR_BIT_POS 0x100U // CAN FIFO Increment Head/Tail bit
59#define CAN_TX_FIFO_WORD_0 0
60#define CAN_TX_FIFO_WORD_1 1
61#define CAN_TX_FIFO_WORD_2 2
62#define CAN_TX_FIFO_WORD_4 4
63
64// CAN Message object arbitration field information
65#define CAN_MSG_OBJ_DLC_FIELD_SIZE 0xFU
66#define CAN_MSG_OBJ_ID_TYPE_FIELD_POS 0x10U
67#define CAN_MSG_OBJ_ID_TYPE_SHIFT_POS 0x4U
68#define CAN_MSG_OBJ_RTR_SHIFT_POS 0x5U
69#define CAN_MSG_OBJ_RTR_FIELD_POS 0x20U
70#define CAN_MSG_OBJ_FRAME_TYPE_FIELD_POS 0x20U
71#define CAN_MSG_OBJ_FRAME_TYPE_SHIFT_POS 0x5U
72#define CAN_MSG_OBJ_BRS_FIELD_POS 0x40U
73#define CAN_MSG_OBJ_BRS_SHIFT_POS 0x6U
74#define CAN_MSG_OBJ_FORMAT_TYPE_FIELD_POS 0x80U
75#define CAN_MSG_OBJ_FORMAT_TYPE_SHIFT_POS 0x7U
76#define CAN_STD_MSG_ID_MAX_SIZE 0x7FFU
77#define CAN_MSG_OBJ_SID_SHIFT_POS 0x12U
78#define CAN_EXT_MSG_ID_HIGH_MAX_SIZE 0x1FFFU
79#define CAN_EXT_MSG_ID_LOW_MAX_SIZE 0x1FU
80#define CAN_MSG_OBJ_EID_LOW_SHIFT_POS 0xBU
81#define CAN_MSG_OBJ_EID_HIGH_SHIFT_POS 0x5U
82
83// Section: Driver Interface
84const struct CAN_INTERFACE CAN_FD1 = {
86 .Deinitialize = CAN1_Deinitialize,
87 .OperationModeSet = CAN1_OperationModeSet,
88 .OperationModeGet = CAN1_OperationModeGet,
89 .IsBusOff = CAN1_IsBusOff,
90 .SleepMode = CAN1_Sleep,
91 .Transmit = CAN1_Transmit,
92 .TransmitFIFOStatusGet = CAN1_TransmitFIFOStatusGet,
93 .IsTxErrorActive = CAN1_IsTxErrorActive,
94 .IsTxErrorPassive = CAN1_IsTxErrorPassive,
95 .IsTxErrorWarning = CAN1_IsTxErrorWarning,
96 .Receive = CAN1_Receive,
97 .ReceiveMessageGet = CAN1_ReceiveMessageGet,
98 .IsRxErrorPassive = CAN1_IsRxErrorPassive,
99 .IsRxErrorWarning = CAN1_IsRxErrorWarning,
100 .IsRxErrorActive = CAN1_IsRxErrorActive,
101 .ReceivedMessageCountGet = CAN1_ReceivedMessageCountGet,
102 .RX_FIFO_StatusGet = CAN1_RX_FIFO_StatusGet,
103 .InvalidMessageCallbackRegister = &CAN1_InvalidMessageCallbackRegister,
104 .BusWakeUpActivityCallbackRegister = &CAN1_BusWakeUpActivityCallbackRegister,
105 .BusErrorCallbackRegister = &CAN1_BusErrorCallbackRegister,
106 .ModeChangeCallbackRegister = &CAN1_ModeChangeCallbackRegister,
107 .SystemErrorCallbackRegister = &CAN1_SystemErrorCallbackRegister,
108 .TxAttemptCallbackRegister = &CAN1_TxAttemptCallbackRegister,
109 .RxBufferOverFlowCallbackRegister = &CAN1_RxBufferOverFlowCallbackRegister,
110 .Tasks = CAN1_Tasks
111};
112
113// Section: Private Variable Definitions
114// Start CAN Message Memory Base Address
115static uint8_t __attribute__((aligned(4)))can1FifoMsg[CAN1_FIFO_ALLOCATE_RAM_SIZE];
116
117// CAN Default Callback Handler
118static void (*CAN1_InvalidMessageHandler)(void) = NULL;
119static void (*CAN1_BusWakeUpActivityHandler)(void) = NULL;
120static void (*CAN1_BusErrorHandler)(void) = NULL;
121static void (*CAN1_ModeChangeHandler)(void) = NULL;
122static void (*CAN1_SystemErrorHandler)(void) = NULL;
123static void (*CAN1_TxAttemptHandler)(void) = NULL;
124static void (*CAN1_RxBufferOverFlowHandler)(void) = NULL;
125
126// CAN Receive FIFO Message object data field
128
140
142{
143 // Receive FIFO, FIFO head count
144 {CAN1_FIFO_1, 0U},
145};
146
153{
154 uint8_t payloadSize;
155 uint8_t msgDeepSize;
156 uint16_t *address;
157};
158
159// Section: Private Function Definitions
160
166static uint8_t CAN1_DlcToDataBytesGet(const enum CAN_DLC dlc)
167{
168 static const uint8_t dlcByteSize[] = {0U, 1U, 2U, 3U, 4U, 5U, 6U, 7U, 8U, 12U, 16U, 20U, 24U, 32U, 48U, 64U};
169 return dlcByteSize[dlc];
170}
171
179static void CAN1_FIFO_InfoGet(const uint8_t fifoNum, volatile struct CAN1_FIFO_INFO *fifoInfo)
180{
181 switch (fifoNum)
182 {
183 case CAN1_TXQ:
184 fifoInfo->address = (uint16_t *) &C1TXQUAL;
185 fifoInfo->payloadSize = 64U;
186 fifoInfo->msgDeepSize = 1U;
187 break;
188
189 case CAN1_FIFO_1:
190 fifoInfo->address = (uint16_t *) &C1FIFOUA1L;
191 fifoInfo->payloadSize = 64U;
192 fifoInfo->msgDeepSize = 1U;
193 break;
194
195 default:
196 fifoInfo->address = NULL;
197 fifoInfo->payloadSize = 0U;
198 fifoInfo->msgDeepSize = 0U;
199 break;
200 }
201}
202
208static void CAN1_RX_FIFO_ResetInfo(void)
209{
210 uint8_t count;
211
212 for(count = 0; count < CAN1_NUM_OF_RX_FIFO; count++)
213 {
214 rxFIFOMsg[count].headCount = 0;
215 }
216}
217
223static uint8_t CAN1_RxFifoSearch(uint8_t fifoNum)
224{
225
226 uint8_t rxFifoIndex;
227
228 // If the last entry in the array holds the value
229 if ((uint8_t)rxFIFOMsg[CAN1_NUM_OF_RX_FIFO - (uint8_t)1].channel == fifoNum)
230 {
231 rxFifoIndex = CAN1_NUM_OF_RX_FIFO - (uint8_t)1;
232 }
233 else
234 {
235 for (rxFifoIndex = 0; (uint8_t)rxFIFOMsg[rxFifoIndex].channel != fifoNum; rxFifoIndex++)
236 {
237
238 }
239 }
240
241 return rxFifoIndex;
242}
243
250{
251 switch (fifoNum)
252 {
253 case CAN1_FIFO_1:
254 C1FIFOSTA1bits.RXOVIF = false;
255 break;
256
257 default:
258 break;
259 }
260}
261
267static void CAN1_RX_FIFO_IncrementMsgPtr(const uint8_t fifoNum)
268{
269 switch (fifoNum)
270 {
271 case CAN1_FIFO_1:
272 C1FIFOCON1Lbits.UINC = 1; // Update the CAN1_FIFO_1 message pointer.
273 break;
274
275 default:
276 break;
277 }
278}
279
285static uint16_t CAN1_RX_FIFO_MessageIndexGet(const enum CAN1_RX_FIFO_CHANNELS fifoNum)
286{
287 uint16_t fifoMsgIndex;
288
289 switch (fifoNum)
290 {
291 case CAN1_FIFO_1:
292 fifoMsgIndex = C1FIFOSTA1bits.FIFOCI;
293 break;
294
295 default:
296 fifoMsgIndex = 0;
297 break;
298 }
299
300 return fifoMsgIndex;
301}
302
309{
310 switch (fifoChannel)
311 {
312 case CAN1_TXQ:
313 // Update the CAN1_TXQ message pointer; Set TXREQ bit
315 break;
316
317 default:
318 break;
319 }
320}
321
329static void CAN1_MessageReadFromFifo(uint16_t *rxFifoObj, struct CAN_MSG_OBJ *rxCanMsg)
330{
331 /*
332 Receive FIFO Object format:
333
334 Receive FIFO WORD_0: |15:8|| EID<4:0> | SID<10:8> ||
335 | 7:0|| SID<7:0> ||
336
337 Receive FIFO WORD_1: |15:8|| SID<11> | EID<17:13> ||
338 | 7:0|| EID<12:5> ||
339
340 Receive FIFO WORD_2: |15:8||FILHIT<4:0> | Reserved | ESI<1> ||
341 | 7:0||FDF<1> | BRS<1> | RTR<1> | IDE<1> | DLC<3:0>||
342
343 Receive FIFO WORD_3: |15:8|| Reserved ||
344 | 7:0|| Reserved ||
345
346 Receive FIFO WORD_4 to |15:8|| Receive Data Byte 1,3,5.. n ||
347 Receive FIFO WORD_n: | 7:0|| Receive Data Byte 0,2,4.. n-1 ||
348 When timestamp is disabled
349 */
350
351 uint8_t dlcByteSize = 0;
352
353 // SID <10:0> and EID <4:0>
354 uint16_t rx0Data = rxFifoObj[CAN_RX_FIFO_WORD_0];
355
356 // SID11 and EID <17:5>
357 uint16_t rx1Data = rxFifoObj[CAN_RX_FIFO_WORD_1];
358
359 // DLC <3:0>, IDE <1>, RTR <1>, BRS <1>, FDF <1>
360 rxCanMsg->field.dlc = (rxFifoObj[CAN_RX_FIFO_WORD_2] & CAN_MSG_OBJ_DLC_FIELD_SIZE);
365
366 /* message is standard identifier */
367 if(rxCanMsg->field.idType == (uint8_t) CAN_FRAME_STD)
368 {
369 // SID <10:0>
370 rxCanMsg->msgId = ((uint32_t)rx0Data & CAN_STD_MSG_ID_MAX_SIZE);
371 }
372 else
373 {
374 /* message is extended identifier */
375 // EID <28:18>, EID <17:0>
376 rxCanMsg->msgId = ((((uint32_t)rx0Data & CAN_STD_MSG_ID_MAX_SIZE) << CAN_MSG_OBJ_SID_SHIFT_POS) |
379 }
380
381 dlcByteSize = CAN1_DlcToDataBytesGet(rxCanMsg->field.dlc);
382
383 // Coping receive FIFO data starting memory location
384 (void)memset(rxMsgData, 0, CAN1_RX_FIFO_MSG_DATA);
385 (void)memcpy((char *) rxMsgData, (char *) (&rxFifoObj[CAN_RX_FIFO_WORD_4]), dlcByteSize);
386 rxCanMsg->data = rxMsgData;
387}
388
395static void CAN1_MessageWriteToFifo(uint16_t *txFifoObj, struct CAN_MSG_OBJ *txCanMsg)
396{
397 /*
398 Transmit FIFO Object format:
399
400 Transmit FIFO WORD_0: |15:8|| EID<4:0> | SID<10:8> ||
401 | 7:0|| SID<7:0> ||
402
403 Transmit FIFO WORD_1: |15:8|| SID<11> | EID<17:13> ||
404 | 7:0|| EID<12:5> ||
405
406 Transmit FIFO WORD_2: |15:8||Sequence<6:0>(Not implemented) | ESI<1> ||
407 | 7:0||FDF<1> | BRS<1> | RTR<1> | IDE<1> | DLC<3:0>||
408
409 Transmit FIFO WORD_3: |15:8||Sequence<22:15>(Not implemented) ||
410 | 7:0||Sequence<14:7>(Not implemented) ||
411
412 Transmit FIFO WORD_4 to |15:8|| Transmit Data Byte 1,3,5.. n ||
413 Transmit FIFO WORD_n: | 7:0|| Transmit Data Byte 0,2,4.. n-1 ||
414 */
415
416 uint8_t dlcByteSize = 0;
417
418 /* message is standard identifier */
419 if(txCanMsg->field.idType == (uint8_t) CAN_FRAME_STD)
420 {
421 // SID <10:0>
422 txFifoObj[CAN_TX_FIFO_WORD_0] = (txCanMsg->msgId & CAN_STD_MSG_ID_MAX_SIZE);
423 }
424 else
425 {
426 /* message is extended identifier */
427 // SID <10:0> and EID <4:0>
430
431 // EID <5:17>
433 }
434
435 // DLC <3:0>, IDE <1>, RTR <1>, BRS <1>, FDF <1>
436 txFifoObj[CAN_TX_FIFO_WORD_2] = (txCanMsg->field.dlc & CAN_MSG_OBJ_DLC_FIELD_SIZE) |
441
442 // Data frame message
443 if(txCanMsg->field.frameType == (uint8_t) CAN_FRAME_DATA)
444 {
445 dlcByteSize = CAN1_DlcToDataBytesGet(txCanMsg->field.dlc);
446
447 // Coping TX message object to FIFO
448 (void)memcpy((uint8_t*)(&txFifoObj[CAN_TX_FIFO_WORD_4]), txCanMsg->data, dlcByteSize);
449 }
450 // RTR frame message
451 else
452 {
454 }
455}
456
463{
464 // TXAT Unlimited attempts; PLSIZE 64; FSIZE 1; TXPRI 0;
465 C1TXQCONH = 0xE040;
466 // TXQEIE disabled; TXREQ disabled; TXQNIE disabled; TXATIE disabled; UINC disabled; FRESET enabled;
467 C1TXQCONL = 0x480;
468}
469
477{
478 // TXAT Disabled; PLSIZE 64; FSIZE 1; TXPRI 0;
479 C1FIFOCON1H = 0xE000;
480 // TFHRFHIE disabled; TFERFFIE disabled; RXTSEN disabled; TXREQ disabled; RXOVIE disabled; RTREN disabled; TXEN disabled; TXATIE disabled; UINC disabled; FRESET enabled; TFNRFNIE disabled;
481 C1FIFOCON1L = 0x400;
482}
483
490{
491 /* Configure RX FIFO Filter control settings*/
492
493 // message stored in FIFO1
494 C1FLTCON0Lbits.F0BP = 1;
495 // EID 0; SID 515;
496// C1FLTOBJ0L = 0x203; //TODO: manually removed
497 C1FLTOBJ0L = CANReceiveID; //TODO: manually added
498 // EID 0; EXIDE disabled; SID11 disabled;
499 C1FLTOBJ0H = 0x0;
500 // MSID 2047; MEID 0;
501 C1MASK0L = 0x7FF;
502 // MEID 0; MSID11 disabled; MIDE enabled;
503 C1MASK0H = 0x4000;
504 // Enable the filter 0
505 C1FLTCON0Lbits.FLTEN0 = 1;
506}
507
514{
515 // BRP 0; TSEG1 30;
516 C1NBTCFGH = 0x1E;
517 // SJW 7; TSEG2 7;
518 C1NBTCFGL = 0x707;
519 // BRP 0; TSEG1 6;
520 C1DBTCFGH = 0x6;
521 // SJW 1; TSEG2 1;
522 C1DBTCFGL = 0x101;
523 // EDGFLTEN disabled; TDCMOD Auto; SID11EN disabled;
524 C1TDCH = 0x2;
525 // TDCV 0x0; TDCO 7;
526 C1TDCL = 0x700;
527}
528
545
546// Section: Driver Interface Function Definitions
548{
549 /* Enable the CAN1 module */
550 C1CONLbits.CON = 1;
551
552 // RTXAT disabled; ESIGM disabled; TXBWS No delay; STEF disabled; SERRLOM disabled; ABAT disabled; REQOP Configuration mode; TXQEN enabled;
553 C1CONH = 0x490;
554
555 /* Place CAN1 module in configuration mode */
557 {
558 /* Initialize the C1FIFOBAL with the start address of the CAN1 FIFO message object area. */
559 C1FIFOBAL = (uint16_t) &can1FifoMsg[0];
560
561 // BRSDIS disabled; CON enabled; WAKFIL enabled; WFT T11 Filter; ISOCRCEN enabled; SIDL disabled; DNCNT 0x0; PXEDIS enabled; CLKSEL disabled;
562 C1CONL = 0x8760;
563
564 // Disabled CAN1 Store in Transmit Event FIFO bit
565 C1CONHbits.STEF = 0;
566 // Enabled CAN1 Transmit Queue bit
567 C1CONHbits.TXQEN = 1;
568
569 /* configure CAN1 Bit rate settings */
571
572 /* configure CAN1 FIFO settings */
575
576 /* Configure Receive FIFO Filter and Mask settings */
578
579 /* CAN Error Notification */
581
582 // Reset the CAN1 receive FIFO head count
584
585 /* Place CAN1 module in Normal Operation mode */
587 }
588}
589
591{
592 /* Place CAN1 module in configuration mode */
594 {
595 C1CONL = 0x760;
596 C1CONH = 0x498;
597
598 /* Reset bit rate settings to POR*/
599 C1NBTCFGH = 0x3E;
600 C1NBTCFGL = 0xF0F;
601 C1DBTCFGH = 0xE;
602 C1DBTCFGL = 0x303;
603 C1TDCH = 0x2;
604 C1TDCL = 0x1000;
605
606 /* configure CAN1 FIFO settings */
607 /* Reset TX FIFO settings to POR*/
608 C1TXQCONH = 0x60;
609 C1TXQCONL = 0x480;
610
611 /* Reset RX FIFO settings to POR*/
612 C1FIFOCON1H = 0x60;
613 C1FIFOCON1L = 0x400;
614
615 /* Reset RX FIFO Filter control settings to POR*/
616 C1FLTCON0Lbits.F0BP = 0x0;
617 C1FLTOBJ0L = 0x0;
618 C1FLTOBJ0H = 0x0;
619 C1MASK0L = 0x0;
620 C1MASK0H = 0x0;
621 C1FLTCON0Lbits.FLTEN0 = 0x0;
622
623 }
624
625 /* Disable the CAN1 module */
626 C1CONLbits.CON = 0;
627}
628
630{
632
634 || (requestMode == CAN_CONFIGURATION_MODE))
635 {
636 C1CONHbits.REQOP = requestMode;
637
638 while(C1CONHbits.OPMOD != requestMode)
639 {
640 // This condition is avoiding the system error case endless loop
641 if(C1INTLbits.SERRIF == 1)
642 {
644 break;
645 }
646 }
647 }
648 else
649 {
651 }
652
653 return status;
654}
655
657{
658 return C1CONHbits.OPMOD;
659}
660
661bool CAN1_Receive(struct CAN_MSG_OBJ *rxCanMsg)
662{
663 uint8_t fifoChannel;
664 uint8_t count;
665 uint8_t rxMsgStatus;
666 volatile struct CAN1_FIFO_INFO fifoInfo;
667 bool status = false;
668
669 // Iterate all receive FIFO's and read the message object
670 for(count = 0; count < CAN1_NUM_OF_RX_FIFO; count++)
671 {
672 fifoChannel = rxFIFOMsg[count].channel;
673 CAN1_FIFO_InfoGet(fifoChannel, &fifoInfo);
674 rxMsgStatus = CAN1_RX_FIFO_StatusGet(fifoChannel);
675
676 // If message object is available
677 if((uint8_t)CAN_RX_MSG_AVAILABLE == (rxMsgStatus & (uint8_t)CAN_RX_MSG_AVAILABLE))
678 {
679 if((uint16_t *)(*(fifoInfo.address)) != NULL)
680 {
681 CAN1_MessageReadFromFifo((uint16_t *) *fifoInfo.address, rxCanMsg);
682 CAN1_RX_FIFO_IncrementMsgPtr(fifoChannel);
683
684 // Update the RX FIFO Head count for CAN1_ReceivedMessageCountGet function
685 rxFIFOMsg[count].headCount++; // Update the read one message
686 if(rxFIFOMsg[count].headCount >= fifoInfo.msgDeepSize)
687 {
688 rxFIFOMsg[count].headCount = 0; // Reset the read message count
689 }
690
691 // User have to clear manually RX Overflow status
692 if((uint8_t)CAN_RX_MSG_OVERFLOW == (rxMsgStatus & (uint8_t)CAN_RX_MSG_OVERFLOW))
693 {
695 }
696
697 status = true;
698 }
699
700 break;
701 }
702 }
703
704 return status;
705}
706
707bool CAN1_ReceiveMessageGet(const enum CAN1_RX_FIFO_CHANNELS fifoChannel, struct CAN_MSG_OBJ *rxCanMsg)
708{
709 uint8_t count;
710 uint8_t rxMsgStatus;
711 struct CAN1_FIFO_INFO fifoInfo;
712 bool status = false;
713
714 CAN1_FIFO_InfoGet(fifoChannel, &fifoInfo);
715 rxMsgStatus = CAN1_RX_FIFO_StatusGet(fifoChannel);
716 count = CAN1_RxFifoSearch(fifoChannel);
717
718 // If message object is available
719 if((uint8_t)CAN_RX_MSG_AVAILABLE == (rxMsgStatus & (uint8_t)CAN_RX_MSG_AVAILABLE))
720 {
721 if((uint16_t *)(*(fifoInfo.address)) != NULL)
722 {
723 CAN1_MessageReadFromFifo((uint16_t *) *fifoInfo.address, rxCanMsg);
724 CAN1_RX_FIFO_IncrementMsgPtr(fifoChannel);
725
726 // Update the RX FIFO Head count for CAN1_ReceivedMessageCountGet function
727 rxFIFOMsg[count].headCount++; // Update the read one message
728 if(rxFIFOMsg[count].headCount >= fifoInfo.msgDeepSize)
729 {
730 rxFIFOMsg[count].headCount = 0; // Reset the read message count
731 }
732
733 // User have to clear manually RX Overflow status
734 if((uint8_t)CAN_RX_MSG_OVERFLOW == (rxMsgStatus & (uint8_t)CAN_RX_MSG_OVERFLOW))
735 {
737 }
738
739 status = true;
740 }
741 }
742
743 return status;
744}
745
746enum CAN_TX_MSG_REQUEST_STATUS CAN1_Transmit(const enum CAN1_TX_FIFO_CHANNELS fifoChannel, struct CAN_MSG_OBJ *txCanMsg)
747{
748 volatile struct CAN1_FIFO_INFO fifoInfo;
749 CAN1_FIFO_InfoGet(fifoChannel, &fifoInfo);
751 enum CAN_OP_MODES canOpModeStatus = CAN1_OperationModeGet();
752
753 // If CAN module is configured in Non-BRS mode and TX message object has BRS set
754 if((txCanMsg->field.brs == (bool) 1) && (C1CONLbits.BRSDIS == (bool) 1 || (CAN_NORMAL_2_0_MODE == canOpModeStatus)))
755 {
756 txMsgStatus |= CAN_TX_MSG_REQUEST_BRS_ERROR;
757 }
758
759 // If CAN 2.0 mode, Tx Message object has more than 8 bytes of DLC Size
760 if((CAN_NORMAL_2_0_MODE == canOpModeStatus) || (txCanMsg->field.formatType == (uint8_t) CAN_2_0_FORMAT))
761 {
762 // CAN 2.0 mode DLC supports upto 8 byte
763 if(txCanMsg->field.dlc > (uint8_t) DLC_8)
764 {
766 }
767 }
768
769 // If any CAN TX message object has DLC size more than CAN TX FIFO Payload size
770 if(CAN1_DlcToDataBytesGet(txCanMsg->field.dlc) > fifoInfo.payloadSize)
771 {
773 }
774
775 if(CAN_TX_MSG_REQUEST_SUCCESS == txMsgStatus)
776 {
778 {
779 if((uint16_t *)(*(fifoInfo.address)) != NULL)
780 {
781 CAN1_MessageWriteToFifo((uint16_t *) *fifoInfo.address, txCanMsg);
783 }
784 }
785 else
786 {
787 txMsgStatus |= CAN_TX_MSG_REQUEST_FIFO_FULL;
788 }
789 }
790
791 return txMsgStatus;
792}
793
795{
796 enum CAN_TX_FIFO_STATUS fifoStatus;
797
798 switch (fifoChannel)
799 {
800 case CAN1_TXQ:
801 fifoStatus = ((C1TXQSTA & 0x1) ? CAN_TX_FIFO_AVAILABLE:CAN_TX_FIFO_FULL);
802 break;
803
804 default:
805 fifoStatus = CAN_TX_FIFO_FULL;
806 break;
807 }
808
809 return fifoStatus;
810}
811
813{
814 uint8_t fifoChannel = 0;
815 uint8_t count = 0;
816 uint8_t numOfMsg = 0;
817 uint8_t totalMsgObj = 0;
818 uint8_t rxMsgStatus;
819 struct CAN1_FIFO_INFO fifoInfo;
820 uint16_t rxfifoMsgTail;
821
822 // Iterate all receive FIFO's and get the message object count
823 for(count = 0; count < CAN1_NUM_OF_RX_FIFO; count++)
824 {
825 fifoChannel = rxFIFOMsg[count].channel;
826 CAN1_FIFO_InfoGet(fifoChannel, &fifoInfo);
827 rxMsgStatus = CAN1_RX_FIFO_StatusGet(fifoChannel);
828
829 // If message object is available
830 if((uint8_t)CAN_RX_MSG_AVAILABLE == (rxMsgStatus & (uint8_t)CAN_RX_MSG_AVAILABLE))
831 {
832 // If receive FIFO overflow has occurred, FIFO is full
833 if((uint8_t)CAN_RX_MSG_OVERFLOW == (rxMsgStatus & (uint8_t)CAN_RX_MSG_OVERFLOW))
834 {
835 numOfMsg = fifoInfo.msgDeepSize;
836 }
837 else
838 {
839 rxfifoMsgTail = CAN1_RX_FIFO_MessageIndexGet(fifoChannel);
840
841 if(rxfifoMsgTail < rxFIFOMsg[count].headCount)
842 {
843 numOfMsg = ((rxfifoMsgTail + fifoInfo.msgDeepSize) - rxFIFOMsg[count].headCount);
844 }
845 else if(rxfifoMsgTail > rxFIFOMsg[count].headCount)
846 {
847 numOfMsg = rxfifoMsgTail - rxFIFOMsg[count].headCount;
848 }
849 else
850 {
851 numOfMsg = fifoInfo.msgDeepSize;
852 }
853 }
854
855 totalMsgObj += numOfMsg;
856 }
857 }
858
859 return totalMsgObj;
860}
861
863{
864 uint8_t rxFifoStatus;
865
866 switch (fifoNum)
867 {
868 case CAN1_FIFO_1:
869 rxFifoStatus = (uint8_t)(C1FIFOSTA1 & (CAN_RX_MSG_AVAILABLE | CAN_RX_MSG_OVERFLOW));
870 break;
871
872 default:
873 rxFifoStatus = (uint8_t)CAN_RX_MSG_NOT_AVAILABLE;
874 break;
875 }
876
877 return rxFifoStatus;
878}
879
881{
882 return C1TRECHbits.TXBO;
883}
884
886{
887 return C1TRECHbits.RXBP;
888}
889
891{
892 return C1TRECHbits.RXWARN;
893}
894
896{
897 bool errorState = false;
898 if((0 < C1TRECLbits.RERRCNT) && (C1TRECLbits.RERRCNT < 128))
899 {
900 errorState = true;
901 }
902
903 return errorState;
904}
905
907{
908 return C1TRECHbits.TXBP;
909}
910
912{
913 return C1TRECHbits.TXWARN;
914}
915
917{
918 bool errorState = false;
919 if((0 < C1TRECLbits.TERRCNT) && (C1TRECLbits.TERRCNT < 128))
920 {
921 errorState = true;
922 }
923
924 return errorState;
925}
926
927void CAN1_Sleep(void)
928{
929 C1INTLbits.WAKIF = 0;
930 C1INTHbits.WAKIE = 1;
931
932 // CAN Info Interrupt Enable bit
933 IEC1bits.C1IE = 1;
934
935 /* put the module in disable mode */
937}
938
939void CAN1_InvalidMessageCallbackRegister(void (*handler)(void))
940{
941 if(NULL != handler)
942 {
944 }
945}
946
947void __attribute__ ((weak)) CAN1_InvalidMessageCallback ( void )
948{
949
950}
951
952void CAN1_BusWakeUpActivityCallbackRegister(void (*handler)(void))
953{
954 if(NULL != handler)
955 {
957 }
958}
959
960void __attribute__ ((weak)) CAN1_BusWakeUpActivityCallback ( void )
961{
962
963}
964
965void CAN1_BusErrorCallbackRegister(void (*handler)(void))
966{
967 if(NULL != handler)
968 {
969 CAN1_BusErrorHandler = handler;
970 }
971}
972
973void __attribute__ ((weak)) CAN1_BusErrorCallback ( void )
974{
975
976}
977
978void CAN1_ModeChangeCallbackRegister(void (*handler)(void))
979{
980 if(NULL != handler)
981 {
982 CAN1_ModeChangeHandler = handler;
983 }
984}
985
986void __attribute__ ((weak)) CAN1_ModeChangeCallback ( void )
987{
988
989}
990
991void CAN1_SystemErrorCallbackRegister(void (*handler)(void))
992{
993 if(NULL != handler)
994 {
995 CAN1_SystemErrorHandler = handler;
996 }
997}
998
999void __attribute__ ((weak)) CAN1_SystemErrorCallback ( void )
1000{
1001
1002}
1003
1004void CAN1_TxAttemptCallbackRegister(void (*handler)(void))
1005{
1006 if(NULL != handler)
1007 {
1008 CAN1_TxAttemptHandler = handler;
1009 }
1010}
1011
1012void __attribute__ ((weak)) CAN1_TxAttemptCallback(void)
1013{
1014
1015}
1016
1017void CAN1_RxBufferOverFlowCallbackRegister(void (*handler)(void))
1018{
1019 if(NULL != handler)
1020 {
1022 }
1023}
1024
1025void __attribute__ ((weak)) CAN1_RxBufferOverFlowCallback(void)
1026{
1027
1028}
1029
1030void __attribute__((__interrupt__, no_auto_psv)) _C1Interrupt(void)
1031{
1032 // Bus Wake-up Activity Interrupt
1033 if(1 == C1INTLbits.WAKIF)
1034 {
1036 {
1038 }
1039
1040 C1INTLbits.WAKIF = 0;
1041 }
1042
1043 IFS1bits.C1IF = 0;
1044}
1045
1046void CAN1_Tasks(void)
1047{
1048 if(1 == C1INTLbits.IVMIF)
1049 {
1050 if(CAN1_InvalidMessageHandler != NULL)
1051 {
1053 }
1054
1055 C1INTLbits.IVMIF = 0;
1056 }
1057
1058 if(1 == C1INTLbits.CERRIF)
1059 {
1060 if(CAN1_BusErrorHandler != NULL)
1061 {
1063 }
1064
1065 C1INTLbits.CERRIF = 0;
1066 }
1067
1068 if(1 == C1INTLbits.MODIF)
1069 {
1070 if(CAN1_ModeChangeHandler != NULL)
1071 {
1073 }
1074
1075 C1INTLbits.MODIF = 0;
1076 }
1077
1078 if(1 == C1INTLbits.SERRIF)
1079 {
1080 if(CAN1_SystemErrorHandler != NULL)
1081 {
1083 }
1084
1085 C1INTLbits.SERRIF = 0;
1086 }
1087
1088 if(1 == C1INTLbits.TXATIF)
1089 {
1090 if(CAN1_TxAttemptHandler != NULL)
1091 {
1093 }
1094 }
1095
1096 if(1 == C1FIFOSTA1bits.RXOVIF)
1097 {
1099 {
1101 }
1102
1103 C1FIFOSTA1bits.RXOVIF = 0;
1104 }
1105
1106}
1107
This is the generated driver header file for the CAN1 driver using CCL.
@ CAN1_TXQ
Definition can1.h:212
@ CAN1_FIFO_1
Definition can1.h:222
This is the generated driver types header file for the CAN driver using CCL.
@ CAN_RX_MSG_OVERFLOW
Definition can_types.h:209
@ CAN_RX_MSG_NOT_AVAILABLE
Definition can_types.h:207
@ CAN_RX_MSG_AVAILABLE
Definition can_types.h:208
@ DLC_8
Definition can_types.h:187
@ CAN_FRAME_STD
Definition can_types.h:92
@ CAN_FRAME_DATA
Definition can_types.h:103
@ CAN_TX_FIFO_AVAILABLE
Definition can_types.h:168
@ CAN_TX_FIFO_FULL
Definition can_types.h:167
@ CAN_2_0_FORMAT
Definition can_types.h:114
@ CAN_OP_MODE_SYS_ERROR_OCCURED
Definition can_types.h:157
@ CAN_OP_MODE_REQUEST_FAIL
Definition can_types.h:156
@ CAN_OP_MODE_REQUEST_SUCCESS
Definition can_types.h:155
@ CAN_TX_MSG_REQUEST_BRS_ERROR
Definition can_types.h:127
@ CAN_TX_MSG_REQUEST_SUCCESS
Definition can_types.h:125
@ CAN_TX_MSG_REQUEST_DLC_EXCEED_ERROR
Definition can_types.h:126
@ CAN_TX_MSG_REQUEST_FIFO_FULL
Definition can_types.h:128
@ CAN_DISABLE_MODE
Definition can_types.h:139
@ CAN_NORMAL_FD_MODE
Definition can_types.h:138
@ CAN_NORMAL_2_0_MODE
Definition can_types.h:144
@ CAN_CONFIGURATION_MODE
Definition can_types.h:142
#define CAN_RX_FIFO_WORD_1
Definition can1.c:52
#define CAN_MSG_OBJ_EID_LOW_SHIFT_POS
Definition can1.c:80
static void(* CAN1_RxBufferOverFlowHandler)(void)
Definition can1.c:124
#define CAN_MSG_OBJ_FORMAT_TYPE_SHIFT_POS
Definition can1.c:75
#define CAN1_RX_FIFO_MSG_DATA
Definition can1.c:50
#define CAN_MSG_OBJ_BRS_SHIFT_POS
Definition can1.c:73
#define CAN_MSG_OBJ_RTR_FIELD_POS
Definition can1.c:69
#define CAN_MSG_OBJ_FORMAT_TYPE_FIELD_POS
Definition can1.c:74
#define CAN_TX_FIFO_WORD_1
Definition can1.c:60
static uint8_t can1FifoMsg[CAN1_FIFO_ALLOCATE_RAM_SIZE]
Definition can1.c:115
#define CAN1_FIFO_ALLOCATE_RAM_SIZE
Definition can1.c:46
static void(* CAN1_SystemErrorHandler)(void)
Definition can1.c:122
#define CAN_TX_FIFO_WORD_4
Definition can1.c:62
static void(* CAN1_ModeChangeHandler)(void)
Definition can1.c:121
#define CAN_MSG_OBJ_ID_TYPE_FIELD_POS
Definition can1.c:66
#define CAN_STD_MSG_ID_MAX_SIZE
Definition can1.c:76
void _C1Interrupt(void)
Definition can1.c:1030
#define CAN_RX_FIFO_WORD_2
Definition can1.c:53
#define CAN_MSG_OBJ_FRAME_TYPE_SHIFT_POS
Definition can1.c:71
static volatile struct CAN1_RX_FIFO_MSG rxFIFOMsg[CAN1_NUM_OF_RX_FIFO]
Definition can1.c:141
#define CAN_TX_FIFO_WORD_0
Definition can1.c:59
#define CAN1_TX_MSG_SEND_REQ_BIT_POS
Definition can1.c:57
static void(* CAN1_InvalidMessageHandler)(void)
Definition can1.c:118
#define CAN_EXT_MSG_ID_LOW_MAX_SIZE
Definition can1.c:79
#define CAN_MSG_OBJ_DLC_FIELD_SIZE
Definition can1.c:65
#define CAN_MSG_OBJ_BRS_FIELD_POS
Definition can1.c:72
#define CAN1_TX_INC_FIFO_PTR_BIT_POS
Definition can1.c:58
static uint8_t rxMsgData[CAN1_RX_FIFO_MSG_DATA]
Definition can1.c:127
#define CAN_MSG_OBJ_FRAME_TYPE_FIELD_POS
Definition can1.c:70
#define CAN_MSG_OBJ_EID_HIGH_SHIFT_POS
Definition can1.c:81
#define CAN1_NUM_OF_RX_FIFO
Definition can1.c:49
#define CAN_RX_FIFO_WORD_0
Definition can1.c:51
#define CAN_EXT_MSG_ID_HIGH_MAX_SIZE
Definition can1.c:78
#define CAN_RX_FIFO_WORD_4
Definition can1.c:54
#define CAN_MSG_OBJ_RTR_SHIFT_POS
Definition can1.c:68
static void(* CAN1_BusWakeUpActivityHandler)(void)
Definition can1.c:119
#define CAN_MSG_OBJ_SID_SHIFT_POS
Definition can1.c:77
static void(* CAN1_TxAttemptHandler)(void)
Definition can1.c:123
#define CAN_MSG_OBJ_ID_TYPE_SHIFT_POS
Definition can1.c:67
static void(* CAN1_BusErrorHandler)(void)
Definition can1.c:120
#define CAN_TX_FIFO_WORD_2
Definition can1.c:61
size_t status
Definition uart1.c:99
static void CAN1_MessageWriteToFifo(uint16_t *txFifoObj, struct CAN_MSG_OBJ *txCanMsg)
This function Read the message object from user input and update to the CAN1 TX FIFO.
Definition can1.c:395
static void CAN1_RX_FIFO_IncrementMsgPtr(const uint8_t fifoNum)
This function Update the receive FIFO message increment tail position.
Definition can1.c:267
void CAN1_ModeChangeCallbackRegister(void(*handler)(void))
This function can be used to override default callback and to define custom callback for CAN1_ModeCha...
Definition can1.c:978
void CAN1_RxBufferOverFlowCallbackRegister(void(*handler)(void))
This function can be used to override default callback and to define custom callback for CAN1_RxBuffe...
Definition can1.c:1017
enum CAN_TX_FIFO_STATUS CAN1_TransmitFIFOStatusGet(const enum CAN1_TX_FIFO_CHANNELS fifoChannel)
Returns the CAN1 transmitter FIFO status.
Definition can1.c:794
static void CAN1_RX_FIFO_OverflowStatusFlagClear(const enum CAN1_RX_FIFO_CHANNELS fifoNum)
This function is used to clear the CAN1 receive FIFO overflow status bit.
Definition can1.c:249
static void CAN1_RX_FIFO_ResetInfo(void)
This function reset the CAN1 receive message head count.
Definition can1.c:208
CAN_DLC
Defines the CAN message payload size that are available for the mode to use.
Definition can_types.h:177
bool CAN1_ReceiveMessageGet(const enum CAN1_RX_FIFO_CHANNELS fifoChannel, struct CAN_MSG_OBJ *rxCanMsg)
Reads the received single message object from the CAN1 receive FIFO.
Definition can1.c:707
bool CAN1_IsTxErrorActive(void)
Returns the transmit error active state.
Definition can1.c:916
bool CAN1_IsRxErrorWarning(void)
Returns the receive error warning state. If Receiver error counter is above 95 to below 128,...
Definition can1.c:890
void CAN1_TxAttemptCallback(void)
This is the default callback with weak attribute. The user can override and implement the default cal...
Definition can1.c:1012
const struct CAN_INTERFACE CAN_FD1
Structure object of type CAN_INTERFACE with the custom name given by the user in the Melody Driver Us...
Definition can1.c:84
void CAN1_Sleep(void)
Sets the CAN node in sleep mode.
Definition can1.c:927
uint8_t CAN1_RX_FIFO_StatusGet(const enum CAN1_RX_FIFO_CHANNELS fifoNum)
This returns the CAN1 receive FIFO status.
Definition can1.c:862
bool CAN1_Receive(struct CAN_MSG_OBJ *rxCanMsg)
Reads the received single message object.
Definition can1.c:661
static uint16_t CAN1_RX_FIFO_MessageIndexGet(const enum CAN1_RX_FIFO_CHANNELS fifoNum)
This function get the Receiver FIFO message index value.
Definition can1.c:285
void CAN1_BusErrorCallbackRegister(void(*handler)(void))
This function can be used to override default callback and to define custom callback for CAN1_BusErro...
Definition can1.c:965
static void CAN1_FIFO_InfoGet(const uint8_t fifoNum, volatile struct CAN1_FIFO_INFO *fifoInfo)
This function get the FIFO user address, message depth and payload size information.
Definition can1.c:179
void CAN1_SystemErrorCallbackRegister(void(*handler)(void))
This function can be used to override default callback and to define custom callback for CAN1_SystemE...
Definition can1.c:991
CAN_TX_FIFO_STATUS
Defines the CAN transmit status get Api return status.
Definition can_types.h:166
static uint8_t CAN1_DlcToDataBytesGet(const enum CAN_DLC dlc)
This function get the DLC enum based decimal value.
Definition can1.c:166
void CAN1_BusWakeUpActivityCallback(void)
This is the default callback with weak attribute. The user can override and implement the default cal...
Definition can1.c:960
bool CAN1_IsRxErrorActive(void)
Returns the receive error active state.
Definition can1.c:895
static void CAN1_TX_FIFO_Configuration(void)
This function configure the CAN1 transmit FIFO settings.
Definition can1.c:462
static void CAN1_RX_FIFO_Configuration(void)
This function configure the CAN1 receive FIFO settings.
Definition can1.c:476
static void CAN1_RX_FIFO_FilterMaskConfiguration(void)
This function configure the CAN1 filter and mask settings.
Definition can1.c:489
CAN_OP_MODE_STATUS
Defines the CAN operation set Api return status.
Definition can_types.h:154
void CAN1_Tasks(void)
This routine is used to implement the tasks for polled implementations.
Definition can1.c:1046
void CAN1_SystemErrorCallback(void)
This is the default callback with weak attribute. The user can override and implement the default cal...
Definition can1.c:999
bool CAN1_IsRxErrorPassive(void)
Returns the receive error passive state.
Definition can1.c:885
void CAN1_ModeChangeCallback(void)
This is the default callback with weak attribute. The user can override and implement the default cal...
Definition can1.c:986
void CAN1_InvalidMessageCallback(void)
This is the default callback with weak attribute. The user can override and implement the default cal...
Definition can1.c:947
static uint8_t CAN1_RxFifoSearch(uint8_t fifoNum)
This function Search the CAN1 receive FIFO channel index.
Definition can1.c:223
bool CAN1_IsTxErrorWarning(void)
Returns the transmit error warning state. If Transmitter error counter is above 95 to below 128,...
Definition can1.c:911
static void CAN1_ErrorNotificationEnable(void)
This function enables the CAN1 error notification interrupt.
Definition can1.c:534
static void CAN1_MessageReadFromFifo(uint16_t *rxFifoObj, struct CAN_MSG_OBJ *rxCanMsg)
This function read the message object from receive FIFO and update to the user message object point...
Definition can1.c:329
bool CAN1_IsTxErrorPassive(void)
Returns the transmit error passive state.
Definition can1.c:906
CAN1_TX_FIFO_CHANNELS
This enumeration defines the can Transmit FIFO Configured in MCC Melody CAN user interface.
Definition can1.h:211
static void CAN1_BitRateConfiguration(void)
This function configure the CAN1 bit rate settings.
Definition can1.c:513
uint8_t CAN1_ReceivedMessageCountGet(void)
Returns the number of CAN messages received in all the FIFO.
Definition can1.c:812
CAN_TX_MSG_REQUEST_STATUS
Defines the CAN transmit Api return status.
Definition can_types.h:124
bool CAN1_IsBusOff(void)
Returns the bus off status.
Definition can1.c:880
void CAN1_BusErrorCallback(void)
This is the default callback with weak attribute. The user can override and implement the default cal...
Definition can1.c:973
void CAN1_RxBufferOverFlowCallback(void)
This is the default callback with weak attribute. The user can override and implement the default cal...
Definition can1.c:1025
enum CAN_TX_MSG_REQUEST_STATUS CAN1_Transmit(const enum CAN1_TX_FIFO_CHANNELS fifoChannel, struct CAN_MSG_OBJ *txCanMsg)
Writes the CAN message object to specified transmit FIFO channel.
Definition can1.c:746
void CAN1_Initialize(void)
Initializes CAN1 module.
Definition can1.c:547
void CAN1_InvalidMessageCallbackRegister(void(*handler)(void))
This function can be used to override default callback and to define custom callback for CAN1_Invalid...
Definition can1.c:939
CAN_OP_MODES
Defines the CAN operation modes are available for the module to use.
Definition can_types.h:137
void CAN1_BusWakeUpActivityCallbackRegister(void(*handler)(void))
This function can be used to override default callback and to define custom callback for CAN1_BusWake...
Definition can1.c:952
CAN1_RX_FIFO_CHANNELS
This enumeration defines the can receive FIFO.
Definition can1.h:221
void CAN1_Deinitialize(void)
Deinitializes CAN1 to POR values.
Definition can1.c:590
static void CAN1_TX_FIFO_MessageSendRequest(const enum CAN1_TX_FIFO_CHANNELS fifoChannel)
This function enables The FIFO transmit message send request bit.
Definition can1.c:308
enum CAN_OP_MODES CAN1_OperationModeGet(void)
Get the CAN1 operation mode.
Definition can1.c:656
void CAN1_TxAttemptCallbackRegister(void(*handler)(void))
This function can be used to override default callback and to define custom callback for CAN1_TxAttem...
Definition can1.c:1004
enum CAN_OP_MODE_STATUS CAN1_OperationModeSet(const enum CAN_OP_MODES requestMode)
Sets the CAN1 operation mode.
Definition can1.c:629
Structure containing the function pointers of CAN driver.
void(* Initialize)(void)
Pointer to CANx_Initialize e.g. CAN1_Initialize.
unsigned int frameType
Definition can_types.h:55
unsigned int formatType
Definition can_types.h:57
unsigned int dlc
Definition can_types.h:56
unsigned int idType
Definition can_types.h:54
unsigned int brs
Definition can_types.h:58
This data structure used to configure the CAN FD message object.
Definition can_types.h:68
struct CAN_MSG_FIELD field
Definition can_types.h:70
uint32_t msgId
Definition can_types.h:69
uint8_t * data
Definition can_types.h:71
enum CAN1_RX_FIFO_CHANNELS channel
Definition can1.c:137
uint8_t headCount
Definition can1.c:138
uint8_t msgDeepSize
Definition can1.c:155
uint8_t payloadSize
Definition can1.c:154
uint16_t * address
Definition can1.c:156