FX30 IOs API for legato

I can see the input changing when I connect the GND, I dont really care if the normal status is TRUE or FALSE. That the input status doesnt change when I connect the Vin but only when I connect the GND, wasn`t this clear??

you might try to modify
/sys/class/gpio/gpio2/pull

to pull “up” or pull “down” and see if there is improvement.

I have done that and doesn`t make any difference, so the reason for asking this question.

how about adding a pull low resistor to the pin?
Then it should be returning FALSE when not touching anything.

From your table, you might also need to modify gpio57 to have internal pull up

I see we are going off tracks here, my original question is “if the IO should work with both positive (+Vin) and negative (GND) signals.”
Once again this should be possible according to the manual (FX30 hardware guide):
image
where I am using a signal which is 24VDC so greater then 3V.

I have already done this using the le_gpio legato command.

But on my target this doesnt seem working on IO1. I dont get why you are advising to modify the hardware (adding a pull down resistor to the pin) to provide something which should be already implemented…?

in your case, you need a pull down resistor, am i correct?
GPIO57 is for internal pull-up only according to your table.

According to the hardware manual I don`t need to have a pull down resistor, it says VHigh > 3.0V?
And even if that was the case, why is it working with IO3?

does it work if you add a pull down resistor?

No it doesn`t.
But also this is not the point.

I think it is the point, if pull down resistor is added, when the pin touch nothing , it should return FALSE.

It doesnt, if you read the question this is really if the hardware should support this functionality out of the box. Not how to customize the hardware to get it working, where what you have advised doesnt work anyhow.

this pull low resistor test is for you to make sure if pull low is the key point.

It doesn`t work, my question is:
“For this standard product should the IO inputs when set in digital mode able to detect positive and negative switching”
YES / NO?

->YES = we are setting this up wrong
→ NO = the hardware manual is not clear, but we can possibly leave with this.

If we could get a clear answer, we are not interested at this point to customize the hardware, even if that require adding a simple pull down resistor.

you said you touch the pin to ground, it returns FALSE
but it does not work when using pull low resistor when the pin touching nothing.

To me, the value of pull low resistor may have problem.

Anyway, good luck!

Hi @claudio.baldini,
In order to read the ADC’s, there are a few ways:

AT Command

For ADC0 (IoT connector) in mV
AT!MADC?10
or
AT!ADC?ADC0

For ADC1 (External I/O #2) in mV
AT!MADC?5
or
AT!ADC?ADC1

shell
ADC0
cat /sys/devices/qpnp-vadc-8/mpp2_div1

ADC1
cat /sys/devices/qpnp-vadc-8/mpp4_div1

For the shell commands, the “Result” is in uW and the “Raw” is the raw ADC value.

BR,
Chris

@cchenry ye, I got the ADC to work nice, only have problems with the IO1 and IO3, where it seems the IO1 is only negative swithing and the IO3 only positive switching, just wanted to confirm that.

With the IO1, when I use the legato API le_gpio57_EnablePullUp() it will return -19, same for the le_gpio54_EnablePullUp() which should be the gpios for IO1 and IO3.
If I call le_gpio2_EnablePullUp() it will return with LE_OK but it doesn`t seems it has any effect.