- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Community,
I've been trying for a while to do CAN communication with a cancase using Canalyzer.
I tested the loopback with an example from infineon and it works well, then i configured the tx and rx pins with this way
#define CAN01_TXD_PIN IfxCan_TXD01_P15_2_OUT
#define CAN01_RXD_PIN IfxCan_RXD01A_P15_3_IN
const IfxCan_Can_Pins can01Pins = {
.txPin = &CAN01_TXD_PIN,
.txPinMode = IfxPort_OutputMode_pushPull,
.rxPin = &CAN01_RXD_PIN,
.rxPinMode = IfxPort_InputMode_pullUp,
.padDriver = IfxPort_PadDriver_cmosAutomotiveSpeed1
};
I only see errors: screnn attached
for information, I changed the configuration for the measurement of time quanta because it seems weird the default config:
here is my config:
.baudrate=500000,
.samplePoint = 8000,
.syncJumpWidth = 1,
.prescaler=8,
.timeSegment1 = 15,
.timeSegment2 = 4
the clock frequency of my MCMCAN cell = 80 Mhz measured in debug mode, and I have correctly configured the baudrate at 500kbits/s on the Canalyzer side could you help me please because i'm stuck on this part and i can't find any information
My first question: could you explain to me the default configuration that exists in all the examples of the MCMCAN: .baudrate=500000,
.samplePoint = 8000,
.syncJumpWidth = 3,
.prescaler=0,
.timeSegment1 = 3,
.timeSegment2 = 10
How they will generate a baudrate of 500kb/s with this configuration and also I put the project in zip if you have any ideas
thanks a lot for your help
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please start from the demo code, and an email has been send to you for a modified.
Below settings is correct to make 500kbps baudrate.
.baudRate = {
.baudrate = 500000,
.samplePoint = 8000,
.syncJumpWidth = 3,
.prescaler = 0,
.timeSegment1 = 3,
.timeSegment2 = 10
},
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for your feedback and thank you for the document .
By information, the external clock value on our electronic board didied in the test is 24 Mhz and when I changed the value in the CAN driver it worked, because the value IFX_CFG_SCU_XTAL_FREQUENCY in the driver is 20000000 hz, that's why, it didn't work.
Is there a cleaner way to change this?
Est ce qu'il y'a un moyen plus propre pour modifier ça ?
float32 IfxScuCcu_getPerPllFrequency1(void)
{
Ifx_SCU *scu = &MODULE_SCU;
float32 pllFrequency1;
float32 oscFreq;
//oscFreq = IfxScuCcu_getOscFrequency();
oscFreq = 24000000;
pllFrequency1 = (oscFreq * (scu->PERPLLCON0.B.NDIV + 1)) / ((scu->PERPLLCON0.B.PDIV + 1) * (scu->PERPLLCON1.B.K2DIV + 1));
return pllFrequency1;
}
Thank you for your help
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi ATY, do you mean this issue is fixed? Please refer to below function for freq setting:
float32 IfxScuCcu_setMcanFrequency(float32 mcanFreq)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi DW,
Yes is fixed, I changed the external clock frequency and I redid the bit timing calculation using this link with the correct clock frequency and baudrate .
A question please, I'm not talking about the frequency of the MCMCAN but about the source clock (the external clock IFX_CFG_SCU_XTAL_FREQUENCY = 20MHZ) defined in the file Ifx_Cfg.h, is there a clean way to change this value?
Thank you very much dw for your help
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If you check below function, you will notice there are MACROs for OSC freqency.
IFX_INLINE float32 IfxScuCcu_getOscFrequency(void)
{
float32 freq;
if (SCU_SYSPLLCON0.B.INSEL == IfxScuCcu_PllInputClockSelection_fOsc1)
{
freq = IFXSCU_EVR_OSC_FREQUENCY;
}
else if (SCU_SYSPLLCON0.B.INSEL == IfxScuCcu_PllInputClockSelection_fOsc0)
{
freq = (float32)IFX_CFG_SCU_XTAL_FREQUENCY;
}
else if (SCU_SYSPLLCON0.B.INSEL == IfxScuCcu_PllInputClockSelection_fSysclk)
{
freq = IFX_CFG_SCU_SYSCLK_FREQUENCY;
}
else
{
/* Reserved values, this */
freq = 0.0;
}
return freq;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes this is what I modified at the beginning but if we do the modification of the macro here, you can try and see ( IFX_CFG_SCU_XTAL_FREQUENCY = 24000000) to modify just the macro, it will generate quite a lot of compile error because it will not find the IFXSCU_CFG_PLL_STEPS_24MHZ_300MHZ in the project and I don't know how to set up this part
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
#if (IFX_CFG_SCU_XTAL_FREQUENCY == (20000000))
#define IFXSCU_CFG_XTAL_FREQ 20MHZ
#elif (IFX_CFG_SCU_XTAL_FREQUENCY == (25000000))
#define IFXSCU_CFG_XTAL_FREQ 25MHZ
#elif (IFX_CFG_SCU_XTAL_FREQUENCY == (40000000))
#define IFXSCU_CFG_XTAL_FREQ 40MHZ
#elif (IFX_CFG_SCU_XTAL_FREQUENCY == (16000000))
#define IFXSCU_CFG_XTAL_FREQ 16MHZ
#else
#error "Wrong XTAL frequency configuration! check IFX_CFG_SCU_XTAL_FREQUENCY configuration in Ifx_Cfg.h."
#error "AurixPlus Triboard supported crystal frequencies are 16MHz, 20MHz, 25MHz and 40MHz"
#endif
In the iLLD, only 4 crystal frequencies are used as above code showed.