gpioExpanderService with MangOH Red


#1

Hello,

I would like to use the gpioExpanderService with the MangOH RED.

In the MangOH.sdef I can see the gpioExpanderService is removed from build with this explanation.

Is it possible to use it or not ?

Thanks

/*
 * There is a conflict between the following software components:
 *  - sx1509 Linux kernel driver
 *  - mangOH GPIO expander service
 *  - gpioexp command line program
 * All of these components attempt to control the sx1509 GPIO expander on mangOH Red. The sx1509
 * driver is required for other kernel modules such as the iot slot driver and the LED driver to
 * manipulate the GPIOs. The mangOH GPIO expander service is a userspace driver for the SX1509
 * which provides a service conforming to le_gpio.api to access the GPIOs of the sx1509 from
 * Legato apps. gpioexp is also a userspace command line program which can control the sx1509.
 * This program is called from the /etc/init.d/tiwifi provided by the Sierra Wireless Linux
 * distro in order to setup GPIOs to use the TI WiFi IoT card (without the iot slot module). The
 * fundamental problem is that the gpiolib implementation in the Sierra Wireless kernels doesn't
 * support accessing GPIOs from userspace through sysfs if they are not listed in the kernel at
 * build time.
 */
// $MANGOH_ROOT/apps/GpioExpander/gpioExpanderService/gpioExpanderServiceRed

#2

I uncomment the line and it works fine.

I use the push button and the Gpio_ext_rpi1 / 2 / 3.

Good !


#3

Hi Francis,

Can you share the code accessing gpio_exp_rpi_ ?
Looks still incorrect bindings in mine.

Drive CF3 GPIO is fine, but not for GPIO Expander.

Thanks!


#4

Hello

I think you will find a example in the MangOH folder (apps I think).

I will try to provide source code tomorrow.

BR
Francis


#5

Modify your MangOH.sdef file to enable gpioExpander

apps:
{
#if ${MANGOH_BOARD} = RED
$MANGOH_ROOT/apps/GpioExpander/gpioExpanderService/gpioExpanderServiceRed
#endif
}

rebuild the mangoh red (example for WP76 module):

  • cd mangOH
  • cfglegato
  • make clean
  • make red_wp76xx

flash the update file to the board.

Go to your legato project.

  1. add binding in your .adef file (example)

executables:
{
myapp = ( myappComponent )
}
bindings:
{
myapp.myappComponent.mgred_exp_LED1 -> gpioExpanderServiceRed.mangoh_gpioExpPin3
}

  1. add in your .cdef

requires:
{
api:
{
mgred_exp_LED1 = le_gpio.api
}
}

  1. now in your in your source code:

bool LedOn;

void ConfigureGpios(void)
{
// Set LED to output and initially turn the LED ON
LE_FATAL_IF(
mgred_exp_LED1_SetPushPullOutput(MGRED_EXP_LED1_ACTIVE_LOW, true) != LE_OK,
“Couldn’t configure LED1 as a push pull output”);
mgred_exp_LED1_Activate();
}

void event_led_timer (void)
{
// example to blink LED
LedOn ^= 1;
if (LedOn) {
mgred_exp_LED1_Activate();
}
else {
mgred_exp_LED1_Deactivate();
}
}

Hope this help.
BR

Francis


#6

You can find sample code in the VM located to :

mangOH/apps /GpioExpander/gpioExpanderDemo


#7

Hi,

I checked in app status the gpioexpanderservice is stopped, tried to start but failed with error.

I plan to rebuild the gpioexpanderservice and update to the module. Will inform the result…

Best Regards,


#8

Do you use another GPIO than gpioExpander ?
I use only the gpioExpander( not the WP gpio).

What WP do you use ?
I have not tested with WP8548 (only with WP7607 / WP7603).

In the mangOH.sdef I can see :

/*
* There is a conflict between the following software components:
* - sx1509 Linux kernel driver
* - mangOH GPIO expander service
* - gpioexp command line program
* All of these components attempt to control the sx1509 GPIO expander on mangOH Red. The sx1509
* driver is required for other kernel modules such as the iot slot driver and the LED driver to
* manipulate the GPIOs. The mangOH GPIO expander service is a userspace driver for the SX1509
* which provides a service conforming to le_gpio.api to access the GPIOs of the sx1509 from
* Legato apps. gpioexp is also a userspace command line program which can control the sx1509.
* This program is called from the /etc/init.d/tiwifi provided by the Sierra Wireless Linux
* distro in order to setup GPIOs to use the TI WiFi IoT card (without the iot slot module). The
* fundamental problem is that the gpiolib implementation in the Sierra Wireless kernels doesn’t
* support accessing GPIOs from userspace through sysfs if they are not listed in the kernel at
* build time.
*/