ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Labview embedded module for ARM - bidirectional IO Ports

Solved!
Go to solution

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

0 Kudos
Message 1 of 5
(3,994 Views)

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

Message Edited by TorbenP on 01-15-2009 07:49 AM
0 Kudos
Message 2 of 5
(3,955 Views)
Solution

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

0 Kudos
Message 3 of 5
(3,945 Views)

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 🙂

 

Wouter.
"LabVIEW for ARM guru and bug destroyer"
0 Kudos
Message 4 of 5
(3,628 Views)

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

Wouter.
"LabVIEW for ARM guru and bug destroyer"
0 Kudos
Message 5 of 5
(3,495 Views)