SAMC21 TSENS

Go To Last Post
3 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I am using SAMC21 X Planined Pro for tests. The goal is to use TSENS in our application.

Driver with example in ASF for TSENS, is not working correctly since I receive values are about 4 milion (CPU temperature is about 36°C).

 

I found possible bug in reading calibration values from NVM and configuring TSENS, but still it is not working correctly.

One man mentioned that there is a bug there, but that was from 2010: https://www.avrfreaks.net/forum/...

 

Is there someone which had this problem?

 

 

p.s. Also Datashee for SAM C21 Family is confusing. In chapter about ADC they are talking about possibiity to read temperature via ADC, but ASF is not allowing this channel to be used and they are also talking there about calculations which are ment for SAMD family.

This topic has a solution.
Last Edited: Fri. May 4, 2018 - 12:07 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Driver with example in ASF for TSENS, is not working correctly since I receive values are about 4 milion (CPU temperature is about 36°C).

 Have you done any debugging of the ASF code?   Sometimes that seems to be necessary :-(

 

Hmm.

The current asf bug database isn't public, but there is this old issue:

 

http://webcache.googleuserconten...

This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I found a problems (bugs) in TSENS driver:

  • tsens_get_config_defaults

config->calibration.offset   = \

((tsens_bits[0] & TSENS_FUSES_OFFSET_Msk) >> TSENS_FUSES_OFFSET_Pos);

Offset is taken from wrong array element, 1 must be written instead of 0.

  • tsens_read

#if (ERRATA_14476)

*result = (-1) * temp;

#endif

This is unnecessary multiplication with -1, when -1 is removed the result is correct

 

Now driver is giving correct temperature.