sbus control of pins

This forum is dedicated to all issues and questions related to your individual setups and configurations
Post Reply
Arakon
Posts: 196
Joined: Thu Jul 17, 2014 2:22 pm

sbus control of pins

Post by Arakon »

I'm trying to set up an sbus receiver (OrangeRX DSMX3, 3 normal channels, 1 14 channel sbus output) to also handle things like a video switcher (uses pwm signals to determine camera 1, 2 or 3 for high/mid/low), and camera gimbal pitch (setting gimbal to point downwards, angled or straight forward).
Is it possible to define a pin on the atmega 2560 (in my case a Crius AIOP 1.1) to basically pass on the channel data as if those pins were a standard receiver pwm output?

User avatar
haydent
Posts: 583
Joined: Sun Jun 17, 2012 1:35 am
Location: NSW, AU

Re: sbus control of pins

Post by haydent »

the number of users that have asked this i have noted, and it would be simple to do. i could make it. but someone else i was talking to about it, said that on the x8r rx and maybe yours too, while the sbus was being used you could still use the standard pwm outputs for other things, like the switcher. can you check this ?

User avatar
haydent
Posts: 583
Joined: Sun Jun 17, 2012 1:35 am
Location: NSW, AU

Re: sbus control of pins

Post by haydent »

ok here is a quick mod that enables 3 rx channels (in this case 9, 10 & 11) to be output on pwm outputs camroll, campitch & camtrig.

as such it is incompatible with using SERVO_MIX_TILT, SERVO_TILT or CAMTRIG config.h options (though the output pins could be changed to unused motor outputs if needed)

Firstly add the following code to your Config.h:

Code: Select all

      #define RXPASSTHRU //enable/disable channels 9, 10, 11 output on camroll, campitch & camtrig pins
      /* The following 3 defines are put here for convenience instead of def.h */
      #if defined(RXPASSTHRU)
          #define SERVO
          #define SEC_SERVO_FROM   1 // use servo from 1 to 3
          #define SEC_SERVO_TO     3
      #endif


Lastly in Output.cpp:

just before:

Code: Select all

  /****************                compensate the Motors values                ******************/
  #ifdef VOLTAGEDROP_COMPENSATION


add:

Code: Select all

  /****************                    RX PASS THROUGH                ******************/
  #if defined(RXPASSTHRU)
    servo[0] = rcData[8]; //channel 9
    servo[1] = rcData[9]; //channel 10
    servo[2] = rcData[10]; //cahnnel 11
  #endif

Arakon
Posts: 196
Joined: Thu Jul 17, 2014 2:22 pm

Re: sbus control of pins

Post by Arakon »

Awesome, I'll give that a try as soon as the receiver arrives here.. unfortunately, it's still on the way.
And yes, the standard PWM outputs are supposed to work, but they're on channels 1, 2 and 3 unfortunately, not added to the end.

Arakon
Posts: 196
Joined: Thu Jul 17, 2014 2:22 pm

Re: sbus control of pins

Post by Arakon »

This doesn't seem to work. I get no compilation errors, but also no function.. even though multiwii wingui displays Aux 5&6 as working and switching properly.
Edit: Works now. #define DISABLE_SERVOS_WHEN_UNARMED had to be commented out. Thanks!

User avatar
haydent
Posts: 583
Joined: Sun Jun 17, 2012 1:35 am
Location: NSW, AU

Re: sbus control of pins

Post by haydent »

yes, this mod will not work with any servo code, stock works for me

Arakon
Posts: 196
Joined: Thu Jul 17, 2014 2:22 pm

Re: sbus control of pins

Post by Arakon »

Could you also please post the code to use unused motor output pins? Thank you.

User avatar
haydent
Posts: 583
Joined: Sun Jun 17, 2012 1:35 am
Location: NSW, AU

Re: sbus control of pins

Post by haydent »

Arakon wrote:Could you also please post the code to use unused motor output pins? Thank you.


would be a little bit trickier, but could be done, though i kinda dont have time, why cant you use servo outputs ?

Arakon
Posts: 196
Joined: Thu Jul 17, 2014 2:22 pm

Re: sbus control of pins

Post by Arakon »

Not a problem then, I didn't realize it would be more complicated than just modifying the output pins in the code you posted.
I can use the servo outputs, but someone else with the same issue asked about this on another forum, and they have the servo outputs in use for a gimbal.

User avatar
haydent
Posts: 583
Joined: Sun Jun 17, 2012 1:35 am
Location: NSW, AU

Re: sbus control of pins

Post by haydent »

yeah, thats a possibility. but it would be a matter of enabling the extra motor pins with their timers perhaps by the number of motors config variable, but then you need to stop mw manipulating them for stability/trust

Post Reply