Pixhawk - Enabling GPIO output

Hello,

I’ve been able to control all FMU GPIO pins successfully, but I was wondering if its possible to control the GPIO pins for the IO processor (px4io). I’m using V6C hardware and I’m getting an error when I’m trying to use these pins.

Here’s what I’ve done:

I’ve added this definitions in boards/px4/io-v2/src/board_config.h to make it more readable:

#define IO_CH1 GPIO_PWM1
#define IO_CH2 GPIO_PWM2
#define IO_CH3 GPIO_PWM3
#define IO_CH4 GPIO_PWM4
#define IO_CH5 GPIO_PWM5
#define IO_CH6 GPIO_PWM6
#define IO_CH7 GPIO_PWM7
#define IO_CH8 GPIO_PWM8

I tried to include board_config for the io processor in the iridium module:

#include <boards/px4/io-v2/src/board_config.h>

This is where I’m getting the error when I’m trying to build:

I’ve added the configgpio in main:

	px4_arch_configgpio(FMU_CH1);
	px4_arch_configgpio(FMU_CH2);
	px4_arch_configgpio(IO_CH1);

Then since I’m playing with the iridium driver I added a toggle like feature in one of the function:

        px4_arch_gpiowrite(FMU_CH1, 1);
	px4_usleep(2000000);
	px4_arch_gpiowrite(FMU_CH1, 0);

	px4_arch_gpiowrite(FMU_CH2, 1);
	px4_usleep(1000000);
	px4_arch_gpiowrite(FMU_CH2, 0);

	px4_arch_gpiowrite(IO_CH1, 1);
	px4_usleep(10000);
	px4_arch_gpiowrite(IO_CH1, 0);

You can see my code for FMU_CH1 and CH2 that was working quite well:

image

1 Like