CANpie FD
CAN programming interface environment - Version 3.04
Migration from CANpie to CANpie FD

Configuration of bit-rate

The function for bit-rate setup CpCoreBaudrate() has been renamed to CpCoreBitrate(), the new function has an additional parameter for configuration of the data bit-rate. The following code example shows the difference between the two API versions for a bit-rate setting of 500 kBit/s.

//-----------------------------------------------------
// CANpie configuration of bit-rate
//
CpCoreBaudrate(&tsCanPortG, CP_BAUD_500K);
//-----------------------------------------------------
// CANpie FD configuration of bit-rate
//

Configuration of message buffer

The functions CpCoreBufferInit() and CpCoreBufferAccMask() have been removed, the function CpCoreBufferConfig() is the replacement.

Configuration for message transmission

The following example code depicts the difference for initialization of a transmit message buffer between CANpie and CANpie FD. New new API does not require a CAN message structure CpCanMsg_ts any more.

//-----------------------------------------------------
// CANpie configuration
//
CpCanMsg_ts tsCanMsgT; // CAN message structure
CpCoreBufferRelease(&tsCanPortG, CP_BUFFER_2);
CpMsgClear(&tsCanMsgT);
CpMsgSetStdId(&tsCanMsgT, (uint16_t) 0x123);
CpMsgSetDlc(&tsCanMsgT, 8);
CpCoreBufferInit(&tsCanPortG, &tsCanMsgT, CP_BUFFER_2, CP_BUFFER_DIR_TX);
//-----------------------------------------------------
// CANpie FD configuration
//
(uint32_t) 0x123, CP_MASK_STD_FRAME,
CpCoreBufferSetDlc( &tsCanPortG, eCP_BUFFER_2, 8);

Configuration for message reception

The following example code depicts the difference for initialization of a receive message buffer between CANpie and CANpie FD. New new API does not require a CAN message structure CpCanMsg_ts any more.

//-----------------------------------------------------
// CANpie configuration
// accept identifier in the range from 700h .. 77Fh
//
CpCanMsg_ts tsCanMsgT; // CAN message structure
CpMsgClear(&tsCanMsgT);
CpMsgSetStdId(&tsCanMsgT, 0x700 );
CpMsgSetDlc(&tsCanMsgT, 1);
CpCoreBufferInit( &tsCanPortG, &tsCanMsgT,
CP_BUFFER_4, CP_BUFFER_DIR_RX);
CpCoreBufferAccMask(&tsCanPortG, CP_BUFFER_4, 0x780);
//-----------------------------------------------------
// CANpie FD configuration
// accept identifier in the range from 700h .. 77Fh
//
CpCoreBufferConfig( &tsCanPortG, eCP_BUFFER_4,
(uint32_t) 0x700, // identifier
(uint32_t) 0x780, // mask
CP_MSG_FORMAT_CBFF, // format