-
Notifications
You must be signed in to change notification settings - Fork 176
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix BBB servo cape overlay #174
base: master
Are you sure you want to change the base?
Conversation
The DT overlay only creates this file linux/Documentation/devicetree/bindings/pwm/nxp,pca9685-pwm.txt says The index 16 is the ALL CALL channel, that sets all PWM channels at the same time. but what index is that? |
Hello, @lorforlinux , How can I use this overlay w/ the ServoCape? Seth |
Hi,
Note: $ -> normal user command, # -> superuser command. Also, plug in your cape before rebooting your board to load the overlay automatically during boot. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to see a few more comments to clarify what is going on here and what the input pins are used for and how they should be set.
src/arm/BBORG_SERVO-00A2.dts
Outdated
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 */ |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
src/arm/BBORG_SERVO-00A2.dts
Outdated
>; | ||
}; | ||
|
||
|
||
bborg_servo_pca9685_i2c_pins: bborg_servo_pca9685_i2c_pins { | ||
bborg_servo_pca9685_i2c_pins: pinmux_bborg_servo_pca9685_i2c_pins { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 :)
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
src/arm/BBORG_SERVO-00A2.dts
Outdated
pca: pca@70 { | ||
compatible = "nxp,pca9685-pwm"; | ||
#pwm-cells = <16>; | ||
reg = <0x70>; | ||
lable = "pca9685_servo"; |
There was a problem hiding this comment.
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'?
There was a problem hiding this comment.
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
😂
lable = "pca9685_servo"; | ||
pinctrl-names = "default"; | ||
pinctrl-0 = <&bborg_servo_pca9685_en_pins>; | ||
enable-gpios = <&gpio2 4 GPIO_ACTIVE_HIGH>; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
}; | ||
}; | ||
|
||
&{/} { | ||
gpio_inputs { | ||
compatible = "gpio-keys"; | ||
leds { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 👍
@@ -35,27 +35,27 @@ | |||
|
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure thing 👍
src/arm/BBORG_SERVO-00A2.dts
Outdated
gpios = <&gpio0 7 GPIO_ACTIVE_HIGH>; | ||
compatible = "gpio-leds"; | ||
|
||
pca9685-enable { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
Hello, Thank you. I will test it. Once the overlay is loaded onto the board, my BBBW, do I need to have already composed source or can I use this overlay as a base? Seth P.S. As you can tell, I am a bit new still. So, any help would be greatly appreciated. If not, that is okay too. |
@silver2row can you please explain a bit more what do you mean by this
|
Yes sir...here is some background. When I first joined to learn about bbb.io, the boards, linux, and relative info, I was caught in b/t 2015. 2015 was a year of change. Books were ending for the BBB.io peoples and uboot was being introduced. So, the overlay scheme was changing. ... W/ the Cape attached, would I use the GPIO pins or PWM pins or i2c communication for use w/ this specific Cape? Somewhere along the lines, I purchased this Cape and I have not been able to use it just yet. If this is not your job and it is too much work on your end, that is okay. I understand. So, I guess I am trying to figure out if the Cape's overlay, the one you made, has me use GPIO, i2c, or PWM for making the servos move. Seth P.S. Sorry for the long explanation. |
@silver2row No problemo :) After following the above steps see if the cape is successfully loaded, you can check that by going to Now you go to this directory After doing that you have to set period and duty cycle for that PWM pin
now enable the output by running this
You'll see the servo moving, try changing the duty cycle now by running
You can check out this library for easier use https://github.com/adafruit/Adafruit_Python_PCA9685/ This might also be helpful for you http://www.civrays.com/beaglebone/tutorials/pca9685 |
Hello Sir, Thank you. I will test this later today. Seth P.S. I will check the address and look for the files in my system. I will check that last link, too! Thank you, again! |
Should we add symlinks for these capes to make interfaces easier to find for users? |
Hello, Order one: I think there is something faulty going on. No offense. It is most likely on my side. ... I followed the instructions, rebooted, and then found my make .dtbo file in /proc/device-tree/chosen/overlays/ but I have three files in /sys/bus/i2c/drivers/pca9685-pwm/ which are:
Seth |
@jadonk Yes we should use symlinks, I will try it out today :) |
@silver2row I will update the overlay ASAP to make it easier for you and other future users to follow :) |
Okay. Thank you. I tried to use your instructions on how to use it. I failed somehow. Anyway, I will keep an eye out. Oh and I always thought we just put the .dtbo file in /boot/uEnv.txt and reboot. Is this still true? Seth |
@silver2row Did you applied power through the terminal block where this is specified -> |
Hello...yes. @lorforlinux I am using the sys_5v power supply from the BBBW to the 5v IN MAX portion on the ServoCape. When I boot the board w/ the Cape attached, the servo indeed moves but not by my command in That file location does not exist on my board for some reason. I think 2-0070 on my board is located at another location: Oh! I forgot to mention something...
Just to reiterate, the servo shows signs of moving, does move, when I power on the board w/ the Cape attached and the standard servo in S1. |
@jadonk This overlay is final as it gets, for now! I will make /bone/bus changes after I test the buses through virtual capes.
There will be
I have written a blog post to test the servo cape on a BBB, which will help users to test the cape easily. If you are happy with the work done here please merge the changes :) |
Hello @lorforlinux , Thank you, sir. I tested it and it works for me. I cannot thank you enough. Seth |
This overlay is using the new compatibility code from beagleboard/BeagleBoard-DeviceTrees#17
The overlay has been updated to work on both BBB and BBAI. It requires the compatibility code from beagleboard/BeagleBoard-DeviceTrees#17 to work correctly. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not seeing updates or resolution. Is there somewhere else I should be looking?
src/arm/BBORG_SERVO-00A2.dts
Outdated
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 */ |
There was a problem hiding this comment.
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.
src/arm/BBORG_SERVO-00A2.dts
Outdated
>; | ||
}; | ||
|
||
|
||
bborg_servo_pca9685_i2c_pins: bborg_servo_pca9685_i2c_pins { | ||
bborg_servo_pca9685_i2c_pins: pinmux_bborg_servo_pca9685_i2c_pins { |
There was a problem hiding this comment.
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.
please see the most recent commit -> 64606c5 |
@RobertCNelson I have tested this overlay now and these changes are to be made in the DT file to make it work.