Pardon me.
You're right.
The PCAN-Router FD handles it's buffers in a different way.
Using the PCAN-Router the queues where defined in software as arrays whereas the PCAN Router-FD uses hardware buffers.
The difference here is that you cannot change the size of the buffers, which is 4Kilobyte for each direction.
Again, use the example "01_ROUTING" for reference (This time from the PCAN Router FD package)
https://www.peak-system.com/fileadmin/m ... ter_fd.zip
You will find can.h in the "inc" folder, it contains definitons for the buffers:
Code: Select all
////////////////////////////////////////////////////////////
//! @name buffertypes
//! Types of the different buffers.
//! @{
#define CAN_BUFFER_INVALID 0x0000 //!< invalid BUFFER, do not use
#define CAN_BUFFER_RX_MSG 0x0001 //!< receive message BUFFER
#define CAN_BUFFER_STATUS 0x0003 //!< status notification BUFFER
#define CAN_BUFFER_CRITICAL 0x0102 //!< receive cache level is critical
#define CAN_BUFFER_TX_MSG 0x1000 //!< transmit message BUFFER
/*! @}*/
/////////////////////////////////////////////////////////////
the file "can_user.c" shows how use the buffers as a parameter to implement the function "CAN_UserRead":
Code: Select all
// CAN_UserRead
// This wrapper is used to pre-process some incoming data.
CANResult_t CAN_UserRead ( CANHandle_t hBus, void *buff)
{
CANResult_t ret;
CANBuffer_t *rx_buff;
ret = CAN_ERR_RX_EMPTY;
rx_buff = buff;
...
As you can see in main.c a Txbuffer is used.
Code: Select all
// main_greeting()
// transmit a message at module start
static void main_greeting ( void)
{
CANTxMsg_t Msg;
Msg.bufftype = CAN_BUFFER_TX_MSG;
Msg.dlc = CAN_LEN8_DLC;
Msg.msgtype = CAN_MSGTYPE_STANDARD;
Msg.id = 0x123;
Msg.data32[0] = 0x67452301;
Msg.data32[1] = 0xEFCDAB89;
// Send Msg
CAN_Write ( CAN_BUS1, &Msg);
}
And a defined Rxbuffer is used to call CAN-UserRead:
Code: Select all
// main loop
while ( 1)
{
CANRxMsg_t RxMsg;
// process messages from CAN1
if ( CAN_UserRead ( CAN_BUS1, &RxMsg) == CAN_ERR_OK)
{
// message received from CAN1
LED_toggleCAN1 ^= 1;
if ( LED_toggleCAN1)
{
HW_SetLED ( HW_LED_CAN1, HW_LED_ORANGE);
}
else
{
HW_SetLED ( HW_LED_CAN1, HW_LED_GREEN);
}
// forward message to CAN2
CAN_Write ( CAN_BUS2, &RxMsg);
}
You can also take a look at the other examples contained in the PCAN-Router FD package, to see different usecases using those buffers.
Best Regards
Marvin