Forum Rule: Always post complete source code & details to reproduce any issue!
Page 5 of 5 FirstFirst ... 3 4 5
Results 101 to 111 of 111

Thread: Arduino RC library

  1. #101
    Sorry, no. My skills are not enough. I disabled all timer-stuff and got it working without. timer is only used for looping in the code and not to build the signal. So you will find also a way without useing it.

  2. #102
    Just putting the sbus.process() call in the loop does not compile. I assume you made some changes to the SBUS library itself ? Could you share that with us ? Also, it might be possible to use the Interval Timer function to fire the sbus.process() function at periodic intervals.

  3. #103
    Hey. I got this to work - just comment out the timer code in sbus.cpp and change the serial call to SERIAL_8N2_RXINV_TXINV. Nice ! Works in the loop - now to try using intervaltimer.

  4. #104
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Traditionally, doing I/O inside interrupt routines has been risky.

    In recent Teensyduino vesions, I've put work into (hopefully) avoiding deadlock conditions, even if you try to send and/or receive inside interrupts. The ultimate goal is to have all cases "just work", you can use easy Arduino-style coding anywhere. But there are a lot of possible cases to consider, so I can't be certain they all work flawlessly. If you do find a situation where code using Serial1, Serial2 or Serial3 should work but doesn't, please save a copy and try to make a reproducible test case.

    Something to be consider is interrupt priorities. On Teensy 3.1, the interrupt controller supports up to 16 priority nested interrupts. Lower numbers are higher priority, where some interrupts can interrupt others, if they're assigned a higher priority. So if your interrupt code runs at priority 128 (which is the default), and some other low priority interrupt happens (like the audio library which defaults to 255 for the time-consuming stuff), it will not be able to interrupt yours. But Serial1 defaults to priority 64, so it'll get to interrupt yours. Ideally, your serial I/O should "just work", regardless of whether your interrupt is a higher or lower priority. The newer serial code tries to check for all possible cases, but of course if your interrupt is at a higher priority and you wait for I/O, you'll stall other stuff. That's your design decision.

    Starting with 1.20, IntervalTimer supports a priority(num) function. I've just updated the web page.

    If you run into deadlocks, where your code seems to mysteriously crash, you might try increasing or decreasing the priority level. Of course, also save a copy if it's reproducible. I want to fix and problems, and I usually can when they're reproducible.

  5. #105
    IntervalTimer seems to work ok with reading the SBUS in serial1 . Really pleased with SBUS handling - including get rid of the hardware inverter ! Threw all the useless Arduino DUEs into the garbage.

  6. #106
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Great news.

    I hope you'll consider posting some info about the project and how to use SBUS, maybe a blog? I've never used SBUS, so there's not much I can do to help anyone, beyond trying to provide a solid hardware serial library.

  7. #107
    Junior Member
    Join Date
    Mar 2014
    Nice project whimsical,

    i am also working on a diy transmiter. I built mine entirely from scratch.

    Click image for larger version. 

Name:	IMG_2293.jpg 
Views:	260 
Size:	98.3 KB 
ID:	2867

    more info here:

    Share info when are are done, good luck


  8. #108
    Junior Member
    Join Date
    Dec 2014
    Hello everyone... im new to teensy, and notbso new with arduino (not and expert neither)... Trying PulsePosition found something that limit my project... i want to receive in teensy one PPM signal from a RC receiver, then output two PPM signals and 6 other PWM signals (bl motors with a 490hz PWM control)... But face some frequency problems... pulsePosition uses timer 0, which is used for PWM on 8 pins... And when it is activated, the other pins frequency change from nearly 490hz to something lower... So I ask for a direction if there is possible to change somehow PulsePosition for:
    Option 1 - change timer operation so I can use along analogWrite on other PWM pins with Timer0 at 490hz... Or
    Option 2 - change behavior of PulsePosition so it can be used in other PWM pins (timer 1 and/or 2 pins 3, 4, etc.)...?

    Just want to know which one looks easier to implement and if someone knows how, will very usefull some guidelines...

    Thank you.

  9. #109
    Quote Originally Posted by PaulStoffregen View Post
    There is no option for 8E2 on the Teensy 3.1 hardware.

    You could try 8E1 and hope it works. Or you could use 8E1 and transmit the data 1 byte at a time with extra delays.
    Hi Paul
    The reading of S.BUS was good, I could connect with 8E1 and 8N2. I was also able to send data. Till today, I used sending only for test and to understand how it works. So I sent it to another serial. And the second serial showed the same data.

    Now I like to change my planes to use also S.BUS Servos. If I connect them directly to the RX, they work. If I connect them to the TX-Pin - they don't.

    I imagine now, it is because I can't use 8E2. Is there a way to change it? What is the Idea ot adding time to data 1 byte? Can you tell me more?

    Enclosed all my test-code


  10. #110
    Junior Member
    Join Date
    Feb 2015
    is there a library to drive a sbus servo? I need to send sbus signal to dji naza. I need a sbus signal inverter for output too?

  11. #111
    Junior Member
    Join Date
    Nov 2015
    Quote Originally Posted by whimsical View Post
    These fill the TX case. Bugger
    Hi PaulStoffregen and whimsical,

    First of all, great work you have done here.
    After spending a few days hitting my head, while learning Arduino and trying to circumvent the limited timer functions in Arduino Pro mini, I found this thread my mere accident. Quite an improvement from my own (failed) attempts of linking two ProMini together with I2C...

    I can't believe I haven't considered the Teensy for my own project - an almost exact replica of this - before now, even though I already have two UAVs using Teensy 3.1 to translate MavLink telemetry to FrSky.

    Out of curiosity and stupidity, I do have a small question for you:
    Why add the LED's for FC mode, when you can have that same info in the display?
    I currently use the display + speech + confirmation by speech via telemetry + OSD
    (Overkill - I know, but I don't always use goggles or even FPV)

    I was considering designing a 3D printed "extension box" and mount it to the back of Taranis using M2/M3 brass knurl nuts melted into the case - maybe connected by pogo pins.
    This would also house my 6 flight mode buttons and additional connectors for external "slave" PPM sources.
    (I would think that by having 3 buttons in each side, they can be operated in the blind - without releasing the grip on the TX).

    Such a "box-mod" would also allow for a somewhat easy switch between different boxes "in the field" or even have room for additional components.

    Knurl nuts like these, although the ones I use to hold Taranis together are in the M2 version, replacing the stock, self-tapping skrews:

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts