ADC sample rate on WCE6

Greetings, i’m trying to read a potentiometer values using Analog Input channels.
I get correct readings of 3.3 (or something similar) volts but when moving the potentiometer the values are not changing thus I can’t tell if it’s reading the movement of the potentiometer or not.
I think it has to do with ADC sampling time, is there any way to change this parameter?

ADC sampling time can vary from microseconds to hundreds microseconds depending on ADC Configuration Options BitResolution and AvgSamples. Please check Toradex CE Libraries documentation for details.

In any case sampling rate is fast enough to see potentiometer readings immediately. Please check if potentiometer wired correctly and you reading a proper ADC channel.

Sorry I meant digital encoder not potentiometer, my bad.
I’m trying in various ways to get to see its movements, even trying with GPIOs and interrupts but without results.
I’m using gpioLib and IntLib following Toradex CE Libraries documentation.
Do you have any suggestion on how to implement this?

What kind of digital encoder you are trying to interface?

It’s a mechanical rotary digital encoder with Phase A and Phase B.
Now I’m trying a different approach.
I did a bit of research in the forums and referring to NXP VFXXXRM.pdf file I’m trying to use Quadrature Decoder Mode with Pin 28 and 67 configuring their AltFn3 (FTM1_QD_PHA and FTM1_QD_PHB as per Colibri VF61 pinout document). Setting up all the registers I get to see the FTM Counter updating when the encoder is rotated but it only goes in one direction (only increasing or only decrasing depending on wich phase I connect to each pin). I can’t get the counter to increase/decrease based on the rotation direction.

At this moment the configuration I’m using is:

//FTM1_MODE: FTMEN bit 0 is set to 1 (FTM enable) and WPDIS bit 2 is set to 1 (Write protection is disabled)
	regFTM1_MODE = (DWORD*)Map_MapMemory((DWORD)0x40039054, 4);
	Map_MemoryWrite(regFTM1_MODE, 0x0005, 8);

//FTM1_MOD: Modulo register is set to max value
	regFTM1_MOD = (DWORD*)Map_MapMemory((DWORD)0x40039008, 4);
	Map_MemoryWrite(regFTM1_MOD, 0xFFFF, 8);

//FTM1_CNTIN: Counter Init is set to 0
	regFTM1_CNTIN = (DWORD*)Map_MapMemory((DWORD)0x4003904C, 4);
	Map_MemoryWrite(regFTM1_CNTIN, 0x0000, 8);

//FTM1_CNT: FTM Counter is set to 0 (even if I don't think this is really necessary)
	regFTM1_CNT = (DWORD*)Map_MapMemory((DWORD)0x40039004, 4);
	Map_MemoryWrite(regFTM1_CNT, 0x0000, 8);

//FTM1_QDCTRL: QUADEN bit 0 is set to 1 (Enable Quadrature Encoding Mode) and QUADMODE bit 3 is set to 0 to enable Phase A and phase B encoding mode.
	regFTM1_QDCTRL = (DWORD*)Map_MapMemory((DWORD)0x40039080, 4);
	Map_MemoryWrite(regFTM1_QDCTRL, 0x0001, 8);

At this point FTM1 should be configured correctly for Phase A and phase B encoding mode and the counter should increase when a rising edge in PHA is detected before a rising edge in PHB and should decrase when a rising edge in PHB is detected before a rising edge in PHA (as per documentation). This way I could easily determine the direction of the rotation.

The problem is that I see the counter only increasing (or decreasing if I swap the phase cables-pin connection) no matter which direction the encoder is rotated.
The encoder gets detected correctly but I can’t understand why it doesn’t count correctly.
Do you have any suggestion on this matter or should I ask NXP directly?

I found out I didn’t properly tri-state SODIMM67 , as soon as I did my code started to work properly.

Thank you for the update. Glad your problem is solved.