Forums - Output Signal

6 posts / 0 new
Last post
Output Signal
aic35
Join Date: 12 Jul 17
Posts: 6
Posted: Wed, 2017-09-20 11:43

Is there an easy output a single singal to control? I have a spectrum reciver (SPM9645) wired into the flight but I am looking for a way to control just one signal outpput from the board.  

  • Up0
  • Down0
drone_guy
Join Date: 14 Nov 16
Posts: 37
Posted: Thu, 2017-09-21 11:39

aic35, are you trying to do the following? :

- receive data from Spektrum receiver

- have some logic to determine when a special condition occurs (change in position of switch or knob on Spektrum Transmitter)

- change state of GPIO based on your condition

Please confirm or clarify...

  • Up0
  • Down0
aic35
Join Date: 12 Jul 17
Posts: 6
Posted: Thu, 2017-09-21 13:28

Drone_guy, Thanks. 

I am trying to change the state of GPIO based on my condition. Also I would love to have some logic to determin when a special condtion controls. So I I flip a switch on the controller it would send a signal as an output from the board. 

Thanks again. 

  • Up0
  • Down0
Re: Output Signal Best Answer
drone_guy
Join Date: 14 Nov 16
Posts: 37
Posted: Thu, 2017-09-21 22:08

If you use Snapdragon Navigator flight stack, you can read the RC channel values from Application Processor using the SNAV API. Then in order to toggle GPIO, you will need to write a simple application to call into DSP and control GPIO. More on this in this topic : https://developer.qualcomm.com/forum/qdn-forums/hardware/snapdragon-flig...

I don't think that you can control GPIO directly from Aplication Processor without remapping something in the low-level subsystem, but I will check.

Alex K

  • Up0
  • Down0
drone_guy
Join Date: 14 Nov 16
Posts: 37
Posted: Tue, 2017-09-26 09:57

Good news!

There is a way to control GPIO from the Applicaiton Processor. You just need to make sure that those pins you are trying to control is not used by anything else (like DSP). 

Prerequisites (review these):

https://developer.qualcomm.com/hardware/snapdragon-flight/board-pin-outs

https://docs.px4.io/en/flight_controller/snapdragon_flight.html

http://support.intrinsyc.com/documents/130 (board schematics)

 

Details:

Here is how to set up and control GPIO30 pin, which is the pin #6 on the 6-pin Hirose connector (J13):

(bash script)

#set up the pin

if [ ! -d /sys/class/gpio/gpio30 ]; then
    echo 30 > /sys/class/gpio/export
fi
echo 30 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio30/direction
 
#control the pin (1 sets it high, 0 sets it low)
echo 1 > /sys/class/gpio/gpio30/value
echo 0 > /sys/class/gpio/gpio30/value

 

Things to watch out for:

By default, Snapdragon Navigator (and PX4) are set up to use UART on J13 in 4-wire mode, which means that DSP will control all 4 GPIO on J13, preventing Application Processor from controling Pin30. To solve, this, add a custom blsp.config as described here : https://docs.px4.io/en/flight_controller/snapdragon_flight.html  -- this will use the same port mapping as the default configuration, but put all UARTs in 2-wire mode, allowing the use of two other pins on the same BLSP as GPIO. 

Side note: 4W uart is in general also a problem if you use i2c on the same connector (in certain conditions). If I2C is initialized first and then 4W uart is initialized (on the same BLSP/connector) then 4W uart will disable I2C. Solution is either to put all uarts in 2-wire mode or open I2C port after UART port (latter is more like a hack).

 

So, to implement the complete solution for using RC with Snapdragon Navigator to toggle GPIO based on state of RC values:

  • * identify the GPIO pin that you would like to use (pins 29 or 30 are probably good, since they are unused by default)
  • * make sure that DSP is not conflicting with those pins (may need to put UARTs in 2-wire mode)
  • * initialize the GPIO on Application process after the system boots ("#set up the pin" part from above) 
  • * use Snapdragon Navigator API to get RC data to Application Processor (see Snapdragon Navigator documentation and API examples)
  • * implement some logic for determining when to turn the pin high or low based on RC data
  • * from within the same C/C++ application that gets the RC data, you can make a system call to control the pin - depending on how you do it it may block for some time, so just keep that in mind.

 

I hope this helps..

Alex K

 

  • Up0
  • Down0
aic35
Join Date: 12 Jul 17
Posts: 6
Posted: Fri, 2017-09-29 10:46

Thank You Alex K. 

I test it out and keep you posted. 

Thanks again. 

  • Up0
  • Down0
or Register

Opinions expressed in the content posted here are the personal opinions of the original authors, and do not necessarily reflect those of Qualcomm Incorporated or its subsidiaries (“Qualcomm”). The content is provided for informational purposes only and is not meant to be an endorsement or representation by Qualcomm or any other party. This site may also provide links or references to non-Qualcomm sites and resources. Qualcomm makes no representations, warranties, or other commitments whatsoever about any non-Qualcomm sites or third-party resources that may be referenced, accessible from, or linked to this site.