I have an application that works properly on WEC7, on Colibri T20 module, that uses Legacy Windows CE libraries.
Now I’m migrating it to newer Toradex CE Libraries because I plan to migrate to Colibri iMX6DL, that is not compatible with legacy libs.
I have tested Toradex CE Libraries (toradexcelibraries_2.6-20230327) sample code for ADC on T20 and it works fine, but the same code fails on iMX6DL.
Adc_Init() seems to return a valid handler, but when Adc_Open() is called (with handler received from Adc_Init as parameter), it always returns false.
I’m using exactly the same code included in toradexcelibraries_2.6-20230327 (**\toradexcelibraries_2.6-20230327\libdemos\dotNet\AdcDemo**).
Do you know what could be going wrong?
Thanks in advance.
Colibri iMX6DL 512Mb v1.0A
Have you compiled using Debug or Release option?
I have compiled using Debug option. Now I tried using Release, but it also fails.
Adc_Open() always returns false when I run it on iMX6DL.
When I run the same code in T20 it works properly and then I read valid values.
Could you please enable debug message and log the debug messages output then share with us while issue is occuring.
I enabled debug messages and get the following log:
The last 3 warning messages appear when I deploy de project, but prior to call Adc_Open() or any other ADC function.
When I try to use ADC (calling Adc_Init / Adc_SetConfigInt / Adc_Open) nothing is logged at message output.
Just in case, the full log since it boots:
iMX6DL - Debug output 01.txt (3.3 KB)
I’ve tested the libdemos\dotNet\AdcDemo project and everything works as expected. As I understand, you have your own project that uses the same code as in ADCdemo. If that’s the case, could you please create a minimal project to reproduce the issue and share it here? Also, are you using I2C somewhere in your app, or in another app that’s running simultaneously with your app that’s using ADC?
I have my own project, but when I found this problem, I’ve just tried the minimal project included in the library: \toradexcelibraries_2.6-20230327\libdemos\dotNet\AdcDemo
I’m running it from Visual Studio without modifying the code.
What I found now is that the AdcOpen() fails if I run AdcDemo with the iMX6DL module inserted in my own custom carrier board.
If I replicate exactly the same steps (turn on, connect remote display, run same project from VS) but iMX6DL is inserted in Iris carrier board, AdcOpen() does not fail, and ADC works properly, samplig as spected.
Is it possible that any change on external pins make it work different on each carrier board?
(I’m using the same module in both carrier boards, so it is not a module sw/hw difference).
Our custom carrier board was designed for Colibri T20, and this AdcDemo works properly running on T20 with our custom carrier board.
About I2C, I’m not using now in these tests, I’m just using AdcDemo.
But I have tried I2C in my code, I have to work on it because I didn’t make it work, I think I have to work more on my legacy wrapper functions that calls new ones. I have to implement I2CBurstRead(), I2CBurstWrite(), etc., that are the old legacy functions.
It sounds strange. Are you using X1 pins 14, 16, 18 or 20 for some interfaces on your carrier board?
No, they are all unconnected, just floating pads of the connector.
Could you share your board’s schematic? If you prefer not to post it here, you can send it to firstname.lastname@example.org. Please include a link to this thread
Does the C code (libdemos\Adc_Demo) demonstrates the same behavior?
I’ve tried the C code and has the same behaviour, on Iris it works, but using my custom carrier board fails while calling to AdcOpen().
Hi @apanelli ,
I think the issue has something to do with I2C. Are you using I2C2 on pins 207 and 205?
The problem is that for ADC we need to communicate over the internal I2C controller to the ADC chip. This is I2C2 on internal pins. If you use I2C2 on the external pins and Open it without closing it after using it the ADC lib will not be able to talk to the ADC chip.
If you are using I2C2 you can just open it before writing/reading and then close it again.
Hi @apanelli ,
Sorry, i thought you were using Apalis, but i now see you’re on Colibri. But what i said about I2C2 is still true. It’s just other pins (X2 pin 15 and X2 pin 16).
Here is also a I2C Tool to test if you can access the i2c.
I2CTool.exe (212 KB)
The internal I2C channel is I2C9, try selecting it and do a “scan” you should then see 2 devices in the list.
I’ve reviewed your schematic and see no cause for such peculiar behavior. Could you please conduct another test?
- Use the Toradex Easy Installer to flash a fresh 1.8 WEC 7 image.
- Clear the registry at the eBoot stage.
- Compile the libdemos\Adc_Demo example.
- Transfer it to the module.
- Run tests on both carrier boards (Iris and your own) without employing VS remote deploy/debug.
Hi Alex and Germano,
First of all, thanks for your help.
I’ve done a few more tests, but it didn’t work. Unfortunately I have no more time to make it work and to do all required tests to verify that my application will run 100% on iMX6DL.
I had to place LTB order for Colibri T20 before it is closed.
About I2C, I tried it also, but separately from ADC, and I could make I2C work (I’m using I2C1) on demo project, using some I2C ICs I have on my carrier board, but something fails when I use it from my app, sure it’s a matter of time to figure out what is going wrong and fix it, but as I said unfortunately we have no time before LTB order expires.
I will do further tests when I finish another hardware design, to check if is possible to replace our T20 based designs with iMX6DL in the future.