WinCE Libs: ADC_Init crashes with WEC2013/BSP 1.3b4


after updating to BSP 1.3b4 we’re getting a crash when calling Adc_Init.
We tried it with CE lib version 2.0 and version 2.1.
Release versions are just crashing, but with debug versions we can see debug messages.

CE Lib 2.0 debug:

CE Lib 2.1 debug:

I have also experienced this problem.


We have tried to reproduce the issue, but unable to reproduce it.
I have added VS2015 project files with our library release, Could you please download from here and Open Adc_Demo_VS2015.sln project, build and test.
Let us know if you face the same issue here.

I have just tried this and also get the same problem with the demo. No issue with older library

Sorry, I don’t have VS2015.

I did some additional tests, i used the released versions 2.0 and 2.1 for that.
I didn’t use the library from your your download link because the libs/dlls are binary equal to version 2.1.

I changed from linking against “TdxAllLibrariesDll.lib” to the static library “AdcLib.lib”.
We’re building a custom OS, i did test with our old image which is based on BSP 1.2b6 and the new image which is based on BSP 1.3b4.

The test program using CeLibs 2.0 works on both images
The test program using CeLibs 2.1 crashes on both images.

The test program is simple:

#include "stdafx.h"

#include <adc.h>

#pragma comment(lib, "AdcLib.lib")

int wmain(int argc, wchar_t *argv[])
	printf("\r\ncalling Adc_Init...");
	HANDLE hAdc = Adc_Init(L"ADC1");
	printf("\r\nafter calling Adc_Init...");

	return 0;

Do you have any news on that issue?

In my first post i accidentally suspected that our switch to BSP 1.3b4 caused the crash.
But it is the new version of the CE libraries which causes the crash, the BSP version doesn’t matter.

Are you using different I2C pins than standard?
If so, Could you please disable the I2C driver while booting. So that, the I2C driver will be loaded when ADC_Init function is called with configured i2c pins.
Disable I2C driver:


Could you please export the all [HKLM\Drivers\BuiltIn| and [HKLM\Software\Toradex] registry, just while the issue is occurring and share with us?

The crash doesn’t happen when i disable I2C2 (I2C1 is active).
The registry keys are here:link text

I disabled I2C2 in the registry, but as soon as i call Adc_Init the registry key is set to it’s old value. This is bad, because we’re saving the registry whenever we’re changing the network settings.That means that I2C2 gets re-enabled after the next reboot.


We found the problem. Could you please wait for few days, we will do some testing and will share preliminary release to you.

thank you for the status update.

In the meantime i did some more testing.
It seems that this is just happening when i use CELibs 2.1 with BSP 1.2b6 and Bootloader 1.2b4 (static linking or dynamic linking doesn’t seem to make a difference).

My results are here


The issue is Default I2c pins not configured for Apalis iMX6. We fixed it now. Please download preliminary release library from here and test it.
If you are not using default pins then configure ioScl and ioSda through I2c_SetConfigInt. Refer more documentation at Toradex_CE_Libraries.chm


I have had a quick test of this and it seems to break the adc. I only seem to get 0 readings now. My code matches the demo code

Same thing here, we’re always reading 0.


We are able to reproduce the issue. Could you please wait for few days, we will get back you with details.

Thank you.

ADC is working with the new libraries, thanks for your help.


Due to major restructuring our library code, we missed few small things. One of that, I2C portname is changed for internal ADC chip, I have solved it now.Please download preliminary release library from here and test it.

It is also working for me now