Accessing the GPIO ports on the EHS6T [Solved] | Thales IoT Developer Community
September 2, 2015 - 5:00pm, 4543 views
Hi, I'm currently in the middle of a simple SMS application using AT commands controlled via a C# program.. Then eventually embedded into Java.
The problem I am having is that non of the GPIO ports cannot be accessed as inputs or outputs. I don't recieve any errors when inputting the AT^SCPIN commands. The set and get commands do not match the hardware conditions.
GPIO6 as an input (AT^SCPIN=1,6,0) tied to 5V (pin 7) will return (AT^SGIO=6) 0.
GPIO8 set as an active high output (AT^SCPIN=1,8,1,1) will return (AT^SGIO=8) 1 even though the pin is measured at 0v or floating.
I've tried bridging pins 1 and 7 but it makes little to no difference. The module is as it came from the factory with no running programs on, besides the MIDIlet suite . Is there any initialisation command that I am missing out on or something?
Any help would be greatly appreciated, thanks!
I don't have EHS6T, but I have BGS5T and there before you can use GPIO pins, you first have to connect VCCref and +5Vout.
After that you have to initialize GPIO pins, how you do that you can see in this thread:https://iot-developer.thalesgroup.com/threads/bgs5t-input-gpio-allways-0...
I am not sure if it's same procedure for EHS6T as it is for BGS5T, but you can try.
Thanks Jure! It works fine now.
Looks like the ports need to be configured through I2C first before the pins can be initialised. Its a bit of a shame how I can't swap pin directions on the fly without the need to restart the module, unless there is another method.
I'll write what I typed in, incase someone has a similar problem:
To configure GPIO6, GPIO7 as Inputs
GPIO8 and GPIO11 as output.
The I2C commands are split into three sections
Prefix Address Direction
<aD4 13 01>
Address: The GPIO pin to be configured. Values are in Table 29 in I2C Commands in the Hardware Interface Description pdf.
Direction: 00 for input, 01 for output.
The terminal's level-shifters for GPIO pins must be configured as input or output before GPIO can be used. It is done only once.
After that the GPIO pins can be controlled by the module (AT commands or Java methods).
The single pin can be configured as input or output - it cannot be used as input and output at the same time.
General use case is that a single pin is used for controling of some hardware like LED blinking or reading a state of another hardware or ******** of pulses.
Could you describe your use case for switching the direction on the fly and using the pin as input and output at the same time?
I have moved to Java now.
What I meant by on the fly was that i was changing the hardware attached to the GPIO's frequently and was adding and removing pins on the module quite often. It was only a matter of convenience that an AT command or line of code could change the pin direction without configuring I2C commands and resetting the device.
I guess an example where direction switching is used within an application is on an alphanumeric LCD, one of the data pins can be switched to an input to read a busy flag.
It's not an issue for me though, my application is quite simple. I only want the device to send an SMS message on an input change, and output if im connected to a network or not :)
This i2c configuration is because of the extra hardware that is not part of the module but the terminal. If you would like to use just a module and your own hardware designed for your solution you could develope some other way of direction switching.
The terminal is universal and that's how it is designed. As far as I know for most of the usecases the hardware is connected permanently and not switched in the field.
I'm glad that for your application the terminal's functionality is sufficient.