From 7d2180342bea0c014a37b15bc67d9517ac90d249 Mon Sep 17 00:00:00 2001 From: Frank Voorburg Date: Fri, 8 Jul 2022 12:16:51 +0000 Subject: [PATCH] Refs #1524. Place the CAN peripheral back into its reset state, before initializing, for XMC1 and XMC4 targets. git-svn-id: https://svn.code.sf.net/p/openblt/code/trunk@958 5dc33758-31d5-4daf-9ae8-b24bf3d40d73 --- Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/boot.c | 6 ++++++ Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_IAR/Prog/boot.c | 6 ++++++ Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_Keil/Prog/boot.c | 6 ++++++ Target/Demo/ARMCM4_XMC4_XMC4700_Relax_Kit_GCC/Prog/boot.c | 6 ++++++ Target/Demo/ARMCM4_XMC4_XMC4700_Relax_Kit_IAR/Prog/boot.c | 6 ++++++ Target/Demo/ARMCM4_XMC4_XMC4700_Relax_Kit_Keil/Prog/boot.c | 6 ++++++ Target/Source/ARMCM0_XMC1/can.c | 5 +++++ Target/Source/ARMCM4_XMC4/can.c | 6 ++++++ 8 files changed, 47 insertions(+) diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/boot.c b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/boot.c index f0d1a6314..6ec50a6a6 100644 --- a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/boot.c +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/boot.c @@ -266,6 +266,12 @@ static void BootComCanInit(void) XMC_CAN_NODE_NOMINAL_BIT_TIME_CONFIG_t baud; unsigned long receiveId; + /* set the CAN peripheral into the disabled state. the call to XMC_CAN_Init + * below enables it again, which consequently brings the peripheral back into + * its reset state. + */ + XMC_CAN_Disable(CAN); + /* decide on fCAN frequency. it should be in the 5-120MHz range. according to the * datasheet, it must be at least 12MHz if 1 node (channel) is used with up to * 16 message objects. This is sufficient for this CAN driver. diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_IAR/Prog/boot.c b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_IAR/Prog/boot.c index d2c537e57..12b6d3633 100644 --- a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_IAR/Prog/boot.c +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_IAR/Prog/boot.c @@ -266,6 +266,12 @@ static void BootComCanInit(void) XMC_CAN_NODE_NOMINAL_BIT_TIME_CONFIG_t baud; unsigned long receiveId; + /* set the CAN peripheral into the disabled state. the call to XMC_CAN_Init + * below enables it again, which consequently brings the peripheral back into + * its reset state. + */ + XMC_CAN_Disable(CAN); + /* decide on fCAN frequency. it should be in the 5-120MHz range. according to the * datasheet, it must be at least 12MHz if 1 node (channel) is used with up to * 16 message objects. This is sufficient for this CAN driver. diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_Keil/Prog/boot.c b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_Keil/Prog/boot.c index 26b3005c2..d251427d4 100644 --- a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_Keil/Prog/boot.c +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_Keil/Prog/boot.c @@ -266,6 +266,12 @@ static void BootComCanInit(void) XMC_CAN_NODE_NOMINAL_BIT_TIME_CONFIG_t baud; unsigned long receiveId; + /* set the CAN peripheral into the disabled state. the call to XMC_CAN_Init + * below enables it again, which consequently brings the peripheral back into + * its reset state. + */ + XMC_CAN_Disable(CAN); + /* decide on fCAN frequency. it should be in the 5-120MHz range. according to the * datasheet, it must be at least 12MHz if 1 node (channel) is used with up to * 16 message objects. This is sufficient for this CAN driver. diff --git a/Target/Demo/ARMCM4_XMC4_XMC4700_Relax_Kit_GCC/Prog/boot.c b/Target/Demo/ARMCM4_XMC4_XMC4700_Relax_Kit_GCC/Prog/boot.c index 77cd4dab7..dcc60ecbc 100644 --- a/Target/Demo/ARMCM4_XMC4_XMC4700_Relax_Kit_GCC/Prog/boot.c +++ b/Target/Demo/ARMCM4_XMC4_XMC4700_Relax_Kit_GCC/Prog/boot.c @@ -270,6 +270,12 @@ static void BootComCanInit(void) XMC_CAN_NODE_NOMINAL_BIT_TIME_CONFIG_t baud; unsigned long receiveId; + /* set the CAN peripheral into the disabled state. the call to XMC_CAN_Init + * below enables it again, which consequently brings the peripheral back into + * its reset state. + */ + XMC_CAN_Disable(CAN); + /* decide on fCAN frequency. it should be in the 5-120MHz range. according to the * datasheet, it must be at least 12MHz if 1 node (channel) is used with up to * 16 message objects. This is sufficient for this CAN driver. diff --git a/Target/Demo/ARMCM4_XMC4_XMC4700_Relax_Kit_IAR/Prog/boot.c b/Target/Demo/ARMCM4_XMC4_XMC4700_Relax_Kit_IAR/Prog/boot.c index ff1c8ce2a..7e4333fe7 100644 --- a/Target/Demo/ARMCM4_XMC4_XMC4700_Relax_Kit_IAR/Prog/boot.c +++ b/Target/Demo/ARMCM4_XMC4_XMC4700_Relax_Kit_IAR/Prog/boot.c @@ -270,6 +270,12 @@ static void BootComCanInit(void) XMC_CAN_NODE_NOMINAL_BIT_TIME_CONFIG_t baud; unsigned long receiveId; + /* set the CAN peripheral into the disabled state. the call to XMC_CAN_Init + * below enables it again, which consequently brings the peripheral back into + * its reset state. + */ + XMC_CAN_Disable(CAN); + /* decide on fCAN frequency. it should be in the 5-120MHz range. according to the * datasheet, it must be at least 12MHz if 1 node (channel) is used with up to * 16 message objects. This is sufficient for this CAN driver. diff --git a/Target/Demo/ARMCM4_XMC4_XMC4700_Relax_Kit_Keil/Prog/boot.c b/Target/Demo/ARMCM4_XMC4_XMC4700_Relax_Kit_Keil/Prog/boot.c index 1128889a1..1f4dca3d0 100644 --- a/Target/Demo/ARMCM4_XMC4_XMC4700_Relax_Kit_Keil/Prog/boot.c +++ b/Target/Demo/ARMCM4_XMC4_XMC4700_Relax_Kit_Keil/Prog/boot.c @@ -270,6 +270,12 @@ static void BootComCanInit(void) XMC_CAN_NODE_NOMINAL_BIT_TIME_CONFIG_t baud; unsigned long receiveId; + /* set the CAN peripheral into the disabled state. the call to XMC_CAN_Init + * below enables it again, which consequently brings the peripheral back into + * its reset state. + */ + XMC_CAN_Disable(CAN); + /* decide on fCAN frequency. it should be in the 5-120MHz range. according to the * datasheet, it must be at least 12MHz if 1 node (channel) is used with up to * 16 message objects. This is sufficient for this CAN driver. diff --git a/Target/Source/ARMCM0_XMC1/can.c b/Target/Source/ARMCM0_XMC1/can.c index 11b141a47..8b5711a97 100644 --- a/Target/Source/ARMCM0_XMC1/can.c +++ b/Target/Source/ARMCM0_XMC1/can.c @@ -101,6 +101,11 @@ void CanInit(void) * in case a different CAN channel is configured. */ ASSERT_CT((BOOT_COM_CAN_CHANNEL_INDEX >= 0) && (BOOT_COM_CAN_CHANNEL_INDEX <= 1)); + /* set the CAN peripheral into the disabled state. the call to XMC_CAN_Init + * below enables it again, which consequently brings the peripheral back into + * its reset state. + */ + XMC_CAN_Disable(CAN); /* decide on fCAN frequency. it should be in the 5-120MHz range. according to the * datasheet, it must be at least 12MHz if 1 node (channel) is used with up to diff --git a/Target/Source/ARMCM4_XMC4/can.c b/Target/Source/ARMCM4_XMC4/can.c index bc67c4392..7d97921a8 100644 --- a/Target/Source/ARMCM4_XMC4/can.c +++ b/Target/Source/ARMCM4_XMC4/can.c @@ -111,6 +111,12 @@ void CanInit(void) #else ASSERT_CT((BOOT_COM_CAN_CHANNEL_INDEX >= 0) && (BOOT_COM_CAN_CHANNEL_INDEX <= 2)); #endif + + /* set the CAN peripheral into the disabled state. the call to XMC_CAN_Init + * below enables it again, which consequently brings the peripheral back into + * its reset state. + */ + XMC_CAN_Disable(CAN); /* decide on fCAN frequency. it should be in the 5-120MHz range. according to the * datasheet, it must be at least 12MHz if 1 node (channel) is used with up to