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

User14799
Level 2
Level 2
First like received
Hello people of the Forum,
I need help once again. I want to read the Onchip Temperature of the XMC4300 Relax Board, but it doesnt work.
Infineon has an document for the XMC1000 descirbing this procedure

https://www.infineon.com/dgdl/Infineon-ApplicationNote_How_To_Use_On-Chip_Temperature_Sensor_XMC1000...

.... BUT: For XMC4300 it doesnt work.

I include "xmc_scu.h" in my Code but in this File there isnt a function called XMC_SCU_CalcTemperature().
In my Code I do XMC_SCU_StartTemperatureMeasurement() and after that I do XMC_SCU_GetTemperatureMeasurement(). But this only return 0.

--> How is the reading of the Temperature on XMC4300 working?? It couldnt be that hard and I cant be the only one, who has a problem with it.
2 Replies
User14799
Level 2
Level 2
First like received
Are there no Infineon specialists in the Forum who can help me with this seemingly easy thing???
0 Likes
User14799
Level 2
Level 2
First like received
Ok the Infineon Support sent me the following (what worked for me so far):

#include

volatile uint32_t temperature;

int main(void)
{
XMC_SCU_EnableTemperatureSensor();

// Ignore first measurement
XMC_SCU_StartTemperatureMeasurement();
while (XMC_SCU_IsTemperatureSensorBusy());
temperature = XMC_SCU_GetTemperatureMeasurement();

/* Placeholder for user application code. The while loop below can be replaced with user application code. */
while(1U)
{
XMC_SCU_StartTemperatureMeasurement();
while (XMC_SCU_IsTemperatureSensorBusy());
temperature = XMC_SCU_GetTemperatureMeasurement();
}
}


Leasons learned:
- XMC_SCU_EnableTemperatureSensor() one time at first
- poll on: XMC_SCU_IsTemperatureSensorBusy
- forget the first measurement


Additional:
if you want °C you have to do:
temperature = (XMC_SCU_GetTemperatureMeasurement()-605)/2.05;


Thanks to Infineon Techies for help and myself for posting the solution on the Forum...