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

cross mob
elibarber
Level 2
Level 2
10 replies posted 5 questions asked 5 likes given

So I flashed the example code to myXMC 1100 bootkit, hoping to connect to it with  my terminal application on PC. Getting no response when I open up a serial connection on my PC. Which got me thinking, if this is an Arduino compatible board, why not use Arduino examples, commands? See 2nd code example. Works like a charm...

1. Can I use any Arduino example I find if this board is "Arduino compatible"? I understand there are some limitations with the board, but for the most part would this be accurate? If so, why use the XMC library if we can work with Arduino logic.

2. Am I miss-understanding the what the first example code is suppose to do? You can find the exact code/readme.txt etc under the sample code linked below. Is the example intended for an actual physical connection with the tx and rx lines?
https://www.infineon.com/cms/en/product/evaluation-boards/kit_xmc11_boot_001/

 

/*
 * Copyright (C) 2015 Infineon Technologies AG. All rights reserved.
 *
 * Infineon Technologies AG (Infineon) is supplying this software for use with
 * Infineon's microcontrollers.
 * This file can be freely distributed within development tools that are
 * supporting such microcontrollers.
 *
 * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED
 * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
 * INFINEON SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL,
 * OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
 *
 */

/**
 * @file
 * @Date 01 Sept, 2015
 * @version 1.0.0
 *
 * @brief UART demo example
 *
 * Send a periodic message via UART
 *
 * History <br>
 *
 * Version 1.0.0 Initial <br>
 *
 */

#include "xmc_gpio.h"
#include "xmc_uart.h"

#define TICKS_PER_SECOND 1000
#define TICKS_WAIT 1000

const uint8_t message[] = "Hello world!!\n";


XMC_GPIO_CONFIG_t led1_config;
XMC_GPIO_CONFIG_t rx_pin_config;
XMC_GPIO_CONFIG_t tx_pin_config;
XMC_UART_CH_CONFIG_t uart_config;

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

  ticks++;
  if (ticks == TICKS_WAIT)
  {
	XMC_GPIO_ToggleOutput(XMC_GPIO_PORT0,6);

	for (index = 0; index < sizeof(message) - 1; index++)
	{
	  XMC_UART_CH_Transmit(XMC_UART0_CH1, message[index]);
	}
	ticks = 0;
  }
}


int main(void)
{
  /* Configure LED1 */
  led1_config.mode = XMC_GPIO_MODE_OUTPUT_PUSH_PULL;
  XMC_GPIO_Init(XMC_GPIO_PORT0,6, &led1_config);

  /* UART configuration */
  uart_config.data_bits = 8U;
  uart_config.stop_bits = 1U;
  uart_config.baudrate = 115200;
  uart_config.parity_mode = XMC_USIC_CH_PARITY_MODE_NONE;

  /* Configure RX pin */
  rx_pin_config.mode = XMC_GPIO_MODE_INPUT_INVERTED_TRISTATE;
  XMC_GPIO_Init(XMC_GPIO_PORT1,3, &rx_pin_config);

  XMC_UART_CH_SetInputSource(XMC_UART0_CH1,XMC_UART_CH_INPUT_RXD,USIC0_C1_DX0_P1_3);


  /* Configure UART channel */
  XMC_UART_CH_Init(XMC_UART0_CH1, &uart_config);
  /* Start UART channel */
  XMC_UART_CH_Start(XMC_UART0_CH1);

  /* Configure TX pin */
  tx_pin_config.mode = XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT7;
  XMC_GPIO_Init(XMC_GPIO_PORT1,2, &tx_pin_config);

  /* Send a message via UART periodically */
  SysTick_Config(SystemCoreClock / TICKS_PER_SECOND);

  while(1)
  {
	/* Infinite loop */
  }
}

 

 

 

 

 

 

void setup() {
  Serial.begin(9600); // Set the baud rate to match the device's baud rate
}

void loop() {
  // Check if data is available to read from the Serial port
  if (Serial.available() > 0) {
    char incomingData = Serial.read(); // Read the incoming data
    
    // Process the incoming data (you can add your logic here)
    processIncomingData(incomingData);
  }

  // Your additional code can go here
  
  // Send data to the other device
  sendDataToCard();
  
  // Delay for stability and to prevent flooding the Serial port
  delay(1000);
}

void processIncomingData(char data) {
  // Add your logic to process the incoming data here
  // For example, you can print it to the Serial Monitor
  Serial.print("Received: ");
  Serial.println(data);
}

void sendDataToCard() {
  // Add your logic to send data to the card here
  // For example, send a message every second
  static int counter = 0;
  Serial.print("Sending: Hello Card! Count: ");
  Serial.println(counter++);
}

 

 

0 Likes
1 Solution
Owen_Su
Moderator
Moderator
Moderator
250 solutions authored 500 replies posted 50 likes received

Hi, @elibarber ,

    1) For the Arduino compatible board, you can use the Arduino commands build your project and then use Arduino IDE to flash it to your XMC1100_bootkit directly. But before this, you need to install the XMC-for-Arduino library into the Arduino IDE, you can refer to the link below for more information:

https://github.com/Infineon/XMC-for-Arduino

    And you can see that the example are in the Arduino commands:

Owen_Su_0-1706757315578.png

    2) For the first example, you don't need to connect rx and rx physically. Hope this can help you.

BR,

Owen

View solution in original post

1 Reply
Owen_Su
Moderator
Moderator
Moderator
250 solutions authored 500 replies posted 50 likes received

Hi, @elibarber ,

    1) For the Arduino compatible board, you can use the Arduino commands build your project and then use Arduino IDE to flash it to your XMC1100_bootkit directly. But before this, you need to install the XMC-for-Arduino library into the Arduino IDE, you can refer to the link below for more information:

https://github.com/Infineon/XMC-for-Arduino

    And you can see that the example are in the Arduino commands:

Owen_Su_0-1706757315578.png

    2) For the first example, you don't need to connect rx and rx physically. Hope this can help you.

BR,

Owen