BGS5T input GPIO allways 0 | Telit Cinterion IoT Developer Community
August 8, 2014 - 5:32pm, 15191 views
I am trying to read GPIO input states trough java and terminal, but I am allways getting 0, even when there is 5V on that input.
Terminal code:
AT^SPIO=1
AT^SPIO=1
OK
AT^SCPIN=1,6,0
AT^SCPIN=1,6,0
OK
AT^SCPIN=1,7,0
AT^SCPIN=1,7,0
OK
AT^SGIO=6
AT^SGIO=6
^SGIO: 0
OK
AT^SGIO=7
AT^SGIO=7
^SGIO: 0
at^scpol=1,7
at^scpol=1,7
OK
at^scpol=1,6
at^scpol=1,6
OK
Java code:
pastebin link: http://pastebin.com/rJEBSweF
protected void startApp() throws MIDletStateChangeException {
InPort5V inport = null;
OutPort5V outport = null;
try {
m_Cmd = new ATCommand(false);
m_Cmd.addListener(m_Listener);
String Response = m_Cmd.send("-AT+CMEE=2\r");
System.out.println(Response);
Response = m_Cmd.send("ati\r");
Vector pins = new Vector(1);
pins.addElement("GPIO21");
inport = new InPort5V(pins);
inport.addListener(new gpioListener());
} catch (IOException e) {
e.printStackTrace();
} catch (ATCommandFailedException ex) {
ex.printStackTrace();
}
catch (IllegalStateException ex) {
ex.printStackTrace();
} catch (IllegalArgumentException ex) {
ex.printStackTrace();
}
int a = 0;
boolean run = true;
System.out.println("Inport : " + inport);
while (run) {
a++;
if(a > 20)
{
try {
inport.release();
} catch (IOException ex) {
ex.printStackTrace();
} catch (OperationNotSupported ex) {
ex.printStackTrace();
}
destroyApp(true);
run = false;
}
try {
Thread.sleep(4000);
System.out.println(inport.getValue());
} catch (InterruptedException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
destroyApp(true);
}
}
I tryed all the GPIOs : 6,7,8, 20, 21
AT^SCFG returns this, as I watched the data sheet everything is ok.
AT^SCFG?
AT^SCFG?
^SCFG: "Call/ECC","0"
^SCFG: "GPRS/AutoAttach","enabled"
^SCFG: "Gpio/mode/ASC1","std"
^SCFG: "Gpio/mode/DAI","gpio"
^SCFG: "Gpio/mode/DCD0","std"
^SCFG: "Gpio/mode/DSR0","std"
^SCFG: "Gpio/mode/DTR0","std"
^SCFG: "Gpio/mode/FSR","gpio"
^SCFG: "Gpio/mode/PULSE","gpio"
^SCFG: "Gpio/mode/PWM","gpio"
^SCFG: "Gpio/mode/RING0","std"
^SCFG: "Gpio/mode/SPI","rsv"
^SCFG: "Gpio/mode/SYNC","std"
^SCFG: "Ident/Manufacturer","Cinterion"
^SCFG: "Ident/Product","BGS5"
^SCFG: "MEShutdown/Fso","0"
^SCFG: "MEopMode/SoR","on"
^SCFG: "Radio/Band","15"
^SCFG: "Radio/OutputPowerReduction","4"
^SCFG: "Serial/Interface/Allocation","1","1"
^SCFG: "Serial/USB/DDD","0","0","0409","1E2D","0059","Cinterion Wireless Modules","Cinterion BGx USB Com Port",""
^SCFG: "Tcp/IRT","3"
^SCFG: "Tcp/MR","10"
^SCFG: "Tcp/OT","6000"
^SCFG: "Tcp/WithURCs","on"
^SCFG: "Trace/Syslog/Otap","0"
^SCFG: "URC/Ringline","local"
^SCFG: "URC/Ringline/ActiveTime","2"
^SCFG: "Userware/Autostart","1"
^SCFG: "Userware/Autostart/Delay","0"
^SCFG: "Userware/Passwd",
^SCFG: "Userware/Stdout","null",,,,"off"
^SCFG: "Userware/Watchdog","0"
Tnx fpr your help