Shop OBEX P1 Docs P2 Docs Learn Events
Is there a Spin version of the Elev-8 Firmware? — Parallax Forums

Is there a Spin version of the Elev-8 Firmware?

I am really hedgy on the Elev-8. Mostly because of the firmware. I see that it is written in c++. Preferring Spin, is there an available Spin version of the firmware?

Comments

  • No, Spin is not fast enough to run the code used on the Elev-8.

    Mike
  • Okay, then. I guess I must venture into the world of c++. Thank you!
  • It should be possible to write an alternative Elev-8 flight controller firmware in Spin combined with a fixed-point vector coprocessor cog that does all the math via a script. I've wanted to do this for a while, but I still haven't even gotten around to getting my Elev-8 off the ground with the factory C++ firmware yet. Compared to the C++ version, a combined Spin/math coprocessor cog firmware should be faster (because the math cog would do all the heavy lifting, avoiding the overhead of Spin, and because fixed-point is faster than floating point) and should use less RAM (by eliminating the memory overhead that typically comes with PropGCC) and maybe fewer cogs.
  • If you look at the code you will see that there is a separate cog just to do the math. There is also a combination of Spin, C and assembly in it just to make things interesting. It takes some looking to see how the code all comes together.

    As far as I know there is no fixed point calculation to do Quaternions. Also you need to do Euler angles to determine orientation.

    It is possible to use a coprocessor chip to do this math and simplify some of the calculations such as BNO055 or EM7180.

    Still you will need assembly code or C code to do the SBUS or PPM input from the radio receiver not to mention the PWM for each motor output.

    Mike

  • ElectrodudeElectrodude Posts: 1,660
    edited 2019-06-25 14:11
    iseries wrote: »
    If you look at the code you will see that there is a separate cog just to do the math. There is also a combination of Spin, C and assembly in it just to make things interesting. It takes some looking to see how the code all comes together.

    As far as I know there is no fixed point calculation to do Quaternions. Also you need to do Euler angles to determine orientation.

    It is possible to use a coprocessor chip to do this math and simplify some of the calculations such as BNO055 or EM7180.

    Still you will need assembly code or C code to do the SBUS or PPM input from the radio receiver not to mention the PWM for each motor output.

    Mike

    When one speaks of writing something in Spin, it's implied that hardware drivers will be written in PASM and not Spin. So I'd mostly reuse all the same PWM, SBUS, PPM, serial, etc. drivers that are written in Spin/PASM that are used in the current firmware (although I vaguely remember that I had found a way to save a cog or two by combining some cogs). I'd just rewrite the main control code to Spin and the math code to a fixed-point vector math VM that runs in a cog. I already have a small collection of fixed-point multiplication routines that I would use as a starting point for the math coprocessor cog I would write, which would of course be able to do vectors, matrices, quaternions, Euler angles, and all other necessary math. An external coprocessor chip would be too complicated because it'd involve adding components to the board, whereas the Prop already has plenty of cogs, and you'd have tons of overhead communicating with it instead of just having a cog run a script.
Sign In or Register to comment.