1. Slow Progress
It has been several weeks with little progress. Study the datasheet of XMC4400 and XMC4200 , even XMC4700.
To find out that hidden features of XMC series. XMC4 series MCU are especially good for motor control and industrial application. The advanced CCU4 and CCU8 blocks can not be found in other MCUs. While PWM function is still available for simple tasks, as of LRPWM.
The embedded CCU4/CCU8 block are complex with any full functions.
Another POSIF block can get feedback signal from Hall-sensors for better control of motors.
All the function block are hidden behind normal arduino codes and can not be accessible.
The slow progess bring no less fun than progress. That inspire me on new exploration in further projects to utilize the XMC MCU for High Voltage Direct Current invertors/chargers.
2. The Failure
Even I have configurated the ports and pins correctly, the SPI and Wire are still not work well.
With Error report
libraries\SPI\HW_SPI.cpp.o: In function `SPISettings::SPISettings()': C:\Users\north\AppData\Local\Arduino15\packages\Infineon\hardware\arm\1.5.0\libraries\SPI\src/SPI.h:96: undefined reference to `XMC_SPI_0' libraries\Wire\Wire.cpp.o: In function `__static_initialization_and_destruction_0': C:\Users\north\AppData\Local\Arduino15\packages\Infineon\hardware\arm\1.5.0\libraries\Wire\src/Wire.cpp:817: undefined reference to `XMC_I2C_0'
There are wrong definition with Wire.h and SPI.h libary. From source code, Infineon has skipped all the defination of XMC4200 even in basic SPI and Wire libararies. Such as,
in wire.h,
extern TwoWire Wire; #if (NUM_I2C > 1) extern TwoWire Wire1; # if (NUM_I2C > 2) extern TwoWire Wire2; # if (NUM_I2C > 3) extern TwoWire Wire3; # if (NUM_I2C > 4) extern TwoWire Wire4; # endif # endif # endif #endif
as in wire.cpp,
#if defined(XMC4400_Platform2GO) void USIC1_1_IRQHandler() { Wire.ReceiveHandler(); } void USIC1_2_IRQHandler() { Wire.ProtocolHandler(); } #endif #elif defined(XMC4700_Relax_Kit) void USIC1_1_IRQHandler() { Wire.ReceiveHandler(); } void USIC1_2_IRQHandler() { Wire.ProtocolHandler(); } void USIC1_3_IRQHandler() { Wire1.ReceiveHandler(); } void USIC1_4_IRQHandler() { Wire1.ProtocolHandler(); } #endif
But I still can not solve them for now.
3. Thing to learn and way to go
The arduino IDE shall be good for most MCU and boards but for special boards like XMC4200 or Microchip DA series, the vendor version IDE would be more appropriate in fully unlash the power of MCUs.
The time may not enough to solve all the problems. In next blog, I would like to show my original idea on how to make the fridge work.