From 53567f4b6bd599c0416d687cc0f5df8acbfa4b8e Mon Sep 17 00:00:00 2001 From: zhanglinjing Date: Thu, 16 Nov 2023 11:14:11 +0100 Subject: [PATCH 01/24] Initialize pin mapping file based on xmc1100 2go --- .../config/XMC1400_XMC2GO/pins_arduino.h | 385 ++++++++++++++++++ 1 file changed, 385 insertions(+) create mode 100644 variants/XMC1400/config/XMC1400_XMC2GO/pins_arduino.h diff --git a/variants/XMC1400/config/XMC1400_XMC2GO/pins_arduino.h b/variants/XMC1400/config/XMC1400_XMC2GO/pins_arduino.h new file mode 100644 index 00000000..f6823c89 --- /dev/null +++ b/variants/XMC1400/config/XMC1400_XMC2GO/pins_arduino.h @@ -0,0 +1,385 @@ +/* + pins_arduino.h - Pin definition functions for Arduino + Part of Arduino - http://www.arduino.cc/ + + Copyright (c) 2007 David A. Mellis + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General + Public License along with this library; if not, write to the + Free Software Foundation, Inc., 59 Temple Place, Suite 330, + Boston, MA 02111-1307 USA + + Copyright (c) 2018 Infineon Technologies AG + This file has been modified for the XMC microcontroller series. +*/ +#ifndef PINS_ARDUINO_H_ +#define PINS_ARDUINO_H_ + +//**************************************************************************** +// @Project Includes +//**************************************************************************** +#include + +//**************************************************************************** +// @Defines +//**************************************************************************** +// XMC_BOARD for stringifying into serial or other text outputs/logs +// Note the actual name XMC and number MUST have a character between +// to avoid issues with other defined macros e.g. XMC1100 +#define XMC_BOARD XMC 1400 XMC2GO + +/* On board LED is ON when digital output is 1, HIGH, TRUE, ON */ +#define XMC_LED_ON 1 + +// Following were defines now evaluated by compilation as const variables +// After definitions of associated mapping arrays +extern const uint8_t NUM_DIGITAL; +extern const uint8_t GND; +extern const uint8_t NUM_PWM4; +extern const uint8_t NUM_PWM; +extern const uint8_t NUM_INTERRUPT; +extern const uint8_t NUM_ANALOG_INPUTS; +#define NUM_LEDS 2 +#define NUM_SERIAL 1 +#define NUM_TONE_PINS 4 +#define NUM_TASKS_VARIANT 8 +#define NUM_SPI 1 +#define NUM_I2C 2 + +// Indicate unit has RTC/Alarm +#define HAS_RTC 1 + +// Defines will be either set by ArduinoIDE in the menu or manually +#ifdef SERIAL_HOSTPC +// Comment out following line to use Serial on pins (board) +#define SERIAL_DEBUG 1 +#elif SERIAL_ONBOARD +// No SERIAL_DEBUG will be defined, kept here for clarity +#else +// Define the SERIAL_DEBUG as default setting +#define SERIAL_DEBUG 1 +#endif + +// TODO: Verify the CCU frequency +// Generate 490Hz @fCCU=1MHz +#define PWM4_TIMER_PERIOD (2041U) + +// TODO: Verify the PCLK +#define PCLK 64000000u + +#define PIN_SPI_SS 3 +#define PIN_SPI_MOSI 1 +#define PIN_SPI_MISO 0 +#define PIN_SPI_SCK 2 + +extern uint8_t SS; +extern uint8_t MOSI; +extern uint8_t MISO; +extern uint8_t SCK; + +// XMC_I2S defines +/*U0C1*/ +/*DX0C(Input) -> P0.6*/ +/*SCLKOUT(ALT6) -> P0.8*/ +/*WA(ALT6) -> P0.9*/ +#define MASTER_CHANNEL XMC_I2S0_CH1 +#define MASTER_MRST PORT0, 6 +#define INPUT_SOURCE USIC0_C1_DX0_P0_6 +#define MASTER_SCLK PORT0, 8 +#define MASTER_WACLK PORT0, 9 + +#define A0 0 +#define A1 1 +#define A2 2 +#define A3 3 + +#define LED1 14 +#define LED2 15 +#define LED_BUILTIN LED1 + +#define digitalPinToInterrupt(p) (((p) == 9) ? 0 : NOT_AN_INTERRUPT) + +#define ARDUINO_MAIN + +#ifdef ARDUINO_MAIN +// Mapping of digital pins and comments +const XMC_PORT_PIN_t mapping_port_pin[] = + { + /* 0 */ {XMC_GPIO_PORT0, 0}, // SPI-MISO P0.0 + /* 1 */ {XMC_GPIO_PORT0, 1}, // SPI-MOSI / PWM40-1 output P0.1 + /* 2 */ {XMC_GPIO_PORT0, 3}, // SPI-SCK / PWM40-3 output P0.3 + /* 3 */ {XMC_GPIO_PORT0, 4}, // SPI-SS / PWM40-1 output P0.4 + /* 4 */ {XMC_GPIO_PORT0, 14}, // GPIO P0.14 + /* 5 */ {XMC_GPIO_PORT0, 15}, // GPIO P0.15 + /* 6 */ {XMC_GPIO_PORT2, 0}, // TX P2.0 + /* 7 */ {XMC_GPIO_PORT2, 6}, // RX P2.6 (INPUT ONLY) + /* 8 */ {XMC_GPIO_PORT0, 5}, // PWM40-0 output P0.5 + /* 9 */ {XMC_GPIO_PORT1, 4}, // External interrupt 0 / PWM41-0 output P1.4 + /* 10 */ {XMC_GPIO_PORT2, 11}, // I2C Clock SCL / A3 ADC P2.11 + /* 11 */ {XMC_GPIO_PORT2, 10}, // I2C Data / A2 ADC P2.10 + /* 12 */ {XMC_GPIO_PORT2, 9}, // A1 / ADC Input P2.9 (INPUT ONLY) + /* 13 */ {XMC_GPIO_PORT2, 8}, // A0 / ADC Input P2.8 (INPUT ONLY) + /* 14 */ {XMC_GPIO_PORT0, 7}, // LED 1 output P0.7 + /* 15 */ {XMC_GPIO_PORT0, 6}, // LED 2 output P0.6 + /* 16 */ {XMC_GPIO_PORT2, 1}, // DEBUG_TX P2.1 + /* 17 */ {XMC_GPIO_PORT2, 2} // DEBUG_RX P2.2 (INPUT ONLY) +}; +const uint8_t GND = ( sizeof( mapping_port_pin ) / sizeof( XMC_PORT_PIN_t ) ); +const uint8_t NUM_DIGITAL = ( sizeof( mapping_port_pin ) / sizeof( XMC_PORT_PIN_t ) ); + +/* Configurations of Interrupt */ +const XMC_PIN_INTERRUPT_t mapping_interrupt[] = + { + /* 0 */ {CCU40, CCU40_CC40, 0, 0, CCU40_IN0_U0C0_DX2INS} + }; +const uint8_t NUM_INTERRUPT = ( sizeof( mapping_interrupt ) / sizeof( XMC_PIN_INTERRUPT_t ) ); + +/* Mapping of Arduino Pins to PWM4 channels as pin and index in PWM4 channel + mapping array XMC_PWM4_t mapping_pwm4[] + last entry 255 for both parts. + Putting both parts in array means if a PWM4 channel gets reassigned for + another function later a gap in channel numbers will not mess things up */ +const uint8_t mapping_pin_PWM4[][ 2 ] = { + { 8, 0 }, + { 1, 1 }, + { 3, 2 }, + { 9, 3 }, + { 255, 255 } }; + +/* Configurations of PWM channels for CCU4 type */ +XMC_PWM4_t mapping_pwm4[] = + { + {CCU40, CCU40_CC40, 0, mapping_port_pin[8], P0_5_AF_CCU40_OUT0, XMC_CCU4_SLICE_PRESCALER_64, PWM4_TIMER_PERIOD, DISABLED}, // PWM disabled 8 P0.5 + {CCU40, CCU40_CC41, 1, mapping_port_pin[1], P0_7_AF_CCU40_OUT1, XMC_CCU4_SLICE_PRESCALER_64, PWM4_TIMER_PERIOD, DISABLED}, // PWM disabled 1 P0.7 + {CCU40, CCU40_CC42, 2, mapping_port_pin[2], P0_8_AF_CCU40_OUT2, XMC_CCU4_SLICE_PRESCALER_64, PWM4_TIMER_PERIOD, DISABLED}, // PWM disabled 2 P0.8 + {CCU40, CCU40_CC43, 3, mapping_port_pin[3], P0_9_AF_CCU40_OUT3, XMC_CCU4_SLICE_PRESCALER_64, PWM4_TIMER_PERIOD, DISABLED} // PWM disabled 3 P0.9 + }; +const uint8_t NUM_PWM = ( sizeof( mapping_pwm4 ) / sizeof( XMC_PWM4_t ) ); +const uint8_t NUM_PWM4 = ( sizeof( mapping_pwm4 ) / sizeof( XMC_PWM4_t ) ); + +/* Analog Pin mappings and configurations */ +XMC_ADC_t mapping_adc[] = + { + {VADC, 1, DISABLED}, + {VADC, 2, DISABLED}, + {VADC, 3, DISABLED}, + {VADC, 4, DISABLED} + }; +const uint8_t NUM_ANALOG_INPUTS = ( sizeof( mapping_adc ) / sizeof( XMC_ADC_t ) ); + +/* + * UART objects + */ +RingBuffer rx_buffer_0; +RingBuffer tx_buffer_0; + +/* First UART channel pins are swapped between debug and normal use */ +XMC_UART_t XMC_UART_0 = + { + .channel = XMC_UART0_CH0, + .rx = { .port = (XMC_GPIO_PORT_t*)PORT2_BASE, +#ifdef SERIAL_DEBUG + .pin = (uint8_t)2 +#else + .pin = (uint8_t)6 +#endif + }, + .rx_config = { .mode = XMC_GPIO_MODE_INPUT_TRISTATE, + .output_level = XMC_GPIO_OUTPUT_LEVEL_HIGH, + .input_hysteresis = XMC_GPIO_INPUT_HYSTERESIS_STANDARD + }, + .tx = { .port = (XMC_GPIO_PORT_t*)PORT2_BASE, +#ifdef SERIAL_DEBUG + .pin = (uint8_t)1 +#else + .pin = (uint8_t)0 +#endif + }, + .tx_config = { .mode = (XMC_GPIO_MODE_t) XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT6, + .output_level = XMC_GPIO_OUTPUT_LEVEL_HIGH, + .input_hysteresis = XMC_GPIO_INPUT_HYSTERESIS_STANDARD + }, + .input_source_dx0 = (XMC_USIC_INPUT_t)USIC0_C0_DX0_DX3INS, + .input_source_dx1 = XMC_INPUT_INVALID, + .input_source_dx2 = XMC_INPUT_INVALID, +#ifdef SERIAL_DEBUG + .input_source_dx3 = (XMC_USIC_INPUT_t)USIC0_C0_DX3_P2_2, +#else + .input_source_dx3 = (XMC_USIC_INPUT_t)USIC0_C0_DX3_P2_6, +#endif + .irq_num = USIC0_0_IRQn, + .irq_service_request = 0 + }; + +HardwareSerial Serial( &XMC_UART_0, &rx_buffer_0, &tx_buffer_0 ); + +// SPI instance +XMC_SPI_t XMC_SPI_0 = +{ + .channel = XMC_SPI0_CH1, + .channel_config = { + .baudrate = 15984375U, + .bus_mode = (XMC_SPI_CH_BUS_MODE_t)XMC_SPI_CH_BUS_MODE_MASTER, + .selo_inversion = XMC_SPI_CH_SLAVE_SEL_INV_TO_MSLS, + .parity_mode = XMC_USIC_CH_PARITY_MODE_NONE + }, + .mosi = { + .port = (XMC_GPIO_PORT_t*)PORT0_BASE, + .pin = (uint8_t)7 + }, + .mosi_config = { + .mode = XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT7, + .output_level = XMC_GPIO_OUTPUT_LEVEL_HIGH, + .input_hysteresis = XMC_GPIO_INPUT_HYSTERESIS_STANDARD + }, + .miso = { + .port = (XMC_GPIO_PORT_t*)PORT0_BASE, + .pin = (uint8_t)6 + }, + .miso_config = { + .mode = XMC_GPIO_MODE_INPUT_TRISTATE, + .input_hysteresis = XMC_GPIO_INPUT_HYSTERESIS_STANDARD + }, + .input_source = XMC_INPUT_C, + .sclkout = { + .port = (XMC_GPIO_PORT_t*)PORT0_BASE, + .pin = (uint8_t)8 + }, + .sclkout_config = { + .mode = XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT7, + .output_level = XMC_GPIO_OUTPUT_LEVEL_HIGH, + .input_hysteresis = XMC_GPIO_INPUT_HYSTERESIS_STANDARD + } +}; + +// Two I2C instances possible +XMC_I2C_t XMC_I2C_0 = +{ + .channel = XMC_I2C0_CH1, + .channel_config = { + .baudrate = (uint32_t)(100000U), + .address = 0U + }, + .sda = { + .port = (XMC_GPIO_PORT_t*)PORT2_BASE, + .pin = (uint8_t)10 + }, + .sda_config = { + .mode = XMC_GPIO_MODE_OUTPUT_OPEN_DRAIN_ALT7, + .output_level = XMC_GPIO_OUTPUT_LEVEL_HIGH, + .input_hysteresis = XMC_GPIO_INPUT_HYSTERESIS_STANDARD + }, + .scl = { + .port = (XMC_GPIO_PORT_t*)PORT2_BASE, + .pin = (uint8_t)11 + }, + .scl_config = { + .mode = XMC_GPIO_MODE_OUTPUT_OPEN_DRAIN_ALT6, + .output_level = XMC_GPIO_OUTPUT_LEVEL_HIGH, + .input_hysteresis = XMC_GPIO_INPUT_HYSTERESIS_STANDARD + }, + .input_source_dx0 = XMC_INPUT_F, + .input_source_dx1 = XMC_INPUT_E, + .slave_receive_irq_num = (IRQn_Type) USIC0_4_IRQn, + .slave_receive_irq_service_request = 4 , + .protocol_irq_num = (IRQn_Type) USIC0_5_IRQn, + .protocol_irq_service_request = 5 +}; + +XMC_I2C_t XMC_I2C_1 = +{ + .channel = XMC_I2C0_CH0, + .channel_config = { + .baudrate = (uint32_t)(100000U), + .address = 0U + }, + .sda = { + .port = (XMC_GPIO_PORT_t*)PORT0_BASE, + .pin = (uint8_t)15 + }, + .sda_config = { + .mode = XMC_GPIO_MODE_OUTPUT_OPEN_DRAIN_ALT6, + .output_level = XMC_GPIO_OUTPUT_LEVEL_HIGH, + .input_hysteresis = XMC_GPIO_INPUT_HYSTERESIS_STANDARD + }, + .scl = { + .port = (XMC_GPIO_PORT_t*)PORT0_BASE, + .pin = (uint8_t)14 + }, + .scl_config = { + .mode = XMC_GPIO_MODE_OUTPUT_OPEN_DRAIN_ALT7, + .output_level = XMC_GPIO_OUTPUT_LEVEL_HIGH, + .input_hysteresis = XMC_GPIO_INPUT_HYSTERESIS_STANDARD + }, + .input_source_dx0 = XMC_INPUT_B, + .input_source_dx1 = XMC_INPUT_A, + .slave_receive_irq_num = (IRQn_Type) USIC0_2_IRQn, + .slave_receive_irq_service_request = 2 , + .protocol_irq_num = (IRQn_Type) USIC0_3_IRQn, + .protocol_irq_service_request = 3 +}; + +// XMC_I2S instance +XMC_I2S_t i2s_config = +{ + .input_config = { + .mode = XMC_GPIO_MODE_INPUT_TRISTATE, + .output_level = XMC_GPIO_OUTPUT_LEVEL_HIGH, + .input_hysteresis = XMC_GPIO_INPUT_HYSTERESIS_STANDARD + }, + .sclk_config = { + .mode = XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT7, + .output_level = XMC_GPIO_OUTPUT_LEVEL_HIGH, + .input_hysteresis = XMC_GPIO_INPUT_HYSTERESIS_STANDARD + }, + .wa_config = { + .mode = XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT7, + .output_level = XMC_GPIO_OUTPUT_LEVEL_HIGH, + .input_hysteresis = XMC_GPIO_INPUT_HYSTERESIS_STANDARD + }, + .protocol_irq_num = (IRQn_Type) USIC0_2_IRQn, + .protocol_irq_service_request = 2 +}; + +// Serial Interrupt and event handling +#ifdef __cplusplus +extern "C" { +#endif +void serialEventRun( ); +void serialEvent( ) __attribute__((weak)); + + +void serialEventRun( ) +{ +if( serialEvent ) + { + if( Serial.available( ) ) + serialEvent( ); + } +} + + +void USIC0_0_IRQHandler( ) +{ +Serial.IrqHandler( ); +} +#ifdef __cplusplus +} +#endif +#endif /* ARDUINO_MAIN */ + +#ifdef __cplusplus +extern HardwareSerial Serial; +#endif /* cplusplus */ + +#endif // PINS_ARDUINO_H_ From d7da5b20d4bdfc793c942b37675cdca7e3524428 Mon Sep 17 00:00:00 2001 From: zhanglinjing Date: Thu, 16 Nov 2023 14:52:28 +0100 Subject: [PATCH 02/24] initialize xmc1400 2Go boards - build and upload configuration --- boards.txt | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/boards.txt b/boards.txt index edfad61f..5469b2c6 100644 --- a/boards.txt +++ b/boards.txt @@ -134,6 +134,50 @@ XMC1300_Boot_Kit.menu.LIB.DSP.library.selected=-DARM_LIB_CMSIS_DSP XMC1300_Boot_Kit.menu.LIB.DSPNN=ARM DSP / ARM NN Framework XMC1300_Boot_Kit.menu.LIB.DSPNN.library.selected=-DARM_LIB_CMSIS_DSP -DARM_LIB_CMSIS_NN +#################################################### +XMC1400_XMC2GO.name=XMC 1400 XMC2GO +XMC1400_XMC2GO.upload.tool=xmcflasher +XMC1400_XMC2GO.upload.speed=115200 +XMC1400_XMC2GO.upload.resetmethod=ck +XMC1400_XMC2GO.upload.maximum_size=65536 +XMC1400_XMC2GO.upload.wait_for_upload_port=true + +XMC1400_XMC2GO.communication=usb +XMC1400_XMC2GO.protocol=dragon_isp +XMC1400_XMC2GO.program.protocol=dragon_isp +XMC1400_XMC2GO.program.tool=xmcflasher +XMC1400_XMC2GO.program.extra_params=-Pusb + +XMC1400_XMC2GO.serial.disableDTR=true +XMC1400_XMC2GO.serial.disableRTS=true + +XMC1400_XMC2GO.build.mcu=cortex-m0 +XMC1400_XMC2GO.build.f_cpu=48000000L +XMC1400_XMC2GO.build.board=ARM_XMC +XMC1400_XMC2GO.build.board.version=1402 +XMC1400_XMC2GO.build.board.type=Q040x0064 +XMC1400_XMC2GO.build.board.v=0200 +XMC1400_XMC2GO.build.core=./ +XMC1400_XMC2GO.build.variant=XMC1400 +XMC1400_XMC2GO.build.board_variant=XMC1400_XMC2GO +XMC1400_XMC2GO.build.flash_size=64K +XMC1400_XMC2GO.build.flash_ld=linker_script_64k.ld +XMC1400_XMC2GO.build.extra_flags=-DARM_MATH_CM0 -DXMC1_SERIES + +XMC1400_XMC2GO.menu.UART.debug=PC +XMC1400_XMC2GO.menu.UART.debug.uart.selected=-DSERIAL_HOSTPC +XMC1400_XMC2GO.menu.UART.onBoard=On Board +XMC1400_XMC2GO.menu.UART.onBoard.uart.selected=-DSERIAL_ONBOARD + +XMC1400_XMC2GO.menu.LIB.NONE=None +XMC1400_XMC2GO.menu.LIB.NONE.library.selected= +XMC1400_XMC2GO.menu.LIB.NN=ARM NN Framework +XMC1400_XMC2GO.menu.LIB.NN.library.selected=-DARM_LIB_CMSIS_NN +XMC1400_XMC2GO.menu.LIB.DSP=ARM DSP +XMC1400_XMC2GO.menu.LIB.DSP.library.selected=-DARM_LIB_CMSIS_DSP +XMC1400_XMC2GO.menu.LIB.DSPNN=ARM DSP / ARM NN Framework +XMC1400_XMC2GO.menu.LIB.DSPNN.library.selected=-DARM_LIB_CMSIS_DSP -DARM_LIB_CMSIS_NN + #################################################### XMC1400_Arduino_Kit.name=XMC1400 Kit for Arduino XMC1400_Arduino_Kit.upload.tool=xmcflasher From 3af21ec9ea879638d4680aea1d5811ed007e9def Mon Sep 17 00:00:00 2001 From: zhanglinjing Date: Fri, 24 Nov 2023 17:53:10 +0100 Subject: [PATCH 03/24] investigate and chege pin setting for PWM, ADC and start to change UART --- .../config/XMC1400_XMC2GO/pins_arduino.h | 54 +++++++++++-------- 1 file changed, 31 insertions(+), 23 deletions(-) diff --git a/variants/XMC1400/config/XMC1400_XMC2GO/pins_arduino.h b/variants/XMC1400/config/XMC1400_XMC2GO/pins_arduino.h index f6823c89..89979488 100644 --- a/variants/XMC1400/config/XMC1400_XMC2GO/pins_arduino.h +++ b/variants/XMC1400/config/XMC1400_XMC2GO/pins_arduino.h @@ -74,9 +74,10 @@ extern const uint8_t NUM_ANALOG_INPUTS; // Generate 490Hz @fCCU=1MHz #define PWM4_TIMER_PERIOD (2041U) -// TODO: Verify the PCLK +// TODO: Verify the PCLK, XMC_CCU4_SLICE_PRESCALER_64 #define PCLK 64000000u +// Define SPI pin #define PIN_SPI_SS 3 #define PIN_SPI_MOSI 1 #define PIN_SPI_MISO 0 @@ -92,17 +93,22 @@ extern uint8_t SCK; /*DX0C(Input) -> P0.6*/ /*SCLKOUT(ALT6) -> P0.8*/ /*WA(ALT6) -> P0.9*/ -#define MASTER_CHANNEL XMC_I2S0_CH1 -#define MASTER_MRST PORT0, 6 -#define INPUT_SOURCE USIC0_C1_DX0_P0_6 -#define MASTER_SCLK PORT0, 8 -#define MASTER_WACLK PORT0, 9 +//TODO: XMC1400 I2S + +// #define MASTER_CHANNEL XMC_I2S0_CH1 +// #define MASTER_MRST PORT0, 6 +// #define INPUT_SOURCE USIC0_C1_DX0_P0_6 +// #define MASTER_SCLK PORT0, 8 +// #define MASTER_WACLK PORT0, 9 + +// Define analog pin #define A0 0 #define A1 1 #define A2 2 #define A3 3 +// Define LED & builtin-led #define LED1 14 #define LED2 15 #define LED_BUILTIN LED1 @@ -150,19 +156,21 @@ const uint8_t NUM_INTERRUPT = ( sizeof( mapping_interrupt ) / sizeof( XMC_PIN_IN Putting both parts in array means if a PWM4 channel gets reassigned for another function later a gap in channel numbers will not mess things up */ const uint8_t mapping_pin_PWM4[][ 2 ] = { - { 8, 0 }, - { 1, 1 }, + { 1, 0 }, + { 2, 1 }, { 3, 2 }, - { 9, 3 }, + { 8, 3 }, + { 9, 4 }, { 255, 255 } }; /* Configurations of PWM channels for CCU4 type */ XMC_PWM4_t mapping_pwm4[] = { + {CCU40, CCU40_CC41, 1, mapping_port_pin[1], P0_1_AF_CCU40_OUT1, XMC_CCU4_SLICE_PRESCALER_64, PWM4_TIMER_PERIOD, DISABLED}, // PWM disabled 1 P0.1 + {CCU40, CCU40_CC43, 3, mapping_port_pin[2], P0_3_AF_CCU40_OUT3, XMC_CCU4_SLICE_PRESCALER_64, PWM4_TIMER_PERIOD, DISABLED}, // PWM disabled 2 P0.3 + {CCU40, CCU40_CC41, 1, mapping_port_pin[3], P0_4_AF_CCU40_OUT1, XMC_CCU4_SLICE_PRESCALER_64, PWM4_TIMER_PERIOD, DISABLED}, // PWM disabled 3 P0.4 {CCU40, CCU40_CC40, 0, mapping_port_pin[8], P0_5_AF_CCU40_OUT0, XMC_CCU4_SLICE_PRESCALER_64, PWM4_TIMER_PERIOD, DISABLED}, // PWM disabled 8 P0.5 - {CCU40, CCU40_CC41, 1, mapping_port_pin[1], P0_7_AF_CCU40_OUT1, XMC_CCU4_SLICE_PRESCALER_64, PWM4_TIMER_PERIOD, DISABLED}, // PWM disabled 1 P0.7 - {CCU40, CCU40_CC42, 2, mapping_port_pin[2], P0_8_AF_CCU40_OUT2, XMC_CCU4_SLICE_PRESCALER_64, PWM4_TIMER_PERIOD, DISABLED}, // PWM disabled 2 P0.8 - {CCU40, CCU40_CC43, 3, mapping_port_pin[3], P0_9_AF_CCU40_OUT3, XMC_CCU4_SLICE_PRESCALER_64, PWM4_TIMER_PERIOD, DISABLED} // PWM disabled 3 P0.9 + {CCU41, CCU41_CC40, 3, mapping_port_pin[9], P1_4_AF_CCU41_OUT0, XMC_CCU4_SLICE_PRESCALER_64, PWM4_TIMER_PERIOD, DISABLED} // PWM disabled 9 P1.4 }; const uint8_t NUM_PWM = ( sizeof( mapping_pwm4 ) / sizeof( XMC_PWM4_t ) ); const uint8_t NUM_PWM4 = ( sizeof( mapping_pwm4 ) / sizeof( XMC_PWM4_t ) ); @@ -170,10 +178,10 @@ const uint8_t NUM_PWM4 = ( sizeof( mapping_pwm4 ) / sizeof( XMC_PWM4_t ) ); /* Analog Pin mappings and configurations */ XMC_ADC_t mapping_adc[] = { - {VADC, 1, DISABLED}, - {VADC, 2, DISABLED}, - {VADC, 3, DISABLED}, - {VADC, 4, DISABLED} + {VADC, 1, DISABLED}, // P2.8 + {VADC, 2, DISABLED}, // P2.9 + {VADC, 3, DISABLED}, // P2.10 + {VADC, 4, DISABLED} // P2.11 }; const uint8_t NUM_ANALOG_INPUTS = ( sizeof( mapping_adc ) / sizeof( XMC_ADC_t ) ); @@ -183,13 +191,13 @@ const uint8_t NUM_ANALOG_INPUTS = ( sizeof( mapping_adc ) / sizeof( XMC_ADC_t ) RingBuffer rx_buffer_0; RingBuffer tx_buffer_0; -/* First UART channel pins are swapped between debug and normal use */ +/* First UART channel pins are swapped between debug and normal use */ XMC_UART_t XMC_UART_0 = { .channel = XMC_UART0_CH0, - .rx = { .port = (XMC_GPIO_PORT_t*)PORT2_BASE, + .rx = { .port = (XMC_GPIO_PORT_t*)PORT2_BASE, // RX P2.6 #ifdef SERIAL_DEBUG - .pin = (uint8_t)2 + .pin = (uint8_t)0 #else .pin = (uint8_t)6 #endif @@ -198,9 +206,9 @@ XMC_UART_t XMC_UART_0 = .output_level = XMC_GPIO_OUTPUT_LEVEL_HIGH, .input_hysteresis = XMC_GPIO_INPUT_HYSTERESIS_STANDARD }, - .tx = { .port = (XMC_GPIO_PORT_t*)PORT2_BASE, + .tx = { .port = (XMC_GPIO_PORT_t*)PORT2_BASE, // TX P2.0 #ifdef SERIAL_DEBUG - .pin = (uint8_t)1 + .pin = (uint8_t)6 #else .pin = (uint8_t)0 #endif @@ -213,9 +221,9 @@ XMC_UART_t XMC_UART_0 = .input_source_dx1 = XMC_INPUT_INVALID, .input_source_dx2 = XMC_INPUT_INVALID, #ifdef SERIAL_DEBUG - .input_source_dx3 = (XMC_USIC_INPUT_t)USIC0_C0_DX3_P2_2, + .input_source_dx3 = (XMC_USIC_INPUT_t)USIC0_C0_DX3_P2_0, #else - .input_source_dx3 = (XMC_USIC_INPUT_t)USIC0_C0_DX3_P2_6, + .input_source_dx3 = (XMC_USIC_INPUT_t)USIC0_C0_DX4_P2_6, #endif .irq_num = USIC0_0_IRQn, .irq_service_request = 0 From 51b5b2b133b6a5be4477caaab579f47162cccf31 Mon Sep 17 00:00:00 2001 From: zhanglinjing Date: Mon, 27 Nov 2023 14:57:30 +0100 Subject: [PATCH 04/24] update flasher related parameter - add linker script for xmc1400 2Go - change the parameter according jlink --- boards.txt | 2 +- tools/xmc_data.py | 14 ++ variants/XMC1400/linker_script_64k.ld | 299 ++++++++++++++++++++++++++ 3 files changed, 314 insertions(+), 1 deletion(-) create mode 100644 variants/XMC1400/linker_script_64k.ld diff --git a/boards.txt b/boards.txt index 5469b2c6..213a8316 100644 --- a/boards.txt +++ b/boards.txt @@ -156,7 +156,7 @@ XMC1400_XMC2GO.build.f_cpu=48000000L XMC1400_XMC2GO.build.board=ARM_XMC XMC1400_XMC2GO.build.board.version=1402 XMC1400_XMC2GO.build.board.type=Q040x0064 -XMC1400_XMC2GO.build.board.v=0200 +XMC1400_XMC2GO.build.board.v=0064 XMC1400_XMC2GO.build.core=./ XMC1400_XMC2GO.build.variant=XMC1400 XMC1400_XMC2GO.build.board_variant=XMC1400_XMC2GO diff --git a/tools/xmc_data.py b/tools/xmc_data.py index 1e87c401..9b68e77b 100644 --- a/tools/xmc_data.py +++ b/tools/xmc_data.py @@ -43,6 +43,20 @@ "bitposition_LSB":"12" } }, + "XMC1402-0064":{ + "IDCHIP":{ + "addr":"40010004", + "size":"4", + "value":"00011000", + "mask":"FFFFF000" + }, + "FLSIZE":{ + "addr":"40000404", + "size": "4", + "bitposition_MSB":"17", + "bitposition_LSB":"12" + } + }, "XMC1402-0200":{ "IDCHIP":{ "addr":"40010004", diff --git a/variants/XMC1400/linker_script_64k.ld b/variants/XMC1400/linker_script_64k.ld new file mode 100644 index 00000000..b686fc03 --- /dev/null +++ b/variants/XMC1400/linker_script_64k.ld @@ -0,0 +1,299 @@ +/** + * @file XMC1400x0064.ld + * @date 2017-04-20 + * + * @cond + ********************************************************************************************************************* + * Linker file for the GNU C Compiler v1.6 + * Supported devices: XMC1402-Q040X0064 + * XMC1402-Q048X0064 + * XMC1402-Q064X0064 + * XMC1402-F064X0064 + * XMC1402-T038X0064 + * XMC1403-Q040X0064 + * XMC1403-Q048X0064 + * XMC1403-Q064X0064 + * XMC1404-Q048X0064 + * XMC1404-Q064X0064 + * XMC1404-F064X0064 + * + * Copyright (c) 2015-2020, Infineon Technologies AG + * All rights reserved. + * + * Boost Software License - Version 1.0 - August 17th, 2003 + * + * Permission is hereby granted, free of charge, to any person or organization + * obtaining a copy of the software and accompanying documentation covered by + * this license (the "Software") to use, reproduce, display, distribute, + * execute, and transmit the Software, and to prepare derivative works of the + * Software, and to permit third-parties to whom the Software is furnished to + * do so, all subject to the following: + * + * The copyright notices in the Software and this entire statement, including + * the above license grant, this restriction and the following disclaimer, + * must be included in all copies of the Software, in whole or in part, and + * all derivative works of the Software, unless such copies or derivative + * works are solely in the form of machine-executable object code generated by + * a source language processor. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT + * SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE + * FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * To improve the quality of the software, users are encouraged to share + * modifications, enhancements or bug fixes with Infineon Technologies AG + * at XMCSupport@infineon.com. + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-07-07: + * - Product splitting + * - Copyright notice update + * + * 2015-11-24: + * - Compatibility with GCC 4.9 2015q2 + * + * 2016-03-15: + * - Fixed FLASH size + * - Add assertion to check that region SRAM_combined does not overflowed no_init section + * + * 2016-06-07: + * - Add XMC1402-T038X0064, XMC1403-Q040X0064 + * + * 2016-10-28: + * - Fix linker not complaining if sum of data + text sections is bigger that physical FLASH size + * + * 2017-04-07: + * - Added new symbols __text_size and eText + * + * 2017-04-20: + * - Change vtable location to flash area to save ram + * + * @endcond + * + */ + +OUTPUT_FORMAT("elf32-littlearm") +OUTPUT_ARCH(arm) +ENTRY(Reset_Handler) + +MEMORY +{ + FLASH(RX) : ORIGIN = 0x10001000, LENGTH = 0x10000 + SRAM(!RX) : ORIGIN = 0x20000000, LENGTH = 0x4000 +} + +stack_size = DEFINED(stack_size) ? stack_size : 1024; +no_init_size = 4; + +SECTIONS +{ + /* TEXT section */ + + .text : + { + sText = .; + KEEP(*(.reset)); + *(.text .text.* .gnu.linkonce.t.*); + + /* C++ Support */ + KEEP(*(.init)) + KEEP(*(.fini)) + + /* .ctors */ + *crtbegin.o(.ctors) + *crtbegin?.o(.ctors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) + *(SORT(.ctors.*)) + *(.ctors) + + /* .dtors */ + *crtbegin.o(.dtors) + *crtbegin?.o(.dtors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) + *(SORT(.dtors.*)) + *(.dtors) + + *(.rodata .rodata.*) + *(.gnu.linkonce.r*) + + *(vtable) + + . = ALIGN(4); + } > FLASH + + .eh_frame_hdr : ALIGN (4) + { + KEEP (*(.eh_frame_hdr)) + } > FLASH + + .eh_frame : ALIGN (4) + { + KEEP (*(.eh_frame)) + } > FLASH + + /* Exception handling, exidx needs a dedicated section */ + .ARM.extab : ALIGN(4) + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } > FLASH + + . = ALIGN(4); + __exidx_start = .; + .ARM.exidx : ALIGN(4) + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > FLASH + __exidx_end = .; + . = ALIGN(4); + + /* DSRAM layout (Lowest to highest)*/ + /* Veneer <-> Stack <-> DATA <-> BSS <-> HEAP */ + + .VENEER_Code ABSOLUTE(0x2000000C): + { + . = ALIGN(4); /* section size must be multiply of 4. See startup.S file */ + VeneerStart = .; + KEEP(*(.XmcVeneerCode)); + . = ALIGN(4); /* section size must be multiply of 4. See startup.S file */ + VeneerEnd = .; + } > SRAM AT > FLASH + eROData = LOADADDR (.VENEER_Code); + VeneerSize = ABSOLUTE(VeneerEnd) - ABSOLUTE(VeneerStart); + + /* Dummy section for stack */ + Stack (NOLOAD) : AT(0) + { + . = ALIGN(8); + . = . + stack_size; + __initial_sp = .; + } > SRAM + + /* Standard DATA and user defined DATA/BSS/CONST sections */ + .data : + { + . = ALIGN(4); /* section size must be multiply of 4. See startup.S file */ + __data_start = .; + * (.data); + * (.data*); + *(*.data); + *(.gnu.linkonce.d*) + + . = ALIGN(4); + /* preinit data */ + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP(*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + + . = ALIGN(4); + /* init data */ + PROVIDE_HIDDEN (__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + + + . = ALIGN(4); + /* finit data */ + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP(*(SORT(.fini_array.*))) + KEEP(*(.fini_array)) + PROVIDE_HIDDEN (__fini_array_end = .); + + . = ALIGN(4); /* section size must be multiply of 4. See startup.S file */ + __data_end = .; + } > SRAM AT > FLASH + DataLoadAddr = LOADADDR (.data); + __data_size = __data_end - __data_start; + + .ram_code : + { + . = ALIGN(4); /* section size must be multiply of 4. See startup.S file */ + __ram_code_start = .; + /* functions with __attribute__ ((section (".ram_code")))*/ + *(.ram_code) + . = ALIGN(4); /* section size must be multiply of 4. See startup.S file */ + __ram_code_end = .; + } > SRAM AT > FLASH + __ram_code_load = LOADADDR (.ram_code); + __ram_code_size = __ram_code_end - __ram_code_start; + + __text_size = (__exidx_end - sText) + VeneerSize + __data_size + __ram_code_size; + eText = sText + __text_size; + + /* BSS section */ + .bss (NOLOAD) : + { + . = ALIGN(4); /* section size must be multiply of 4. See startup.S file */ + __bss_start = .; + * (.bss); + * (.bss*); + * (COMMON); + *(.gnu.linkonce.b*) + . = ALIGN(4); /* section size must be multiply of 4. See startup.S file */ + __bss_end = .; + . = ALIGN(8); + Heap_Bank1_Start = .; + } > SRAM + __bss_size = __bss_end - __bss_start; + + /* .no_init section contains SystemCoreClock. See system.c file */ + .no_init ORIGIN(SRAM) + LENGTH(SRAM) - no_init_size (NOLOAD) : + { + Heap_Bank1_End = .; + * (.no_init); + } > SRAM + + /* Heap - Bank1*/ + Heap_Bank1_Size = Heap_Bank1_End - Heap_Bank1_Start; + + ASSERT(Heap_Bank1_Start <= Heap_Bank1_End, "region SRAM overflowed no_init section") + + /DISCARD/ : + { + *(.comment) + } + + .stab 0 (NOLOAD) : { *(.stab) } + .stabstr 0 (NOLOAD) : { *(.stabstr) } + + /* DWARF 1 */ + .debug 0 : { *(.debug) } + .line 0 : { *(.line) } + + /* GNU DWARF 1 extensions */ + .debug_srcinfo 0 : { *(.debug_srcinfo) } + .debug_sfnames 0 : { *(.debug_sfnames) } + + /* DWARF 1.1 and DWARF 2 */ + .debug_aranges 0 : { *(.debug_aranges) } + .debug_pubnames 0 : { *(.debug_pubnames) } + .debug_pubtypes 0 : { *(.debug_pubtypes) } + + /* DWARF 2 */ + .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } + .debug_abbrev 0 : { *(.debug_abbrev) } + .debug_line 0 : { *(.debug_line) } + .debug_frame 0 : { *(.debug_frame) } + .debug_str 0 : { *(.debug_str) } + .debug_loc 0 : { *(.debug_loc) } + .debug_macinfo 0 : { *(.debug_macinfo) } + + /* DWARF 2.1 */ + .debug_ranges 0 : { *(.debug_ranges) } + + /* SGI/MIPS DWARF 2 extensions */ + .debug_weaknames 0 : { *(.debug_weaknames) } + .debug_funcnames 0 : { *(.debug_funcnames) } + .debug_typenames 0 : { *(.debug_typenames) } + .debug_varnames 0 : { *(.debug_varnames) } + + /* Build attributes */ + .build_attributes 0 : { *(.ARM.attributes) } +} From ae376a4b0f341882af2fdc7fb1f33c9c1b24ea30 Mon Sep 17 00:00:00 2001 From: zhanglinjing Date: Mon, 27 Nov 2023 16:06:49 +0100 Subject: [PATCH 05/24] - add xmc1400 2Go to index json - update interrupt case --- cores/WInterrupts.c | 2 +- package/package_infineon_index.template.json | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/cores/WInterrupts.c b/cores/WInterrupts.c index c18e1b49..906a0d00 100644 --- a/cores/WInterrupts.c +++ b/cores/WInterrupts.c @@ -157,7 +157,7 @@ void attachInterrupt(uint32_t interrupt_num, interrupt_cb_t callback, uint32_t m if (pin_irq.irq_num == 0) { -#if defined(XMC1100_Boot_Kit) || defined(XMC1400_Arduino_Kit) +#if defined(XMC1100_Boot_Kit) || defined(XMC1400_Arduino_Kit) || defined(XMC1400_XMC2GO) /* P1_4 external interrupt goes through USIC to CCU4 */ XMC_USIC_CH_Enable(XMC_USIC0_CH0); XMC_USIC_CH_SetInputSource(XMC_USIC0_CH0, XMC_USIC_CH_INPUT_DX5, USIC0_C0_DX5_P1_4); diff --git a/package/package_infineon_index.template.json b/package/package_infineon_index.template.json index 7f7b15ac..631d213e 100644 --- a/package/package_infineon_index.template.json +++ b/package/package_infineon_index.template.json @@ -34,6 +34,9 @@ { "name":"XMC1400 Kit for Arduino" }, + { + "name":"XMC1400 XMC2Go" + }, { "name":"XMC4200 Platform 2Go" }, From 4748bb2c8439de5ab94eb45077ef4cc9a07c86dc Mon Sep 17 00:00:00 2001 From: zhanglinjing Date: Wed, 29 Nov 2023 15:15:03 +0100 Subject: [PATCH 06/24] delete unnecessary define --- variants/XMC1400/config/XMC1400_XMC2GO/pins_arduino.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/variants/XMC1400/config/XMC1400_XMC2GO/pins_arduino.h b/variants/XMC1400/config/XMC1400_XMC2GO/pins_arduino.h index 89979488..11e8e502 100644 --- a/variants/XMC1400/config/XMC1400_XMC2GO/pins_arduino.h +++ b/variants/XMC1400/config/XMC1400_XMC2GO/pins_arduino.h @@ -115,8 +115,6 @@ extern uint8_t SCK; #define digitalPinToInterrupt(p) (((p) == 9) ? 0 : NOT_AN_INTERRUPT) -#define ARDUINO_MAIN - #ifdef ARDUINO_MAIN // Mapping of digital pins and comments const XMC_PORT_PIN_t mapping_port_pin[] = From f0ffd43ac0e6ce8d6a83f5f66f6fec65cfb7dfd4 Mon Sep 17 00:00:00 2001 From: zhanglinjing Date: Wed, 29 Nov 2023 15:25:10 +0100 Subject: [PATCH 07/24] update .yml for test build --- .github/workflows/compile-platform-examples.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/compile-platform-examples.yml b/.github/workflows/compile-platform-examples.yml index ab9d6010..95f4ae22 100644 --- a/.github/workflows/compile-platform-examples.yml +++ b/.github/workflows/compile-platform-examples.yml @@ -92,6 +92,15 @@ jobs: multiSerial: true dma: true alarmRtc: true + - fqbn: Infineon:xmc:XMC1400_XMC2GO + i2s: true + dieTemp: true + heapMem: true + sleep1100: true + sleep4700 : false + stackMem: true + dma: false + alarmRtc: false - fqbn: Infineon:xmc:XMC1400_Arduino_Kit i2s: false dieTemp: true From 0911b936d15100bfd7305378ead31e9fc0671671 Mon Sep 17 00:00:00 2001 From: zhanglinjing Date: Wed, 29 Nov 2023 16:42:44 +0100 Subject: [PATCH 08/24] update UART configuration and Interrupt --- .../config/XMC1400_XMC2GO/pins_arduino.h | 29 +++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/variants/XMC1400/config/XMC1400_XMC2GO/pins_arduino.h b/variants/XMC1400/config/XMC1400_XMC2GO/pins_arduino.h index 11e8e502..b963daff 100644 --- a/variants/XMC1400/config/XMC1400_XMC2GO/pins_arduino.h +++ b/variants/XMC1400/config/XMC1400_XMC2GO/pins_arduino.h @@ -113,6 +113,31 @@ extern uint8_t SCK; #define LED2 15 #define LED_BUILTIN LED1 +// TODO: check Interrupt +/* Mapping interrupt handlers. Notice that XMC1400 can have interrupt handlers working in 3 modes, the defines below assumes the mode A. + For details refer to assembly file and reference manual. +*/ +#define USIC0_0_IRQHandler IRQ9_Handler // UART +#define USIC0_0_IRQn IRQ9_IRQn + +#define CCU40_0_IRQHandler IRQ21_Handler // interrupt 1 +#define CCU40_0_IRQn IRQ21_IRQn + +#define CCU40_1_IRQHandler IRQ22_Handler // interrupt 0 +#define CCU40_1_IRQn IRQ22_IRQn + +#define USIC0_4_IRQHandler IRQ13_Handler // I2C +#define USIC0_4_IRQn IRQ13_IRQn + +#define USIC0_5_IRQHandler IRQ14_Handler // I2C +#define USIC0_5_IRQn IRQ14_IRQn + +#define SCU_1_IRQHandler IRQ1_Handler //RTC +#define SCU_1_IRQn IRQ1_IRQn + +#define ERU0_0_IRQHandler IRQ3_Handler // RESET +#define ERU0_0_IRQn IRQ3_IRQn + #define digitalPinToInterrupt(p) (((p) == 9) ? 0 : NOT_AN_INTERRUPT) #ifdef ARDUINO_MAIN @@ -219,9 +244,9 @@ XMC_UART_t XMC_UART_0 = .input_source_dx1 = XMC_INPUT_INVALID, .input_source_dx2 = XMC_INPUT_INVALID, #ifdef SERIAL_DEBUG - .input_source_dx3 = (XMC_USIC_INPUT_t)USIC0_C0_DX3_P2_0, + .input_source_dx3 = (XMC_USIC_INPUT_t)USIC0_C0_DX0_P2_0, #else - .input_source_dx3 = (XMC_USIC_INPUT_t)USIC0_C0_DX4_P2_6, + .input_source_dx3 = (XMC_USIC_INPUT_t)USIC0_C0_DX3_P2_6, #endif .irq_num = USIC0_0_IRQn, .irq_service_request = 0 From 0bf959a719717654dd57702893c106fe6b1e56ca Mon Sep 17 00:00:00 2001 From: zhanglinjing Date: Wed, 29 Nov 2023 17:12:50 +0100 Subject: [PATCH 09/24] update SPI configuration --- .../config/XMC1400_XMC2GO/pins_arduino.h | 238 +++++++++--------- 1 file changed, 119 insertions(+), 119 deletions(-) diff --git a/variants/XMC1400/config/XMC1400_XMC2GO/pins_arduino.h b/variants/XMC1400/config/XMC1400_XMC2GO/pins_arduino.h index b963daff..d1f34a72 100644 --- a/variants/XMC1400/config/XMC1400_XMC2GO/pins_arduino.h +++ b/variants/XMC1400/config/XMC1400_XMC2GO/pins_arduino.h @@ -120,23 +120,21 @@ extern uint8_t SCK; #define USIC0_0_IRQHandler IRQ9_Handler // UART #define USIC0_0_IRQn IRQ9_IRQn -#define CCU40_0_IRQHandler IRQ21_Handler // interrupt 1 +#define CCU40_0_IRQHandler IRQ21_Handler // interrupt 0 #define CCU40_0_IRQn IRQ21_IRQn -#define CCU40_1_IRQHandler IRQ22_Handler // interrupt 0 -#define CCU40_1_IRQn IRQ22_IRQn -#define USIC0_4_IRQHandler IRQ13_Handler // I2C -#define USIC0_4_IRQn IRQ13_IRQn +// #define USIC0_4_IRQHandler IRQ13_Handler // I2C +// #define USIC0_4_IRQn IRQ13_IRQn -#define USIC0_5_IRQHandler IRQ14_Handler // I2C -#define USIC0_5_IRQn IRQ14_IRQn +// #define USIC0_5_IRQHandler IRQ14_Handler // I2C +// #define USIC0_5_IRQn IRQ14_IRQn -#define SCU_1_IRQHandler IRQ1_Handler //RTC -#define SCU_1_IRQn IRQ1_IRQn +// #define SCU_1_IRQHandler IRQ1_Handler //RTC +// #define SCU_1_IRQn IRQ1_IRQn -#define ERU0_0_IRQHandler IRQ3_Handler // RESET -#define ERU0_0_IRQn IRQ3_IRQn +// #define ERU0_0_IRQHandler IRQ3_Handler // RESET +// #define ERU0_0_IRQn IRQ3_IRQn #define digitalPinToInterrupt(p) (((p) == 9) ? 0 : NOT_AN_INTERRUPT) @@ -257,130 +255,132 @@ HardwareSerial Serial( &XMC_UART_0, &rx_buffer_0, &tx_buffer_0 ); // SPI instance XMC_SPI_t XMC_SPI_0 = { - .channel = XMC_SPI0_CH1, - .channel_config = { - .baudrate = 15984375U, - .bus_mode = (XMC_SPI_CH_BUS_MODE_t)XMC_SPI_CH_BUS_MODE_MASTER, - .selo_inversion = XMC_SPI_CH_SLAVE_SEL_INV_TO_MSLS, - .parity_mode = XMC_USIC_CH_PARITY_MODE_NONE - }, - .mosi = { - .port = (XMC_GPIO_PORT_t*)PORT0_BASE, - .pin = (uint8_t)7 - }, - .mosi_config = { - .mode = XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT7, - .output_level = XMC_GPIO_OUTPUT_LEVEL_HIGH, - .input_hysteresis = XMC_GPIO_INPUT_HYSTERESIS_STANDARD - }, - .miso = { - .port = (XMC_GPIO_PORT_t*)PORT0_BASE, - .pin = (uint8_t)6 - }, - .miso_config = { - .mode = XMC_GPIO_MODE_INPUT_TRISTATE, - .input_hysteresis = XMC_GPIO_INPUT_HYSTERESIS_STANDARD - }, - .input_source = XMC_INPUT_C, - .sclkout = { - .port = (XMC_GPIO_PORT_t*)PORT0_BASE, - .pin = (uint8_t)8 - }, - .sclkout_config = { - .mode = XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT7, - .output_level = XMC_GPIO_OUTPUT_LEVEL_HIGH, - .input_hysteresis = XMC_GPIO_INPUT_HYSTERESIS_STANDARD - } -}; - -// Two I2C instances possible -XMC_I2C_t XMC_I2C_0 = -{ - .channel = XMC_I2C0_CH1, + .channel = XMC_SPI1_CH1, .channel_config = { - .baudrate = (uint32_t)(100000U), - .address = 0U - }, - .sda = { - .port = (XMC_GPIO_PORT_t*)PORT2_BASE, - .pin = (uint8_t)10 - }, - .sda_config = { - .mode = XMC_GPIO_MODE_OUTPUT_OPEN_DRAIN_ALT7, - .output_level = XMC_GPIO_OUTPUT_LEVEL_HIGH, - .input_hysteresis = XMC_GPIO_INPUT_HYSTERESIS_STANDARD + .baudrate = 15984375U, + .bus_mode = (XMC_SPI_CH_BUS_MODE_t)XMC_SPI_CH_BUS_MODE_MASTER, + .selo_inversion = XMC_SPI_CH_SLAVE_SEL_INV_TO_MSLS, + .parity_mode = XMC_USIC_CH_PARITY_MODE_NONE }, - .scl = { - .port = (XMC_GPIO_PORT_t*)PORT2_BASE, - .pin = (uint8_t)11 + .mosi = { + .port = (XMC_GPIO_PORT_t*)PORT0_BASE, + .pin = (uint8_t)1 }, - .scl_config = { - .mode = XMC_GPIO_MODE_OUTPUT_OPEN_DRAIN_ALT6, + .mosi_config = { + .mode = XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT9, .output_level = XMC_GPIO_OUTPUT_LEVEL_HIGH, .input_hysteresis = XMC_GPIO_INPUT_HYSTERESIS_STANDARD }, - .input_source_dx0 = XMC_INPUT_F, - .input_source_dx1 = XMC_INPUT_E, - .slave_receive_irq_num = (IRQn_Type) USIC0_4_IRQn, - .slave_receive_irq_service_request = 4 , - .protocol_irq_num = (IRQn_Type) USIC0_5_IRQn, - .protocol_irq_service_request = 5 -}; - -XMC_I2C_t XMC_I2C_1 = -{ - .channel = XMC_I2C0_CH0, - .channel_config = { - .baudrate = (uint32_t)(100000U), - .address = 0U - }, - .sda = { + .miso = { .port = (XMC_GPIO_PORT_t*)PORT0_BASE, - .pin = (uint8_t)15 + .pin = (uint8_t)0 }, - .sda_config = { - .mode = XMC_GPIO_MODE_OUTPUT_OPEN_DRAIN_ALT6, - .output_level = XMC_GPIO_OUTPUT_LEVEL_HIGH, + .miso_config = { + .mode = XMC_GPIO_MODE_INPUT_TRISTATE, .input_hysteresis = XMC_GPIO_INPUT_HYSTERESIS_STANDARD }, - .scl = { + .input_source = XMC_INPUT_A, + .sclkout = { .port = (XMC_GPIO_PORT_t*)PORT0_BASE, - .pin = (uint8_t)14 + .pin = (uint8_t)3 }, - .scl_config = { - .mode = XMC_GPIO_MODE_OUTPUT_OPEN_DRAIN_ALT7, + .sclkout_config = { + .mode = XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT8, .output_level = XMC_GPIO_OUTPUT_LEVEL_HIGH, .input_hysteresis = XMC_GPIO_INPUT_HYSTERESIS_STANDARD - }, - .input_source_dx0 = XMC_INPUT_B, - .input_source_dx1 = XMC_INPUT_A, - .slave_receive_irq_num = (IRQn_Type) USIC0_2_IRQn, - .slave_receive_irq_service_request = 2 , - .protocol_irq_num = (IRQn_Type) USIC0_3_IRQn, - .protocol_irq_service_request = 3 + } }; -// XMC_I2S instance -XMC_I2S_t i2s_config = -{ - .input_config = { - .mode = XMC_GPIO_MODE_INPUT_TRISTATE, - .output_level = XMC_GPIO_OUTPUT_LEVEL_HIGH, - .input_hysteresis = XMC_GPIO_INPUT_HYSTERESIS_STANDARD - }, - .sclk_config = { - .mode = XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT7, - .output_level = XMC_GPIO_OUTPUT_LEVEL_HIGH, - .input_hysteresis = XMC_GPIO_INPUT_HYSTERESIS_STANDARD - }, - .wa_config = { - .mode = XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT7, - .output_level = XMC_GPIO_OUTPUT_LEVEL_HIGH, - .input_hysteresis = XMC_GPIO_INPUT_HYSTERESIS_STANDARD - }, - .protocol_irq_num = (IRQn_Type) USIC0_2_IRQn, - .protocol_irq_service_request = 2 -}; + +// TODO: I2S +// // Two I2C instances possible +// XMC_I2C_t XMC_I2C_0 = +// { +// .channel = XMC_I2C0_CH1, +// .channel_config = { +// .baudrate = (uint32_t)(100000U), +// .address = 0U +// }, +// .sda = { +// .port = (XMC_GPIO_PORT_t*)PORT2_BASE, +// .pin = (uint8_t)10 +// }, +// .sda_config = { +// .mode = XMC_GPIO_MODE_OUTPUT_OPEN_DRAIN_ALT7, +// .output_level = XMC_GPIO_OUTPUT_LEVEL_HIGH, +// .input_hysteresis = XMC_GPIO_INPUT_HYSTERESIS_STANDARD +// }, +// .scl = { +// .port = (XMC_GPIO_PORT_t*)PORT2_BASE, +// .pin = (uint8_t)11 +// }, +// .scl_config = { +// .mode = XMC_GPIO_MODE_OUTPUT_OPEN_DRAIN_ALT6, +// .output_level = XMC_GPIO_OUTPUT_LEVEL_HIGH, +// .input_hysteresis = XMC_GPIO_INPUT_HYSTERESIS_STANDARD +// }, +// .input_source_dx0 = XMC_INPUT_F, +// .input_source_dx1 = XMC_INPUT_E, +// .slave_receive_irq_num = (IRQn_Type) USIC0_4_IRQn, +// .slave_receive_irq_service_request = 4 , +// .protocol_irq_num = (IRQn_Type) USIC0_5_IRQn, +// .protocol_irq_service_request = 5 +// }; + +// XMC_I2C_t XMC_I2C_1 = +// { +// .channel = XMC_I2C0_CH0, +// .channel_config = { +// .baudrate = (uint32_t)(100000U), +// .address = 0U +// }, +// .sda = { +// .port = (XMC_GPIO_PORT_t*)PORT0_BASE, +// .pin = (uint8_t)15 +// }, +// .sda_config = { +// .mode = XMC_GPIO_MODE_OUTPUT_OPEN_DRAIN_ALT6, +// .output_level = XMC_GPIO_OUTPUT_LEVEL_HIGH, +// .input_hysteresis = XMC_GPIO_INPUT_HYSTERESIS_STANDARD +// }, +// .scl = { +// .port = (XMC_GPIO_PORT_t*)PORT0_BASE, +// .pin = (uint8_t)14 +// }, +// .scl_config = { +// .mode = XMC_GPIO_MODE_OUTPUT_OPEN_DRAIN_ALT7, +// .output_level = XMC_GPIO_OUTPUT_LEVEL_HIGH, +// .input_hysteresis = XMC_GPIO_INPUT_HYSTERESIS_STANDARD +// }, +// .input_source_dx0 = XMC_INPUT_B, +// .input_source_dx1 = XMC_INPUT_A, +// .slave_receive_irq_num = (IRQn_Type) USIC0_2_IRQn, +// .slave_receive_irq_service_request = 2 , +// .protocol_irq_num = (IRQn_Type) USIC0_3_IRQn, +// .protocol_irq_service_request = 3 +// }; + +// // XMC_I2S instance +// XMC_I2S_t i2s_config = +// { +// .input_config = { +// .mode = XMC_GPIO_MODE_INPUT_TRISTATE, +// .output_level = XMC_GPIO_OUTPUT_LEVEL_HIGH, +// .input_hysteresis = XMC_GPIO_INPUT_HYSTERESIS_STANDARD +// }, +// .sclk_config = { +// .mode = XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT7, +// .output_level = XMC_GPIO_OUTPUT_LEVEL_HIGH, +// .input_hysteresis = XMC_GPIO_INPUT_HYSTERESIS_STANDARD +// }, +// .wa_config = { +// .mode = XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT7, +// .output_level = XMC_GPIO_OUTPUT_LEVEL_HIGH, +// .input_hysteresis = XMC_GPIO_INPUT_HYSTERESIS_STANDARD +// }, +// .protocol_irq_num = (IRQn_Type) USIC0_2_IRQn, +// .protocol_irq_service_request = 2 +// }; // Serial Interrupt and event handling #ifdef __cplusplus From be9c58739f6a2739dfebd1a4db7d26a8fc5699cf Mon Sep 17 00:00:00 2001 From: zhanglinjing Date: Wed, 29 Nov 2023 17:52:18 +0100 Subject: [PATCH 10/24] add a macro for compilation --- variants/XMC1400/config/XMC1400_XMC2GO/pins_arduino.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/variants/XMC1400/config/XMC1400_XMC2GO/pins_arduino.h b/variants/XMC1400/config/XMC1400_XMC2GO/pins_arduino.h index d1f34a72..6a2b12b2 100644 --- a/variants/XMC1400/config/XMC1400_XMC2GO/pins_arduino.h +++ b/variants/XMC1400/config/XMC1400_XMC2GO/pins_arduino.h @@ -123,6 +123,8 @@ extern uint8_t SCK; #define CCU40_0_IRQHandler IRQ21_Handler // interrupt 0 #define CCU40_0_IRQn IRQ21_IRQn +#define CCU40_1_IRQHandler IRQ22_Handler // interrupt x, placeholder +#define CCU40_1_IRQn IRQ22_IRQn // #define USIC0_4_IRQHandler IRQ13_Handler // I2C // #define USIC0_4_IRQn IRQ13_IRQn From 843c1a55b30826c3a71c1bbaa9aa839e3828c7ed Mon Sep 17 00:00:00 2001 From: zhanglinjing Date: Thu, 30 Nov 2023 13:48:15 +0100 Subject: [PATCH 11/24] Add I2C config and interrupts --- .../config/XMC1400_XMC2GO/pins_arduino.h | 91 +++++++++---------- 1 file changed, 43 insertions(+), 48 deletions(-) diff --git a/variants/XMC1400/config/XMC1400_XMC2GO/pins_arduino.h b/variants/XMC1400/config/XMC1400_XMC2GO/pins_arduino.h index 6a2b12b2..bb7e8e90 100644 --- a/variants/XMC1400/config/XMC1400_XMC2GO/pins_arduino.h +++ b/variants/XMC1400/config/XMC1400_XMC2GO/pins_arduino.h @@ -54,7 +54,7 @@ extern const uint8_t NUM_ANALOG_INPUTS; #define NUM_TONE_PINS 4 #define NUM_TASKS_VARIANT 8 #define NUM_SPI 1 -#define NUM_I2C 2 +#define NUM_I2C 1 // Indicate unit has RTC/Alarm #define HAS_RTC 1 @@ -83,11 +83,6 @@ extern const uint8_t NUM_ANALOG_INPUTS; #define PIN_SPI_MISO 0 #define PIN_SPI_SCK 2 -extern uint8_t SS; -extern uint8_t MOSI; -extern uint8_t MISO; -extern uint8_t SCK; - // XMC_I2S defines /*U0C1*/ /*DX0C(Input) -> P0.6*/ @@ -126,17 +121,17 @@ extern uint8_t SCK; #define CCU40_1_IRQHandler IRQ22_Handler // interrupt x, placeholder #define CCU40_1_IRQn IRQ22_IRQn -// #define USIC0_4_IRQHandler IRQ13_Handler // I2C -// #define USIC0_4_IRQn IRQ13_IRQn +#define USIC0_4_IRQHandler IRQ13_Handler // I2C +#define USIC0_4_IRQn IRQ13_IRQn -// #define USIC0_5_IRQHandler IRQ14_Handler // I2C -// #define USIC0_5_IRQn IRQ14_IRQn +#define USIC0_5_IRQHandler IRQ14_Handler // I2C +#define USIC0_5_IRQn IRQ14_IRQn -// #define SCU_1_IRQHandler IRQ1_Handler //RTC -// #define SCU_1_IRQn IRQ1_IRQn +#define SCU_1_IRQHandler IRQ1_Handler //RTC +#define SCU_1_IRQn IRQ1_IRQn -// #define ERU0_0_IRQHandler IRQ3_Handler // RESET -// #define ERU0_0_IRQn IRQ3_IRQn +#define ERU0_0_IRQHandler IRQ3_Handler // RESET +#define ERU0_0_IRQn IRQ3_IRQn #define digitalPinToInterrupt(p) (((p) == 9) ? 0 : NOT_AN_INTERRUPT) @@ -295,39 +290,39 @@ XMC_SPI_t XMC_SPI_0 = // TODO: I2S -// // Two I2C instances possible -// XMC_I2C_t XMC_I2C_0 = -// { -// .channel = XMC_I2C0_CH1, -// .channel_config = { -// .baudrate = (uint32_t)(100000U), -// .address = 0U -// }, -// .sda = { -// .port = (XMC_GPIO_PORT_t*)PORT2_BASE, -// .pin = (uint8_t)10 -// }, -// .sda_config = { -// .mode = XMC_GPIO_MODE_OUTPUT_OPEN_DRAIN_ALT7, -// .output_level = XMC_GPIO_OUTPUT_LEVEL_HIGH, -// .input_hysteresis = XMC_GPIO_INPUT_HYSTERESIS_STANDARD -// }, -// .scl = { -// .port = (XMC_GPIO_PORT_t*)PORT2_BASE, -// .pin = (uint8_t)11 -// }, -// .scl_config = { -// .mode = XMC_GPIO_MODE_OUTPUT_OPEN_DRAIN_ALT6, -// .output_level = XMC_GPIO_OUTPUT_LEVEL_HIGH, -// .input_hysteresis = XMC_GPIO_INPUT_HYSTERESIS_STANDARD -// }, -// .input_source_dx0 = XMC_INPUT_F, -// .input_source_dx1 = XMC_INPUT_E, -// .slave_receive_irq_num = (IRQn_Type) USIC0_4_IRQn, -// .slave_receive_irq_service_request = 4 , -// .protocol_irq_num = (IRQn_Type) USIC0_5_IRQn, -// .protocol_irq_service_request = 5 -// }; +// Two I2C instances possible +XMC_I2C_t XMC_I2C_0 = +{ + .channel = XMC_I2C0_CH1, + .channel_config = { + .baudrate = (uint32_t)(100000U), + .address = 0U + }, + .sda = { + .port = (XMC_GPIO_PORT_t*)PORT2_BASE, + .pin = (uint8_t)10 + }, + .sda_config = { + .mode = XMC_GPIO_MODE_OUTPUT_OPEN_DRAIN_ALT7, + .output_level = XMC_GPIO_OUTPUT_LEVEL_HIGH, + .input_hysteresis = XMC_GPIO_INPUT_HYSTERESIS_STANDARD + }, + .scl = { + .port = (XMC_GPIO_PORT_t*)PORT2_BASE, + .pin = (uint8_t)11 + }, + .scl_config = { + .mode = XMC_GPIO_MODE_OUTPUT_OPEN_DRAIN_ALT6, + .output_level = XMC_GPIO_OUTPUT_LEVEL_HIGH, + .input_hysteresis = XMC_GPIO_INPUT_HYSTERESIS_STANDARD + }, + .input_source_dx0 = XMC_INPUT_F, + .input_source_dx1 = XMC_INPUT_E, + .slave_receive_irq_num = (IRQn_Type) USIC0_4_IRQn, + .slave_receive_irq_service_request = 4 , + .protocol_irq_num = (IRQn_Type) USIC0_5_IRQn, + .protocol_irq_service_request = 5 +}; // XMC_I2C_t XMC_I2C_1 = // { @@ -362,7 +357,7 @@ XMC_SPI_t XMC_SPI_0 = // .protocol_irq_service_request = 3 // }; -// // XMC_I2S instance +// XMC_I2S instance // XMC_I2S_t i2s_config = // { // .input_config = { From df5927e13185deace783e408b217252feff2033d Mon Sep 17 00:00:00 2001 From: zhanglinjing Date: Thu, 30 Nov 2023 15:16:24 +0100 Subject: [PATCH 12/24] delete empty space --- boards.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boards.txt b/boards.txt index 213a8316..a58e4e98 100644 --- a/boards.txt +++ b/boards.txt @@ -135,7 +135,7 @@ XMC1300_Boot_Kit.menu.LIB.DSPNN=ARM DSP / ARM NN Framework XMC1300_Boot_Kit.menu.LIB.DSPNN.library.selected=-DARM_LIB_CMSIS_DSP -DARM_LIB_CMSIS_NN #################################################### -XMC1400_XMC2GO.name=XMC 1400 XMC2GO +XMC1400_XMC2GO.name=XMC1400 XMC2GO XMC1400_XMC2GO.upload.tool=xmcflasher XMC1400_XMC2GO.upload.speed=115200 XMC1400_XMC2GO.upload.resetmethod=ck From bd7a7b87dd9afd02520419e0282073c2ba6e03ed Mon Sep 17 00:00:00 2001 From: zhanglinjing Date: Thu, 30 Nov 2023 15:35:20 +0100 Subject: [PATCH 13/24] add I2S config --- .../config/XMC1400_XMC2GO/pins_arduino.h | 106 +++++++----------- 1 file changed, 38 insertions(+), 68 deletions(-) diff --git a/variants/XMC1400/config/XMC1400_XMC2GO/pins_arduino.h b/variants/XMC1400/config/XMC1400_XMC2GO/pins_arduino.h index bb7e8e90..155087ad 100644 --- a/variants/XMC1400/config/XMC1400_XMC2GO/pins_arduino.h +++ b/variants/XMC1400/config/XMC1400_XMC2GO/pins_arduino.h @@ -51,7 +51,7 @@ extern const uint8_t NUM_INTERRUPT; extern const uint8_t NUM_ANALOG_INPUTS; #define NUM_LEDS 2 #define NUM_SERIAL 1 -#define NUM_TONE_PINS 4 +#define NUM_TONE_PINS 4 // PWM Pins #define NUM_TASKS_VARIANT 8 #define NUM_SPI 1 #define NUM_I2C 1 @@ -83,20 +83,6 @@ extern const uint8_t NUM_ANALOG_INPUTS; #define PIN_SPI_MISO 0 #define PIN_SPI_SCK 2 -// XMC_I2S defines -/*U0C1*/ -/*DX0C(Input) -> P0.6*/ -/*SCLKOUT(ALT6) -> P0.8*/ -/*WA(ALT6) -> P0.9*/ - -//TODO: XMC1400 I2S - -// #define MASTER_CHANNEL XMC_I2S0_CH1 -// #define MASTER_MRST PORT0, 6 -// #define INPUT_SOURCE USIC0_C1_DX0_P0_6 -// #define MASTER_SCLK PORT0, 8 -// #define MASTER_WACLK PORT0, 9 - // Define analog pin #define A0 0 #define A1 1 @@ -127,6 +113,9 @@ extern const uint8_t NUM_ANALOG_INPUTS; #define USIC0_5_IRQHandler IRQ14_Handler // I2C #define USIC0_5_IRQn IRQ14_IRQn +#define USIC1_2_IRQHandler IRQ11_Handler // I2S +#define USIC1_2_IRQn IRQ11_IRQn + #define SCU_1_IRQHandler IRQ1_Handler //RTC #define SCU_1_IRQn IRQ1_IRQn @@ -148,7 +137,7 @@ const XMC_PORT_PIN_t mapping_port_pin[] = /* 6 */ {XMC_GPIO_PORT2, 0}, // TX P2.0 /* 7 */ {XMC_GPIO_PORT2, 6}, // RX P2.6 (INPUT ONLY) /* 8 */ {XMC_GPIO_PORT0, 5}, // PWM40-0 output P0.5 - /* 9 */ {XMC_GPIO_PORT1, 4}, // External interrupt 0 / PWM41-0 output P1.4 + /* 9 */ {XMC_GPIO_PORT1, 4}, // External interrupt 0 P1.4 /* 10 */ {XMC_GPIO_PORT2, 11}, // I2C Clock SCL / A3 ADC P2.11 /* 11 */ {XMC_GPIO_PORT2, 10}, // I2C Data / A2 ADC P2.10 /* 12 */ {XMC_GPIO_PORT2, 9}, // A1 / ADC Input P2.9 (INPUT ONLY) @@ -324,60 +313,41 @@ XMC_I2C_t XMC_I2C_0 = .protocol_irq_service_request = 5 }; -// XMC_I2C_t XMC_I2C_1 = -// { -// .channel = XMC_I2C0_CH0, -// .channel_config = { -// .baudrate = (uint32_t)(100000U), -// .address = 0U -// }, -// .sda = { -// .port = (XMC_GPIO_PORT_t*)PORT0_BASE, -// .pin = (uint8_t)15 -// }, -// .sda_config = { -// .mode = XMC_GPIO_MODE_OUTPUT_OPEN_DRAIN_ALT6, -// .output_level = XMC_GPIO_OUTPUT_LEVEL_HIGH, -// .input_hysteresis = XMC_GPIO_INPUT_HYSTERESIS_STANDARD -// }, -// .scl = { -// .port = (XMC_GPIO_PORT_t*)PORT0_BASE, -// .pin = (uint8_t)14 -// }, -// .scl_config = { -// .mode = XMC_GPIO_MODE_OUTPUT_OPEN_DRAIN_ALT7, -// .output_level = XMC_GPIO_OUTPUT_LEVEL_HIGH, -// .input_hysteresis = XMC_GPIO_INPUT_HYSTERESIS_STANDARD -// }, -// .input_source_dx0 = XMC_INPUT_B, -// .input_source_dx1 = XMC_INPUT_A, -// .slave_receive_irq_num = (IRQn_Type) USIC0_2_IRQn, -// .slave_receive_irq_service_request = 2 , -// .protocol_irq_num = (IRQn_Type) USIC0_3_IRQn, -// .protocol_irq_service_request = 3 -// }; +// XMC_I2S defines +/*U0C1*/ +/*DX0C(Input) -> P0.0*/ +/*SCLKOUT(ALT6) -> P0.3*/ +/*WA(ALT6) -> P0.4*/ + // XMC_I2S instance -// XMC_I2S_t i2s_config = -// { -// .input_config = { -// .mode = XMC_GPIO_MODE_INPUT_TRISTATE, -// .output_level = XMC_GPIO_OUTPUT_LEVEL_HIGH, -// .input_hysteresis = XMC_GPIO_INPUT_HYSTERESIS_STANDARD -// }, -// .sclk_config = { -// .mode = XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT7, -// .output_level = XMC_GPIO_OUTPUT_LEVEL_HIGH, -// .input_hysteresis = XMC_GPIO_INPUT_HYSTERESIS_STANDARD -// }, -// .wa_config = { -// .mode = XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT7, -// .output_level = XMC_GPIO_OUTPUT_LEVEL_HIGH, -// .input_hysteresis = XMC_GPIO_INPUT_HYSTERESIS_STANDARD -// }, -// .protocol_irq_num = (IRQn_Type) USIC0_2_IRQn, -// .protocol_irq_service_request = 2 -// }; +#define MASTER_CHANNEL XMC_I2S1_CH1 +#define MASTER_MRST PORT0, 0 +#define INPUT_SOURCE USIC1_C1_DX0_P0_0 +#define MASTER_SCLK PORT0, 3 +#define MASTER_WACLK PORT0, 4 + + +XMC_I2S_t i2s_config = +{ + .input_config = { + .mode = XMC_GPIO_MODE_INPUT_TRISTATE, + .output_level = XMC_GPIO_OUTPUT_LEVEL_HIGH, + .input_hysteresis = XMC_GPIO_INPUT_HYSTERESIS_STANDARD + }, + .sclk_config = { + .mode = XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT8, + .output_level = XMC_GPIO_OUTPUT_LEVEL_HIGH, + .input_hysteresis = XMC_GPIO_INPUT_HYSTERESIS_STANDARD + }, + .wa_config = { + .mode = XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT8, + .output_level = XMC_GPIO_OUTPUT_LEVEL_HIGH, + .input_hysteresis = XMC_GPIO_INPUT_HYSTERESIS_STANDARD + }, + .protocol_irq_num = (IRQn_Type) USIC1_2_IRQn, + .protocol_irq_service_request = 2 +}; // Serial Interrupt and event handling #ifdef __cplusplus From d73479e5b121d91b15242ca25d400b167da33dbb Mon Sep 17 00:00:00 2001 From: zhanglinjing Date: Thu, 30 Nov 2023 15:39:55 +0100 Subject: [PATCH 14/24] fix macro --- .../config/XMC1400_XMC2GO/pins_arduino.h | 28 +++++++++---------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/variants/XMC1400/config/XMC1400_XMC2GO/pins_arduino.h b/variants/XMC1400/config/XMC1400_XMC2GO/pins_arduino.h index 155087ad..462fe35b 100644 --- a/variants/XMC1400/config/XMC1400_XMC2GO/pins_arduino.h +++ b/variants/XMC1400/config/XMC1400_XMC2GO/pins_arduino.h @@ -89,6 +89,19 @@ extern const uint8_t NUM_ANALOG_INPUTS; #define A2 2 #define A3 3 +// XMC_I2S defines +/*U0C1*/ +/*DX0C(Input) -> P0.0*/ +/*SCLKOUT(ALT6) -> P0.3*/ +/*WA(ALT6) -> P0.4*/ + +// XMC_I2S instance +#define MASTER_CHANNEL XMC_I2S1_CH1 +#define MASTER_MRST PORT0, 0 +#define INPUT_SOURCE USIC1_C1_DX0_P0_0 +#define MASTER_SCLK PORT0, 3 +#define MASTER_WACLK PORT0, 4 + // Define LED & builtin-led #define LED1 14 #define LED2 15 @@ -313,21 +326,6 @@ XMC_I2C_t XMC_I2C_0 = .protocol_irq_service_request = 5 }; -// XMC_I2S defines -/*U0C1*/ -/*DX0C(Input) -> P0.0*/ -/*SCLKOUT(ALT6) -> P0.3*/ -/*WA(ALT6) -> P0.4*/ - - -// XMC_I2S instance -#define MASTER_CHANNEL XMC_I2S1_CH1 -#define MASTER_MRST PORT0, 0 -#define INPUT_SOURCE USIC1_C1_DX0_P0_0 -#define MASTER_SCLK PORT0, 3 -#define MASTER_WACLK PORT0, 4 - - XMC_I2S_t i2s_config = { .input_config = { From 3ef73235b080fcf01f016a6ef796fc8abe3d63bc Mon Sep 17 00:00:00 2001 From: zhanglinjing Date: Mon, 4 Dec 2023 15:36:27 +0100 Subject: [PATCH 15/24] fix: change the flashsize --- boards.txt | 8 +- tools/xmc_data.py | 14 -- variants/XMC1400/linker_script_64k.ld | 299 -------------------------- 3 files changed, 4 insertions(+), 317 deletions(-) delete mode 100644 variants/XMC1400/linker_script_64k.ld diff --git a/boards.txt b/boards.txt index a58e4e98..08dd09cb 100644 --- a/boards.txt +++ b/boards.txt @@ -155,13 +155,13 @@ XMC1400_XMC2GO.build.mcu=cortex-m0 XMC1400_XMC2GO.build.f_cpu=48000000L XMC1400_XMC2GO.build.board=ARM_XMC XMC1400_XMC2GO.build.board.version=1402 -XMC1400_XMC2GO.build.board.type=Q040x0064 -XMC1400_XMC2GO.build.board.v=0064 +XMC1400_XMC2GO.build.board.type=Q040x0200 +XMC1400_XMC2GO.build.board.v=0200 XMC1400_XMC2GO.build.core=./ XMC1400_XMC2GO.build.variant=XMC1400 XMC1400_XMC2GO.build.board_variant=XMC1400_XMC2GO -XMC1400_XMC2GO.build.flash_size=64K -XMC1400_XMC2GO.build.flash_ld=linker_script_64k.ld +XMC1400_XMC2GO.build.flash_size=200K +XMC1400_XMC2GO.build.flash_ld=linker_script_200k.ld XMC1400_XMC2GO.build.extra_flags=-DARM_MATH_CM0 -DXMC1_SERIES XMC1400_XMC2GO.menu.UART.debug=PC diff --git a/tools/xmc_data.py b/tools/xmc_data.py index 9b68e77b..1e87c401 100644 --- a/tools/xmc_data.py +++ b/tools/xmc_data.py @@ -43,20 +43,6 @@ "bitposition_LSB":"12" } }, - "XMC1402-0064":{ - "IDCHIP":{ - "addr":"40010004", - "size":"4", - "value":"00011000", - "mask":"FFFFF000" - }, - "FLSIZE":{ - "addr":"40000404", - "size": "4", - "bitposition_MSB":"17", - "bitposition_LSB":"12" - } - }, "XMC1402-0200":{ "IDCHIP":{ "addr":"40010004", diff --git a/variants/XMC1400/linker_script_64k.ld b/variants/XMC1400/linker_script_64k.ld deleted file mode 100644 index b686fc03..00000000 --- a/variants/XMC1400/linker_script_64k.ld +++ /dev/null @@ -1,299 +0,0 @@ -/** - * @file XMC1400x0064.ld - * @date 2017-04-20 - * - * @cond - ********************************************************************************************************************* - * Linker file for the GNU C Compiler v1.6 - * Supported devices: XMC1402-Q040X0064 - * XMC1402-Q048X0064 - * XMC1402-Q064X0064 - * XMC1402-F064X0064 - * XMC1402-T038X0064 - * XMC1403-Q040X0064 - * XMC1403-Q048X0064 - * XMC1403-Q064X0064 - * XMC1404-Q048X0064 - * XMC1404-Q064X0064 - * XMC1404-F064X0064 - * - * Copyright (c) 2015-2020, Infineon Technologies AG - * All rights reserved. - * - * Boost Software License - Version 1.0 - August 17th, 2003 - * - * Permission is hereby granted, free of charge, to any person or organization - * obtaining a copy of the software and accompanying documentation covered by - * this license (the "Software") to use, reproduce, display, distribute, - * execute, and transmit the Software, and to prepare derivative works of the - * Software, and to permit third-parties to whom the Software is furnished to - * do so, all subject to the following: - * - * The copyright notices in the Software and this entire statement, including - * the above license grant, this restriction and the following disclaimer, - * must be included in all copies of the Software, in whole or in part, and - * all derivative works of the Software, unless such copies or derivative - * works are solely in the form of machine-executable object code generated by - * a source language processor. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT - * SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE - * FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * To improve the quality of the software, users are encouraged to share - * modifications, enhancements or bug fixes with Infineon Technologies AG - * at XMCSupport@infineon.com. - ********************************************************************************************************************* - * - * Change History - * -------------- - * - * 2015-07-07: - * - Product splitting - * - Copyright notice update - * - * 2015-11-24: - * - Compatibility with GCC 4.9 2015q2 - * - * 2016-03-15: - * - Fixed FLASH size - * - Add assertion to check that region SRAM_combined does not overflowed no_init section - * - * 2016-06-07: - * - Add XMC1402-T038X0064, XMC1403-Q040X0064 - * - * 2016-10-28: - * - Fix linker not complaining if sum of data + text sections is bigger that physical FLASH size - * - * 2017-04-07: - * - Added new symbols __text_size and eText - * - * 2017-04-20: - * - Change vtable location to flash area to save ram - * - * @endcond - * - */ - -OUTPUT_FORMAT("elf32-littlearm") -OUTPUT_ARCH(arm) -ENTRY(Reset_Handler) - -MEMORY -{ - FLASH(RX) : ORIGIN = 0x10001000, LENGTH = 0x10000 - SRAM(!RX) : ORIGIN = 0x20000000, LENGTH = 0x4000 -} - -stack_size = DEFINED(stack_size) ? stack_size : 1024; -no_init_size = 4; - -SECTIONS -{ - /* TEXT section */ - - .text : - { - sText = .; - KEEP(*(.reset)); - *(.text .text.* .gnu.linkonce.t.*); - - /* C++ Support */ - KEEP(*(.init)) - KEEP(*(.fini)) - - /* .ctors */ - *crtbegin.o(.ctors) - *crtbegin?.o(.ctors) - *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) - *(SORT(.ctors.*)) - *(.ctors) - - /* .dtors */ - *crtbegin.o(.dtors) - *crtbegin?.o(.dtors) - *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) - *(SORT(.dtors.*)) - *(.dtors) - - *(.rodata .rodata.*) - *(.gnu.linkonce.r*) - - *(vtable) - - . = ALIGN(4); - } > FLASH - - .eh_frame_hdr : ALIGN (4) - { - KEEP (*(.eh_frame_hdr)) - } > FLASH - - .eh_frame : ALIGN (4) - { - KEEP (*(.eh_frame)) - } > FLASH - - /* Exception handling, exidx needs a dedicated section */ - .ARM.extab : ALIGN(4) - { - *(.ARM.extab* .gnu.linkonce.armextab.*) - } > FLASH - - . = ALIGN(4); - __exidx_start = .; - .ARM.exidx : ALIGN(4) - { - *(.ARM.exidx* .gnu.linkonce.armexidx.*) - } > FLASH - __exidx_end = .; - . = ALIGN(4); - - /* DSRAM layout (Lowest to highest)*/ - /* Veneer <-> Stack <-> DATA <-> BSS <-> HEAP */ - - .VENEER_Code ABSOLUTE(0x2000000C): - { - . = ALIGN(4); /* section size must be multiply of 4. See startup.S file */ - VeneerStart = .; - KEEP(*(.XmcVeneerCode)); - . = ALIGN(4); /* section size must be multiply of 4. See startup.S file */ - VeneerEnd = .; - } > SRAM AT > FLASH - eROData = LOADADDR (.VENEER_Code); - VeneerSize = ABSOLUTE(VeneerEnd) - ABSOLUTE(VeneerStart); - - /* Dummy section for stack */ - Stack (NOLOAD) : AT(0) - { - . = ALIGN(8); - . = . + stack_size; - __initial_sp = .; - } > SRAM - - /* Standard DATA and user defined DATA/BSS/CONST sections */ - .data : - { - . = ALIGN(4); /* section size must be multiply of 4. See startup.S file */ - __data_start = .; - * (.data); - * (.data*); - *(*.data); - *(.gnu.linkonce.d*) - - . = ALIGN(4); - /* preinit data */ - PROVIDE_HIDDEN (__preinit_array_start = .); - KEEP(*(.preinit_array)) - PROVIDE_HIDDEN (__preinit_array_end = .); - - . = ALIGN(4); - /* init data */ - PROVIDE_HIDDEN (__init_array_start = .); - KEEP(*(SORT(.init_array.*))) - KEEP(*(.init_array)) - PROVIDE_HIDDEN (__init_array_end = .); - - - . = ALIGN(4); - /* finit data */ - PROVIDE_HIDDEN (__fini_array_start = .); - KEEP(*(SORT(.fini_array.*))) - KEEP(*(.fini_array)) - PROVIDE_HIDDEN (__fini_array_end = .); - - . = ALIGN(4); /* section size must be multiply of 4. See startup.S file */ - __data_end = .; - } > SRAM AT > FLASH - DataLoadAddr = LOADADDR (.data); - __data_size = __data_end - __data_start; - - .ram_code : - { - . = ALIGN(4); /* section size must be multiply of 4. See startup.S file */ - __ram_code_start = .; - /* functions with __attribute__ ((section (".ram_code")))*/ - *(.ram_code) - . = ALIGN(4); /* section size must be multiply of 4. See startup.S file */ - __ram_code_end = .; - } > SRAM AT > FLASH - __ram_code_load = LOADADDR (.ram_code); - __ram_code_size = __ram_code_end - __ram_code_start; - - __text_size = (__exidx_end - sText) + VeneerSize + __data_size + __ram_code_size; - eText = sText + __text_size; - - /* BSS section */ - .bss (NOLOAD) : - { - . = ALIGN(4); /* section size must be multiply of 4. See startup.S file */ - __bss_start = .; - * (.bss); - * (.bss*); - * (COMMON); - *(.gnu.linkonce.b*) - . = ALIGN(4); /* section size must be multiply of 4. See startup.S file */ - __bss_end = .; - . = ALIGN(8); - Heap_Bank1_Start = .; - } > SRAM - __bss_size = __bss_end - __bss_start; - - /* .no_init section contains SystemCoreClock. See system.c file */ - .no_init ORIGIN(SRAM) + LENGTH(SRAM) - no_init_size (NOLOAD) : - { - Heap_Bank1_End = .; - * (.no_init); - } > SRAM - - /* Heap - Bank1*/ - Heap_Bank1_Size = Heap_Bank1_End - Heap_Bank1_Start; - - ASSERT(Heap_Bank1_Start <= Heap_Bank1_End, "region SRAM overflowed no_init section") - - /DISCARD/ : - { - *(.comment) - } - - .stab 0 (NOLOAD) : { *(.stab) } - .stabstr 0 (NOLOAD) : { *(.stabstr) } - - /* DWARF 1 */ - .debug 0 : { *(.debug) } - .line 0 : { *(.line) } - - /* GNU DWARF 1 extensions */ - .debug_srcinfo 0 : { *(.debug_srcinfo) } - .debug_sfnames 0 : { *(.debug_sfnames) } - - /* DWARF 1.1 and DWARF 2 */ - .debug_aranges 0 : { *(.debug_aranges) } - .debug_pubnames 0 : { *(.debug_pubnames) } - .debug_pubtypes 0 : { *(.debug_pubtypes) } - - /* DWARF 2 */ - .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } - .debug_abbrev 0 : { *(.debug_abbrev) } - .debug_line 0 : { *(.debug_line) } - .debug_frame 0 : { *(.debug_frame) } - .debug_str 0 : { *(.debug_str) } - .debug_loc 0 : { *(.debug_loc) } - .debug_macinfo 0 : { *(.debug_macinfo) } - - /* DWARF 2.1 */ - .debug_ranges 0 : { *(.debug_ranges) } - - /* SGI/MIPS DWARF 2 extensions */ - .debug_weaknames 0 : { *(.debug_weaknames) } - .debug_funcnames 0 : { *(.debug_funcnames) } - .debug_typenames 0 : { *(.debug_typenames) } - .debug_varnames 0 : { *(.debug_varnames) } - - /* Build attributes */ - .build_attributes 0 : { *(.ARM.attributes) } -} From ce5e3c662b7c2ae7cb7a3c5aeb6907d9c73fea7b Mon Sep 17 00:00:00 2001 From: zhanglinjing Date: Mon, 4 Dec 2023 15:49:23 +0100 Subject: [PATCH 16/24] test cicd --- .github/workflows/compile-platform-examples.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/compile-platform-examples.yml b/.github/workflows/compile-platform-examples.yml index 95f4ae22..b5b98290 100644 --- a/.github/workflows/compile-platform-examples.yml +++ b/.github/workflows/compile-platform-examples.yml @@ -158,7 +158,7 @@ jobs: platforms: | # Use Boards Manager to install the latest release of the platform to get the toolchain. - name: Infineon:xmc - source-url: https://github.com/Infineon/XMC-for-Arduino/releases/latest/download/package_infineon_index.json + source-url: https://github.com/LinjingZhang/XMC-for-Arduino/releases/download/0.0.1/package_infineon_index.template.json - source-path: ./ name: Infineon:xmc From 269a27134d9184814f41715ab7a5b7e2a0716440 Mon Sep 17 00:00:00 2001 From: zhanglinjing Date: Mon, 4 Dec 2023 16:33:35 +0100 Subject: [PATCH 17/24] temp: change the index.json url --- .github/workflows/compile-platform-examples.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/compile-platform-examples.yml b/.github/workflows/compile-platform-examples.yml index b5b98290..62652873 100644 --- a/.github/workflows/compile-platform-examples.yml +++ b/.github/workflows/compile-platform-examples.yml @@ -158,7 +158,7 @@ jobs: platforms: | # Use Boards Manager to install the latest release of the platform to get the toolchain. - name: Infineon:xmc - source-url: https://github.com/LinjingZhang/XMC-for-Arduino/releases/download/0.0.1/package_infineon_index.template.json + source-url: https://github.com/LinjingZhang/XMC-for-Arduino/releases/download/2.2.1/package_infineon_index_linjing_test.json - source-path: ./ name: Infineon:xmc From 575c935cfc0f45784681bee9d64b87b3235583bb Mon Sep 17 00:00:00 2001 From: zhanglinjing Date: Wed, 6 Dec 2023 15:01:40 +0100 Subject: [PATCH 18/24] fix wrong pin for debug --- variants/XMC1400/config/XMC1400_XMC2GO/pins_arduino.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/variants/XMC1400/config/XMC1400_XMC2GO/pins_arduino.h b/variants/XMC1400/config/XMC1400_XMC2GO/pins_arduino.h index 462fe35b..d18cd1be 100644 --- a/variants/XMC1400/config/XMC1400_XMC2GO/pins_arduino.h +++ b/variants/XMC1400/config/XMC1400_XMC2GO/pins_arduino.h @@ -217,7 +217,7 @@ XMC_UART_t XMC_UART_0 = .channel = XMC_UART0_CH0, .rx = { .port = (XMC_GPIO_PORT_t*)PORT2_BASE, // RX P2.6 #ifdef SERIAL_DEBUG - .pin = (uint8_t)0 + .pin = (uint8_t)2 #else .pin = (uint8_t)6 #endif @@ -228,7 +228,7 @@ XMC_UART_t XMC_UART_0 = }, .tx = { .port = (XMC_GPIO_PORT_t*)PORT2_BASE, // TX P2.0 #ifdef SERIAL_DEBUG - .pin = (uint8_t)6 + .pin = (uint8_t)1 #else .pin = (uint8_t)0 #endif @@ -241,7 +241,7 @@ XMC_UART_t XMC_UART_0 = .input_source_dx1 = XMC_INPUT_INVALID, .input_source_dx2 = XMC_INPUT_INVALID, #ifdef SERIAL_DEBUG - .input_source_dx3 = (XMC_USIC_INPUT_t)USIC0_C0_DX0_P2_0, + .input_source_dx3 = (XMC_USIC_INPUT_t)USIC0_C0_DX3_P2_2, #else .input_source_dx3 = (XMC_USIC_INPUT_t)USIC0_C0_DX3_P2_6, #endif From e3104d90895d0585bc11ce718236c19ce2ad761e Mon Sep 17 00:00:00 2001 From: zhanglinjing Date: Fri, 8 Dec 2023 16:01:55 +0100 Subject: [PATCH 19/24] add temporary dev readme file for local test --- IFX_README.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 IFX_README.md diff --git a/IFX_README.md b/IFX_README.md new file mode 100644 index 00000000..c131b249 --- /dev/null +++ b/IFX_README.md @@ -0,0 +1,21 @@ +[![Build Status](https://travis-ci.org/Infineon/XMC-for-Arduino.svg?branch=master)](https://travis-ci.org/Infineon/XMC-for-Arduino) +# Infineon's XMC Microcontroller Boards for Arduino + +## Local test (**ON WINDOWS**): + +### Clone the repository in arduino folder +- Open Arduino and install any Infineon XMC library (e.g. 2.2.0) +- Open the library location in Arduino program folder + +`C:\Users\USERNAME\AppData\Local\Arduino15\packages\Infineon\hardware\xmc` + +- Open git bash, type command: + +`git clone "HTTP_SSH_REPOSITORY" "LIBRARY_VERSION (e.g. 2.2.0)"` + +### Add JLink path to flasher (quick fix) +- Open `tools/xmc-flasher.py` +- Change line 14 +`jlinkexe = 'JLINK_EXE_PATH (e.g. C:/Program Files/SEGGER/JLink/JLink.exe)'` + +Refer to the main README for the rest of the usage. \ No newline at end of file From a24197b34d219b90e8ab445ac0a1d2a91fa8f361 Mon Sep 17 00:00:00 2001 From: zhanglinjing Date: Tue, 12 Dec 2023 14:11:48 +0100 Subject: [PATCH 20/24] update yaml file --- .github/workflows/compile-platform-examples.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/compile-platform-examples.yml b/.github/workflows/compile-platform-examples.yml index 62652873..77e8ab85 100644 --- a/.github/workflows/compile-platform-examples.yml +++ b/.github/workflows/compile-platform-examples.yml @@ -158,7 +158,7 @@ jobs: platforms: | # Use Boards Manager to install the latest release of the platform to get the toolchain. - name: Infineon:xmc - source-url: https://github.com/LinjingZhang/XMC-for-Arduino/releases/download/2.2.1/package_infineon_index_linjing_test.json + source-url: https://github.com/LinjingZhang/XMC-for-Arduino/releases/latest/download/package_infineon_index.json - source-path: ./ name: Infineon:xmc From 3a26c65870f0f8ee2a98d5d960c9166a20654347 Mon Sep 17 00:00:00 2001 From: zhanglinjing Date: Wed, 13 Dec 2023 14:09:22 +0100 Subject: [PATCH 21/24] - remove checkout step - desable deltas report for new board --- .github/workflows/compile-platform-examples.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/compile-platform-examples.yml b/.github/workflows/compile-platform-examples.yml index 77e8ab85..42f6e0c8 100644 --- a/.github/workflows/compile-platform-examples.yml +++ b/.github/workflows/compile-platform-examples.yml @@ -147,9 +147,6 @@ jobs: alarmRtc-sketch-paths: | - libraries/RTC/examples/AlarmRTC steps: - - name: Checkout repository - uses: actions/checkout@v2 - - name: Compile examples uses: arduino/compile-sketches@v1 with: @@ -178,7 +175,7 @@ jobs: ${{ matrix.multiSerial-sketch-paths }} ${{ matrix.dma-sketch-paths }} ${{ matrix.alarmRtc-sketch-paths }} - enable-deltas-report: true + enable-deltas-report: false sketches-report-path: ${{ env.SKETCHES_REPORTS_PATH }} - name: Save sketches report as workflow artifact From a0824fb0f4f7b2ed0c29aa53827b14a256c0e610 Mon Sep 17 00:00:00 2001 From: zhanglinjing Date: Wed, 13 Dec 2023 14:14:15 +0100 Subject: [PATCH 22/24] fix checkout library test example error --- .github/workflows/compile-platform-examples.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/compile-platform-examples.yml b/.github/workflows/compile-platform-examples.yml index 42f6e0c8..05fc6517 100644 --- a/.github/workflows/compile-platform-examples.yml +++ b/.github/workflows/compile-platform-examples.yml @@ -147,6 +147,9 @@ jobs: alarmRtc-sketch-paths: | - libraries/RTC/examples/AlarmRTC steps: + - name: Checkout repository + uses: actions/checkout@v2 + - name: Compile examples uses: arduino/compile-sketches@v1 with: From c8d0a8df7d0fad27dbda21ca46aed02221cc428d Mon Sep 17 00:00:00 2001 From: zhanglinjing Date: Wed, 13 Dec 2023 14:46:38 +0100 Subject: [PATCH 23/24] remove stackMem test exapmle - linker script changed --- .github/workflows/compile-platform-examples.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/compile-platform-examples.yml b/.github/workflows/compile-platform-examples.yml index 05fc6517..84df20e9 100644 --- a/.github/workflows/compile-platform-examples.yml +++ b/.github/workflows/compile-platform-examples.yml @@ -98,7 +98,7 @@ jobs: heapMem: true sleep1100: true sleep4700 : false - stackMem: true + stackMem: false dma: false alarmRtc: false - fqbn: Infineon:xmc:XMC1400_Arduino_Kit @@ -149,7 +149,7 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v2 - + - name: Compile examples uses: arduino/compile-sketches@v1 with: From 98d546f7a2a8748981d16a30d967c21a1796f165 Mon Sep 17 00:00:00 2001 From: zhanglinjing Date: Wed, 13 Dec 2023 22:57:20 +0100 Subject: [PATCH 24/24] choose different result register for ADC channels --- .../config/XMC1400_XMC2GO/pins_arduino.h | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/variants/XMC1400/config/XMC1400_XMC2GO/pins_arduino.h b/variants/XMC1400/config/XMC1400_XMC2GO/pins_arduino.h index d18cd1be..4e46547b 100644 --- a/variants/XMC1400/config/XMC1400_XMC2GO/pins_arduino.h +++ b/variants/XMC1400/config/XMC1400_XMC2GO/pins_arduino.h @@ -196,13 +196,22 @@ const uint8_t NUM_PWM = ( sizeof( mapping_pwm4 ) / sizeof( XMC_PWM4_t ) ); const uint8_t NUM_PWM4 = ( sizeof( mapping_pwm4 ) / sizeof( XMC_PWM4_t ) ); /* Analog Pin mappings and configurations */ -XMC_ADC_t mapping_adc[] = - { - {VADC, 1, DISABLED}, // P2.8 - {VADC, 2, DISABLED}, // P2.9 - {VADC, 3, DISABLED}, // P2.10 - {VADC, 4, DISABLED} // P2.11 - }; +// XMC_ADC_t mapping_adc[] = +// { +// { VADC, 1, DISABLED }, //A0 P2.8 +// { VADC, 2, DISABLED }, //A1 P2.9 +// { VADC, 3, DISABLED }, //A2 P2.10 +// { VADC, 4, DISABLED }, //A3 P2.11 +// }; + + XMC_ADC_t mapping_adc[] = + { + { VADC, 1, VADC_G0, 0, 1, DISABLED }, //A0 P2.8 + { VADC, 2, VADC_G0, 0, 2, DISABLED }, //A1 P2.9 + { VADC, 3, VADC_G0, 0, 3, DISABLED }, //A2 P2.10 + { VADC, 4, VADC_G0, 0, 4, DISABLED }, //A3 P2.11 + }; + const uint8_t NUM_ANALOG_INPUTS = ( sizeof( mapping_adc ) / sizeof( XMC_ADC_t ) ); /*