Not applicable
Apr 20, 2015
12:10 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Apr 20, 2015
12:10 PM
Hello,
i try to use the can-controller from XMC4500 with C++ but it is impossible to start the Controller for me.
If I try to start the controller by reset the Bit “Module Disable Request Bit” then will not change the “Module Disable Status Bit”, but this is the indicator for the activation of the controller.
What do I have to do to start the controller?
That is my Source code.
Thank you for your support.
Best regards
CBW
i try to use the can-controller from XMC4500 with C++ but it is impossible to start the Controller for me.
If I try to start the controller by reset the Bit “Module Disable Request Bit” then will not change the “Module Disable Status Bit”, but this is the indicator for the activation of the controller.
What do I have to do to start the controller?
That is my Source code.
//Clock
CAN->CLC &= ~(CAN_CLC_DISR_Msk|CAN_CLC_EDIS_Msk); // Clock CAN Aktivieren
// Clock enable?
while(CAN->CLC & CAN_CLC_DISS_Msk);
CAN->FDR |= (0x01UL<
//PAD Settings
PORT1->IOCR12 &= ~(0x1FUL<<3); // delete Bits P1.12
PORT1->IOCR12 &= ~(0x1FUL<<11); // delete Bits P1.13
PORT1->IOCR12 |= (GPIO_CAN_MODE_TX_P1_12<<3); //set Bits for CAN TX by P.12 -Alt2
PORT1->IOCR12 |= (GPIO_CAN_MODE_RX_P1_13<<11); //set Bit for CAN RX
PORT1->IOCR8 &= ~(0x1FUL<<27); // delete Bits P1.11
PORT1->IOCR8 |= (GPIO_CAN_MODE_RS_P1_11<<27); // set Bits P1.11 as output
//Contf
CAN_NODE0->NCR |=(1 << POS_Configuration_Change_Enable);
//Timing Register
CAN_NODE0->NBTR = 0x00UL;
CAN_NODE0->NBTR |= ((0x00UL & 0x3FUL)<< POS_BRP);
CAN_NODE0->NBTR |= ((0x00UL & 0x01UL)<< POS_DIV8);
CAN_NODE0->NBTR |= ((0xB4UL & 0x0FUL)<< POS_TSEG1);
CAN_NODE0->NBTR |= ((0x3CUL & 0x07UL)<< POS_TSEG2);
CAN_NODE0->NBTR |= ((0x3CUL & 0x03UL)<< POS_SJW);
CAN_NODE0->NCR &=~(1 << POS_Configuration_Change_Enable);
PORT1->OMR |= (0x01UL << 27);
Thank you for your support.
Best regards
CBW
5 Replies
Apr 20, 2015
07:16 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Apr 20, 2015
07:16 PM
Hi CBW,
Can you have a look at this example?
http://www.infineonforums.com/threads/2651-XMC_HOT-XMC4500-CAN-basic
BR
Travis
Can you have a look at this example?
http://www.infineonforums.com/threads/2651-XMC_HOT-XMC4500-CAN-basic
BR
Travis
Not applicable
Apr 21, 2015
12:20 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Apr 21, 2015
12:20 AM
Hello Trevis,
Thank you for your fast answer and the link to the documentation.
This example uses the Dave-App and the Code is like my Code:
Code Dave-App:
My Code:
Okay, the Dave-App uses a unknown macro. Do you know what is the exercise from this Macro?
I have read in the „User Manuel”, that I have to clear the Bit “CAN_CLC_DISR” befor I can do anything with the Can Controller of the XMC4500.
Best Regards
Thank you for your fast answer and the link to the documentation.
This example uses the Dave-App and the Code is like my Code:
Code Dave-App:
/* Reset MultiCAN module */
RESET001_DeassertReset(PER1_MCAN0);
/* Enable CAN Module */
CAN->CLC &= (uint32_t)~CAN_CLC_DISR_Msk;
/* Select the Divider Mode */
while((CAN->CLC & CAN_CLC_DISS_Msk))
{}
CAN->FDR |= 1U </* Configure step value */
My Code:
//Clock
CAN->CLC &= ~(CAN_CLC_DISR_Msk|CAN_CLC_EDIS_Msk); // Clock CAN Aktivieren
// Clock enable?
while(CAN->CLC & CAN_CLC_DISS_Msk);
CAN->FDR |= (0x01UL<
Okay, the Dave-App uses a unknown macro. Do you know what is the exercise from this Macro?
I have read in the „User Manuel”, that I have to clear the Bit “CAN_CLC_DISR” befor I can do anything with the Can Controller of the XMC4500.
Best Regards
Not applicable
Apr 21, 2015
05:16 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Apr 21, 2015
05:16 AM
Hello CBW,
Macro RESET001_DeassertReset(PER1_MCAN0) replace this line: SCU_RESET->PRCLR1 = SCU_RESET_PRCLR1_MCAN0RS_Msk;
Best regards
Blackom
Macro RESET001_DeassertReset(PER1_MCAN0) replace this line: SCU_RESET->PRCLR1 = SCU_RESET_PRCLR1_MCAN0RS_Msk;
Best regards
Blackom
Not applicable
Apr 27, 2015
03:22 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Apr 27, 2015
03:22 AM
Hello Blackom,
thank you!
I can control the CAN-Controller now.
If i find a way to allocate my Message-Object 0 to List 1 then should it work.
Best regards
CBW
thank you!
I can control the CAN-Controller now.
If i find a way to allocate my Message-Object 0 to List 1 then should it work.
Best regards
CBW
Not applicable
May 08, 2015
12:08 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
May 08, 2015
12:08 AM
Hello CBW,
You can download sample code for MultiCAN. For example CAN001_Example1.
In file CAN001.c you can find part of code:
This code using function CAN001_IAllocateMOtoNodeList to allocate MO to List. Function CAN001_IAllocateMOtoNodeList use internal control panel to assign MO to List. You can read more about it in datasheet page 1800 and 1840.
Best regards
Blackom
You can download sample code for MultiCAN. For example CAN001_Example1.
In file CAN001.c you can find part of code:
for(Count = 0U; Count < Handle->NodeMONo; Count++)
{
CAN001_lAllocateMOtoNodeList(Handle->NodeID, (uint8_t)(Handle->FirstMOMapping + Count)); // write FirstMOMapping+count to NodeID+1(port CAN0 is assigned to LIST1).
MsgNo = (uint8_t)(Handle->FirstMOMapping + Count); // take next MO to write
CAN_MOxRegs = GET_MO_OFFSET(MsgNo);
/* Configure MPN */
CAN_MOxRegs->MOIPR = (((uint32_t)Handle->NodeID << \
(CAN_MO_MOIPR_MPN_Pos + 5)) | \
(Count << CAN_MO_MOIPR_MPN_Pos)); // set interrupt mask
}
This code using function CAN001_IAllocateMOtoNodeList to allocate MO to List. Function CAN001_IAllocateMOtoNodeList use internal control panel to assign MO to List. You can read more about it in datasheet page 1800 and 1840.
Best regards
Blackom