Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 24 additions & 42 deletions src/arm/BBORG_SERVO-00A2.dts
Original file line number Diff line number Diff line change
Expand Up @@ -35,27 +35,27 @@

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add some comments above about the overall function and resources. I think I know now, but a summary in the comments would be nice.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure thing 👍

P9_19_pinmux { status = "disabled"; }; /* i2c2.scl */
P9_20_pinmux { status = "disabled"; }; /* i2c2.sda */
P8_10_pinmux { status = "disabled"; }; /* servo.enable */
P8_10_pinmux { status = "disabled"; }; /* pca9685.enable */
};

&am33xx_pinmux {

bborg_servo_input_pins: pinmux_bborg_servo_input_pins {
pinctrl-single,pins = <
BONE_P8_12 (PIN_OUTPUT_PULLDOWN | MUX_MODE7) /* P8_12: gpio1_12 */
BONE_P8_11 (PIN_OUTPUT_PULLDOWN | MUX_MODE7) /* P8_11: gpio1_13 */
BONE_P9_30 (PIN_OUTPUT_PULLDOWN | MUX_MODE7) /* P9_30: gpio3_16 */
BONE_P9_27 (PIN_OUTPUT_PULLDOWN | MUX_MODE7) /* P9_27: gpio3_19 */
BONE_P9_41 (PIN_OUTPUT_PULLDOWN | MUX_MODE7) /* P9_41: gpio3_20 */
BONE_P9_42 (PIN_OUTPUT_PULLDOWN | MUX_MODE7) /* P9_42: gpio0_7 */
BONE_P8_12 (PIN_INPUT_PULLDOWN | MUX_MODE7) /* P8_12: gpio1_12 */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are these pins for? I thought they were to configure the device. Shouldn't they be set to output GPIOs from the board and then set to properly configure the device?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these are the RC input pins.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But what do they do? I know I should know, but it really isn't clear to me. At first, I thought these were PWM inputs, but looking at the datasheet it seems these are just configuration pins.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They take input signal from a remote control, you shared a link on the group which shows different types of signals we may encounter from the receiver https://oscarliang.com/pwm-ppm-sbus-dsm2-dsmx-sumd-difference/. I asked others on the group and we agreed to have GPIO inputs here.

I think the main purpose is to take input from those RC receivers and control servos on a drone, car, plane, etc.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a flat-out misinterpretation and bad guess. Please check the datasheet https://www.nxp.com/docs/en/data-sheet/PCA9685.pdf.

BONE_P8_11 (PIN_INPUT_PULLDOWN | MUX_MODE7) /* P8_11: gpio1_13 */
BONE_P9_30 (PIN_INPUT_PULLDOWN | MUX_MODE7) /* P9_30: gpio3_16 */
BONE_P9_27 (PIN_INPUT_PULLDOWN | MUX_MODE7) /* P9_27: gpio3_19 */
BONE_P9_41 (PIN_INPUT_PULLDOWN | MUX_MODE7) /* P9_41: gpio3_20 */
BONE_P9_42 (PIN_INPUT_PULLDOWN | MUX_MODE7) /* P9_42: gpio0_7 */
>;
};


bborg_servo_pca9685_i2c_pins: bborg_servo_pca9685_i2c_pins {
bborg_servo_pca9685_i2c_pins: pinmux_bborg_servo_pca9685_i2c_pins {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does this bus need to be reconfigured? Cant the default configuration be used?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we can use the default I2C bus configuration. But, this will make sure the person using the cape sees the pins attached to the cape when he/she uses show-pins utility. There may be other benefits also :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess, but note that some of these capes are stackable. I2C2 is a shared resource for all capes and only a handful need to reconfigure those pins to be anything but the default I2C function.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are absolutely right, I forgot to take that into account.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you updated? I think you can add new commits to your pull request, even if it has been merged.

pinctrl-single,pins = <
BONE_P9_19 (PIN_OUTPUT_PULLDOWN | MUX_MODE3) /* P9_19: i2c2.scl */
BONE_P9_20 (PIN_OUTPUT_PULLDOWN | MUX_MODE3) /* P9_20: i2c2.sda */
BONE_P9_20 (SLEWCTRL_SLOW | PIN_INPUT_PULLUP | MUX_MODE3) /* P9_19: i2c2.sda */
BONE_P9_19 (SLEWCTRL_SLOW | PIN_INPUT_PULLUP | MUX_MODE3) /* P9_20: i2c2.scl */
>;
};

Expand All @@ -75,45 +75,27 @@
#address-cells = <1>;
#size-cells = <0>;

pca9685_servo: pca9685_serve@7f {
compatible = "nxp, pca9685";
pca: pca@70 {
compatible = "nxp,pca9685-pwm";
#pwm-cells = <16>;
reg = <0x70>;
lable = "pca9685_servo";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the correct spelling for 'lable'?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, it should be label 😂

pinctrl-names = "default";
pinctrl-0 = <&bborg_servo_pca9685_en_pins>;
enable-gpios = <&gpio2 4 GPIO_ACTIVE_HIGH>;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there or is there not an enable gpio? I'd think you'd need that.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is but we handle it separately not, I tried using it this way but I was not able to make it work out.

reg = <0x7f>;
/* invert; */
/* open-drain; */
};
};

&{/} {
gpio_inputs {
compatible = "gpio-keys";
leds {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this called leds?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was a different person back then, didn't knew as much as I know now. I will update this accordingly 👍

pinctrl-names = "default";
pinctrl-0 = <&bborg_servo_input_pins>;
pinctrl-0 = <&bborg_servo_pca9685_en_pins>;

input@1 {
lable = "in1";
gpios = <&gpio1 12 GPIO_ACTIVE_HIGH>;
};
input@2 {
lable = "in2";
gpios = <&gpio1 13 GPIO_ACTIVE_HIGH>;
};
input@3 {
lable = "in3";
gpios = <&gpio3 16 GPIO_ACTIVE_HIGH>;
};
input@4 {
lable = "in4";
gpios = <&gpio3 19 GPIO_ACTIVE_HIGH>;
};
input@5 {
lable = "in5";
gpios = <&gpio3 20 GPIO_ACTIVE_HIGH>;
};
input@6 {
lable = "in6";
gpios = <&gpio0 7 GPIO_ACTIVE_HIGH>;
compatible = "gpio-leds";

pca9685-enable {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just an enable GPIO, right? There's no real LED, is there? Would be good to clarify in the comments.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no there is not really any led on the cape, this pin control the PCA9685's enable pin.

label = "pca9685-enable";
gpios = <&gpio2 4 GPIO_ACTIVE_LOW>;
default-state = "on";
};
};
};