XMC1400 CAN driver and XMC_CAN_CANCLKSRC_FPERI

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
User21894
Level 1
Level 1
Hello, I've a project in Keil with the XMC1400 Boot Kit using the CAN driver from Infineon:
* @file CAN.c
* @date 21 Jun, 2019
* @version 1.3


In the function CAN_PowerControl() there is the initialization of the clock:
if (!global_can_initialized)
{
XMC_CAN_InitEx(can->can, XMC_CAN_CANCLKSRC_FPERI, XMC_SCU_CLOCK_GetPeripheralClockFrequency());
global_can_initialized = true;
}


But XMC_CAN_CANCLKSRC_FPERI is not defined due in the file xmc_can.h selects this only for the XMC4 family:
/**
* Defines the Clock source used for the MCAN baudrate generator
*/
typedef enum XMC_CAN_CANCLKSRC
{
#if defined(MULTICAN_PLUS) || defined(DOXYGEN)
#if (UC_FAMILY == XMC4)
XMC_CAN_CANCLKSRC_FPERI = 0x1U, /**< Use peripheral clock as MCAN baudrate generator input clock. */
#else
XMC_CAN_CANCLKSRC_MCLK = 0x1U, /**< Use peripheral clock as MCAN baudrate generator input clock. */
#endif
XMC_CAN_CANCLKSRC_FOHP = 0x2U, /**< Use high performance oscillator (fOHP) as MCAN baudrate generator input clock. @note Only available for XMC1400, XMC4800 and XMC4700 series*/
#else
XMC_CAN_CANCLKSRC_FPERI = 0x1U, /**< Use peripheral clock as MCAN baudrate generator input clock. */
#endif
} XMC_CAN_CANCLKSRC_t;


I can't edit CAN.c or xmc_can.h, in Keil they are protected due they're included in the project from the package manager.
I've defined the XMC1404_Q064x0200 as a preprocessor symbol so in xmc_device.h it defines this:
#elif defined(XMC1404_Q064x0200)
#define UC_FAMILY XMC1
#define UC_SERIES XMC14
#define UC_DEVICE XMC1404
#define UC_PACKAGE VQFN64
#define UC_FLASH (200UL)
#define MULTICAN_PLUS
#define CCU4V3
#define CCU8V3

So seems the CAN.c provided from Infineon is not prepared to be used with the XMC1400?
Will it be correct to modify a copy of CAN.c and select XMC_CAN_CANCLKSRC_MCLK?
0 Likes
1 Solution
Vasanth
Moderator
Moderator
Moderator
250 sign-ins 500 solutions authored First question asked
Hi,

Did you download the package from this website : https://www.keil.com/dd2/pack/#!#third-party-download-dialog
5231.attach
There are XMC4000 and XMC1000 versions available in the website. Which package are you using. If this is not the source you are referring, kindly point me to it.

Best Regards,
Vasanth

View solution in original post

0 Likes
1 Reply
Vasanth
Moderator
Moderator
Moderator
250 sign-ins 500 solutions authored First question asked
Hi,

Did you download the package from this website : https://www.keil.com/dd2/pack/#!#third-party-download-dialog
5231.attach
There are XMC4000 and XMC1000 versions available in the website. Which package are you using. If this is not the source you are referring, kindly point me to it.

Best Regards,
Vasanth
0 Likes