Getting Started Example - Boot Kit XMC1400 - Won't build.

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

cross mob
Not applicable
Hello,

I'm trying to follow the example provided in the "Infineon-XMC1400_Boot_Kit_GettingStarted-GS-v01_00-EN.pdf".

I followed the instructions in the presentation to the letter and made it all the way to be build step for the "XMC1400_BlinkyMCAN" example.

The tool is flagging the lines which read:

led_config.mode = XMC_GPIO_MODE_OUTPUT_PUSH_PULL;
led_TX_config.mode = XMC_GPIO_MODE_OUTPUT_PUSH_PULL;
led_RX_config.mode = XMC_GPIO_MODE_OUTPUT_PUSH_PULL;

The tool revealed that these led_ variables as undeclared. Which, so far as I can tell is true. What I don't see is any information in the example presentation where these variables are declared.

Is it just me? Or does there seem to be code missing in the example?

The tool also complained about the two lines:
//.enable_automatic_dco1_calibration = true,
//.clock_sync = XMC_SCU_CLOCK_SYNC_CLKSRC_OSCHP,

and rightfully so. These members don't exist in the definition for XMC_SCU_CLOCK_CONFIG_t.

Again, am I missing something simple?

Thank you in advance for your assistance.

My main.c is below:


/*
* main.c
*
* Created on: 2016 Jun 20 16:26:36
* Author: wachob
*/
#include "xmc_can.h"
#include "xmc_gpio.h"

//#include

#define LED P4_0
#define LED_TX P4_1 // CAN Tx indicator
#define LED_RX P4_3 // CAN Rx indicator

#define CAN1_TXD P4_9
#define CAN1_RXD P4_8

#define TICKS_PER_SECOND 1000
#define TICKS_WAIT 500

XMC_SCU_CLOCK_CONFIG_t clock_config =
{
.dclk_src = XMC_SCU_CLOCK_DCLKSRC_DCO1,
.oschp_mode = XMC_SCU_CLOCK_OSCHP_MODE_OSC,
//.enable_automatic_dco1_calibration = true,
//.clock_sync = XMC_SCU_CLOCK_SYNC_CLKSRC_OSCHP,
.pclk_src = XMC_SCU_CLOCK_PCLKSRC_DOUBLE_MCLK,
.fdiv = 0,
.idiv = 1
};

/**

* @brief main() - Application entry point
*
* Details of function

* This routine is the application entry point. It is invoked by the device startup code.
*/


int main(void)
{

XMC_SCU_CLOCK_Init(&clock_config);

led_config.mode = XMC_GPIO_MODE_OUTPUT_PUSH_PULL;
XMC_GPIO_Init(LED, &led_config);
led_TX_config.mode = XMC_GPIO_MODE_OUTPUT_PUSH_PULL;
led_TX_config.output_level = XMC_GPIO_OUTPUT_LEVEL_HIGH;
XMC_GPIO_Init(LED_TX, &led_TX_config);
led_RX_config.mode = XMC_GPIO_MODE_OUTPUT_PUSH_PULL;
led_RX_config.output_level = XMC_GPIO_OUTPUT_LEVEL_HIGH;
XMC_GPIO_Init(LED_RX, &led_RX_config);

XMC_GPIO_CONFIG_t CAN1_TXD_config;
XMC_GPIO_CONFIG_t CAN1_RXD_config;
CAN1_TXD_config.mode = XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT9;
CAN1_RXD_config.mode = XMC_GPIO_MODE_INPUT_TRISTATE;
XMC_GPIO_Init(CAN1_TXD, &CAN1_TXD_config);
XMC_GPIO_Init(CAN1_RXD, &CAN1_RXD_config);

XMC_CAN_MO_t MCAN_message1 =
{
.can_mo_ptr = CAN_MO4,
.can_priority = XMC_CAN_ARBITRATION_MODE_IDE_DIR_BASED_PRIO_2,
.can_identifier = 0x3FF,
.can_id_mask = 0x7FF,
.can_id_mode = XMC_CAN_FRAME_TYPE_STANDARD_11BITS,
.can_ide_mask = 1,
.can_data_length = 8,
.can_data = {0x12345555,0x12345556},
.can_mo_type = XMC_CAN_MO_TYPE_TRANSMSGOBJ
};


// System Timer Configuration
SysTick_Config(SystemCoreClock / TICKS_PER_SECOND);

void SysTick_Handler(void)
{
static uint32_t ticks = 0;

ticks++;
if (ticks == TICKS_WAIT)
{
XMC_GPIO_ToggleOutput(LED);
XMC_CAN_MO_Transmit(&MCAN_message1);
XMC_GPIO_ToggleOutput(LED_TX);
ticks = 0;
}
}

// CAN bit time
XMC_CAN_NODE_NOMINAL_BIT_TIME_CONFIG_t baud = {
.can_frequency=11000000,
.baudrate=500000,
.sample_point=6000,
.sjw=3,
};


// CAN message = CAN_MO2
XMC_CAN_MO_t MCAN_message2 =
{
.can_mo_ptr = CAN_MO2,
.can_priority = XMC_CAN_ARBITRATION_MODE_IDE_DIR_BASED_PRIO_2,
.can_identifier = 0x2ff,
.can_id_mask = 0x2ff,
.can_id_mode = XMC_CAN_FRAME_TYPE_STANDARD_11BITS,
.can_ide_mask = 1,
.can_data_length = 8,
.can_mo_type = XMC_CAN_MO_TYPE_RECMSGOBJ
};

// Set Rx interrupt svc req number
XMC_SCU_SetInterruptControl (7, XMC_SCU_IRQCTRL_7_CAN0_SR3);
XMC_CAN_MO_SetEventNodePointer (&MCAN_message2, XMC_CAN_MO_POINTER_EVENT_RECEIVE,3);
NVIC_SetPriority (IRQ7_IRQn, 1);
NVIC_EnableIRQ (IRQ7_IRQn);

// Allocate MO in Node List
XMC_CAN_AllocateMOtoNodeList(CAN,1,4);
XMC_CAN_AllocateMOtoNodeList(CAN,1,2);
XMC_CAN_NODE_ResetInitBit(CAN_NODE1);

// This is the interrupt event handler for CAN Node
void IRQ7_Handler(void)
{
// Toggle LE P4_3 indicating msg rxd
XMC_CAN_MO_Receive(&MCAN_message2);
XMC_GPIO_ToggleOutput(LED_RX);
NVIC_ClearPendingIRQ(IRQ7_IRQn);
};



/* Placeholder for user application code. The while loop below can be replaced with user application code. */
while(1U)
{

}
}
0 Likes
3 Replies
lock attach
Attachments are accessible only for community members.
Rick_Nardone
Employee
Employee
Hi,

The completed solution is available on the Infineon website, and I have attached it to this reply.


Best,

Rick
0 Likes
Not applicable
Rick,

Thanks. I really wish that they would have included the link in their presentation.

Now I can get back to business.

Greatly appreciated.
0 Likes