Friday, July 15, 2016

CleanFlight port to PI Zero

Finally have MPU-9255 and MS5611 sensors working and a simple CLI on the command line.  It is simlar to CLI via serial port or CleanFlight configurator.

Here is the output:
Task list          max/us  avg/us rate/hz maxload avgload     total/ms
 0 -       SYSTEM      29       0       9    0.5%    0.5%         0
 1 -     GYRO/PID     748     145     848   63.9%   12.7%       743
 3 -       SERIAL      71       1      93    1.1%    0.5%         1
 5 -           RX       0       0   2147483647    0.5%    0.5%         0
Task list          max/us  avg/us rate/hz maxload avgload     total/ms
 0 -       SYSTEM      31       0       9    0.5%    0.5%         1
 1 -     GYRO/PID     886     176     801   71.4%   14.5%      5864
 3 -       SERIAL      73       1      88    1.1%    0.5%         9
 5 -           RX       0       0   2147483647    0.5%    0.5%         0

I'm going to switch to linenoise for controlling line processing to allow up and down errors etc. 

Need to fix how average is calculated, but making progress.  Need to reconnect the I/O processor to get GPS, pwm out, s.bus in, and S.Port.

The goal is to use socat where configurator is running to expose a virtual serial port and forward the packets to "LinuxFlight".

Still working on CPU performance and getting GPIO to trigger for gyro-sync.

Here is top:

Here is the CLI on the PI Zero:

The command line is using boost ASIO.  Goal is to add the socat protocol so configurator can still access and configure "LinuxFlight" ;)

Yes, I'm thinking of forking the code, due to the amount of changes to the core.  Right now, there are very minimal.

Sunday, July 10, 2016

Progress PI Zero Flight controller

I have BetaFlight ported to the PI Zero, but opted to move to CleanFlight due to the latest code check-in.  There are several APIs that are abstracted to make porting to Linux easier. The basic idea is to use LINUX #define to comment out micro-controller specific code and add XXX_linux.c drivers for SPI, I2C, serial, pwm, etc.   Still going to stick with boost ASIO for scheduler, still based on timers (timerfd). 

The SPI communication to the GD32F1 is progressing:
  • GPS handling, moved baud rate, GPS update rate to GD32F1
  • Simplifies command/processing and speed
  • Working on PWM decoding (PPM/PWM)
  • Working PWM encoding 4 outputs

Have SPI working with MPU-9255 at 8Mhz from the PI Zero.  

Still pending:
  • Cannot find any more "red" GD32F103 board might have to move to another board
  • Transmitter
    • Turnigry 9xr pro?
    • Radiolink at 10
      • The main difference between the two are:
        • Telemetry s.bus vs i2C 
        • Have to buy another receiver Radiolink to have s.bus and i2c telemetry (R9DS) which is another $13.
        • Radiolink is not open source but many ports and docs on decoding i2c for telemetry. 
        • Radiolink has sliders 9xr pro does not
        • HK shipping costs and pricing changes. 
        • Thoughts?