Saturday, September 24, 2016

OrangePI PC with 4.8.x using buildroot

Finally got some time to get back to testing OrangePI-PC as a Flight Controller board.  The OrangePI-PC offers several advantages over the Pi Zero:
  • Multiple serial ports (3) 
  • Multiple USB ports (each have port has its own controller not a Hub)
  • Camera (Still working on that)
  • Cost is low around $12

I'm using standard buildroot with the orangePI defconfig, but using a different Linux kernel which has several patches for Ethernet, USB (slave), and thermal control (Which is big).   Using orange-pi-4.8 branch.

Also made a couple of code changes:
  • spidev 
static const struct of_device_id spidev_dt_ids[] = {
    { .compatible = "rohm,dh2228fv" },
    { .compatible = "lineartechnology,ltc2488" },
        { .compatible = "spidev" },

  • device tree: 
    • sun8i-h3-orangepi-pc.dts:
        spi0_pins_a: spi0@0 {
                allwinner,pins = "PC0", "PC1", "PC2";
                allwinner,function = "spi0";
                allwinner,drive = <SUN4I_PINCTRL_10_MA>;
                allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
            };

    spi0_cs0_pins_a: spi0_cs0@0 {
                allwinner,pins = "PC3";
                allwinner,function = "spi0";
                allwinner,drive = <SUN4I_PINCTRL_10_MA>;
                allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
            };
           
        i2c0_pins_a: i2c0@0 {
        allwinner,pins = "PA11", "PA12";
            allwinner,function = "i2c0";
            allwinner,drive = <SUN4I_PINCTRL_10_MA>;
            allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
        };

.....
&spi0 {
    pinctrl-names = "default";
    pinctrl-0 = <&spi0_pins_a>, <&spi0_cs0_pins_a>;
    status = "okay";
        spidev0: spidev@0 {
                #address-cells = <1>;
            #size-cells = <0>;
            compatible = "spidev";
        reg = <0>;
        spi-max-frequency = <50000000>;
        };
};

&i2c0 {
    pinctrl-names = "default";
    pinctrl-0 = <&i2c0_pins_a>;
    status = "okay";
}; 

      • sun8i-h3.dtsi
        spi0: spi@01c68000 {
            compatible = "allwinner,sun6i-a31-spi";
            reg = <0x01c68000 0x1000>;
            interrupts = <GIC_SPI 65 IRQ_TYPE_LEVEL_HIGH>;
            clocks = <&ccu CLK_BUS_SPI0>, <&ccu CLK_SPI0>;
            clock-names= "ahb", "mod";
            resets = <&ccu RST_BUS_SPI0>;
            dmas = <&dma 23>, <&dma 23>;
            dma-names = "rx", "tx";
            status = "disabled";
            #address-cells = <1>;
            #size-cells = <0>;
        };
       
        i2c0: i2c@01c2ac00 {
            compatible = "allwinner,sun6i-a31-i2c";
            reg = <0x01c2ac00 0x400>;
            interrupts = <GIC_SPI 6 IRQ_TYPE_LEVEL_HIGH>;
            clocks = <&ccu CLK_BUS_I2C0>;
            resets = <&ccu  RST_BUS_I2C0>;
            status = "disabled";
            #address-cells = <1>;
           
#size-cells = <0>;
        };
So, this adds a SPI interface and another I2C.

Next is to do some testing with SPI and I2C.

Also, still adding code to CleanFlight port to Linux.   Please post if you have any questions. 

Sunday, September 11, 2016

Cleanflight Fork

Finally had time to create a github project for CleanFlight fork.  Over the next few weeks will post changes to allow CleanFlight to compile on Linux . 

There are a couple targets:
  • PC - Allows CleanFlight to run on a PC and connect to a I/O processor
    • Helps in debugging and test with CleanFlight configurator
  • PI Zero
    • Connected a powered USB hub to the PI
      • Connected WIFI dongle
      • Connect I/O processor
  • Orange PI
    • Still working/waiting for some fixes to mainline, but will push forward with the basic camera.
Right now, working on creating a I/O processor board.  This will be a simple perf board wired up by hand.  The reason for doing this, simple and cheap.  The following sensors will be supported
  • GPS
  • Compass
  • PWM In for RC
  • PWM out to motors
  •  USB

The board for the PI Zero will also be a perf board.  But, it will use machine pin headers to keep the profile low.  This board will have just two sensors: