01-08-2009 09:55 AM
I want to connect a Sensirion Sensor with a proprietary bus protocol to the Luminary 3S8962 Eval Board. The sensor should be connected to the same Pins as teh I2C interface. My main Problem now is, how do I configure a general purpose IO (i.e. GPIO-PB3) as bidirectional port? The slave sensor pulls the data line low to acknowledge the reception of the message. I have to read this into my VI. But when I configure the IO as output I cannot use it as input any longer.
Thanks for any help,
Philip
Solved! Go to Solution.
01-15-2009 07:48 AM - edited 01-15-2009 07:49 AM
Hi Philip,
as far as I can see it, the GPIO ports cannot be configured as being biderectional ports. I have looked into the datasheet of the evaluation board and there it is written that they can be configured as input or output:
http://www.luminarymicro.com/index.php?option=com_remository&func=download&id=523&chk=869ea8c950d8cd31b7f729bcf52bbf9b&Itemid=591
In chapter 9.1.1.1 "Data Direction Operation" ( "General-Purpose Input/Outputs (GPIO) " ) it is written:
"The GPIO Direction (GPIODIR) register ... is used to configure each individual pin as an input and an output."
Why do you think they can be used as bidirectional ports ? I think you have to change the direction programmatically or you have to use a second input in order to recognize the pulled down data line.
Regards,
Torben
01-16-2009 01:10 AM
Hello Torben,
that was my question, how can I program the pin direction. When I use a elemental node for a single pin, that is not possible as I understood it now because I can use a single pin either as input or as output in one VI. But I meanwhile found out, that if i use the whole port, it is possible to use an elemental I/O for input and another one for output in the same VI. This way I can "and" or "or" the bits to set and clear single pins and I can read them in the same VI.
Anyway, thanks for your effort,
Philip
03-16-2010 03:44 AM
Go to tools > ARM tools > Elemental I/O wizard,
Load the target. (ex. Targets\Keil\Embedded\RealView\EK-LM3S8962\eio\eio.xml)
The resources are good, but they are attached to "pins".
this is just a reservation.
when you're on the page "Assign the pins to resources",
select your resource and remove the pin that is assigned. (ex. GPIO_IN_B4 and GPIO_OUT_B4)
Generate the stuff 2 pages further, restart LabVIEW et voila!
you can now use the GPIO_IN_B4 and GPIO_OUT_B4 at the same time.
try it with a LED.. but make sure you have enough time between the write and read of the pin (1000 ms or so..)
you see the result 🙂
07-06-2010 06:39 AM
By the way, also manually set the io pins as input or output in an inline c-node before using them.
for the lm3s8962:
set as output:
GPIODirModeSet(GPIO_PORTC_BASE,GPIO_PIN_4|GPIO_PIN_5|GPIO_PIN_6|GPIO_PIN_7,GPIO_DIR_MODE_OUT);
GPIODirModeSet(GPIO_PORTE_BASE,GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3,GPIO_DIR_MODE_OUT);
set as input:
GPIODirModeSet(GPIO_PORTC_BASE,GPIO_PIN_4|GPIO_PIN_5|GPIO_PIN_6|GPIO_PIN_7,GPIO_DIR_MODE_IN);
GPIODirModeSet(GPIO_PORTE_BASE,GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3,GPIO_DIR_MODE_IN);
use the port and pins you need..and also include the lm3sxxxx.h file to the inline c-node