VF61 SoC Temperature using C#

I’d like to read the SoC temperature in my C# code running under Win CE6. I’ve looked at the C code on the developer site. Has anyone done this in C#?

Hi,

C# wrapper for our libs is available in library’s download → http://developer.toradex.com/knowledge-base/windows-ce-libraries-and-code-samples#Toradex_CE_Libraries_for_VFxx_and_iMX6

You can also find sample C code how to measure temperature here → http://developer.toradex.com/soc-temperature-readout(wince)#Colibri_VFxx and you can see it uses ADC1, channel 26.

Using this 2 pages you should be able to read temperature. You can find all the wrapper functions inside “TdxAllLibraries.cs” file.

Well, I think that it is possible.
By the way, could you post here the code you’ve found written in C#?

Hi,

I provided you with everything you need to measure temperature from C#. You just have to read through it and write a code.

Here is some C# code that I could use some help with. It compiles and runs, but the adcValue I get is around 400000, instead of 200 or so. What am I doing wrong?

program.cs

Hi, did you try running C version? Do you get proper values there?

The “read_vfxx_soc_temperature” code runs with an adcValue = 209 evaluating to 51.7 Deg C.

Sorry for late replay. I did check the library’s and its true you are not able to get temperature. I added issue to our tracker. You will be able to find it on our roadmap soon. Easy solution for you now would be to create a small DLL in C that measures the temperature than use pinvoke in C# to call that function.

Is this issue on the roadmap? If so, how do I find it?