Reading data from Castle ESC approach help

Hello all, I am using Navio2 for research purposes and have an atypical setup including a Castle Mamba Micro X ESCs powering sensored motors. I would like some direction as to how to read in ESC data using Castle Link Live protocol:
(https://dzf8vqv24eqhg.cloudfront.net/userfiles/4671/6540/ckfinder/files/Product%20Manuals/Accessories%20and%20replacement%20parts/castle_link_live_2_0.pdf?dc=201606221536-537)

I am running:
Raspberry Pi 3
Emlid Raspbian 20170323
APM:Copter V3.4.6 (5221448a)

I have been considering using ROS and creating my own node that decodes the information and shoots it over to GCS which is running Mission Planner BTW.
However I have little experience with 2 way communications and need to use the protocol for 4 ESCs. I am not even sure how to connect the ESC to the Navio/Pi such that I have 2 way communication with all 4 ESCs. That would be the first advice I would like. I been researching UART and I2C and SPI protocols but am clueless as to implementing. Also I found some code capaverde made for the Arduino, he seems to use I2C with his controller as master.

post #500

I am also aware that I can buy 4 $90 serial links from Castle that will convert Castle Link Live to I2C or whatever else I may want, but due to budget reasons I would like to avoid this.

Seriously any advice on how to accomplish this will be helpful, I will need to use the data later to modify arducopter controls for a different operation regime.

Best,
-ilbs

Hi! I took a quick look at the description, since this is a pulse based protocol a suitable approach would be to use a microcontroller to decode it and then pass it to Raspberry via UART (or another digital protocol). Well, just like in Castle Serial Link. Important thing thought is that Raspberry is quite limited on the number of peripheral busses and it would be necessary either to accumulate all links in one data stream or to have some additional bus converters (like USB to UART).

Thank you for your reply! Would the Navio with Arducopter be able to use a different (non-PWM) output to power motors or would that be difficult to change?

However, due to space and weight restrictions I have come up with the idea to build a PWM inversion circuit on the Navio output and tap into that line with a separate read pin, then have a script process the data on the Raspberry and output the encoded information.

Are you by chance aware of how to alter Arducopter parameters mid flight? I would like to have access to many parameters but if that is not easily done within Arducopter my backup is to use the ESC aux cable to control just one.

Would the Navio with Arducopter be able to use a different (non-PWM) output to power motors or would that be difficult to change?

Very difficult using standard RC outputs on Navio. Medium difficult by changing ArduPilot to send the RC values over digital bus.

Depends on the parameters, some may be changed during the flight through MAVLink/DroneKit.

Thanks a lot for your help! I think I will stray away from switching protocols and interact with Ardupilot through Mission Planner scripts or DroneKit. I am currently looking into both, which would you advise?

I’d say scripts in MP are easier, but DroneKit is more flexible.

I will look into MP scripts first then, thanks for your prompt and helpful advice!

Hey Mikhail, thanks a lot for your help earlier. I have made a lot of progress but got stuck on a seemingly simple issue. I need to alter the PWM output frequency on the servo rail ports 1-14. I went into MP and set the RC_SPEED parameter to 50z but am getting no change, it is currently at 200Hz which is a little too fast for the protocol to work well. How to troubleshoot MP approach or modulate the frequency in other ways?

How do you check that the frequency doesn’t change?

I used an oscilloscope. I managed to get it working by connecting my ESC to PWM port 10 and setting its function parameter to 53: RCIN3 to run some tests. (RC_SPEED set to 50)

However, I will need to have the APM recognize the motors on 50Hz PWM ports. I tried setting the function parameter to 33: Motor1 but had no effect even after arming from MP. Do you by chance know of a way to accomplish motor ESCs running on 50Hz in a way that the APM functions normally?
I have not looked deeply into this yet and can make a new topic later with additional details if need be, just asking in case it’s an easy solution that I don’t have enough experience for.

Well, changing RC_SPEED to 50Hz should change the PWM output frequency to 50Hz, and motors should work by default on standard RC output channels depending in the vehicle configuration. Can you try resetting the parameters?

Hi Ilya, did you ever got Castle telemetry to work correctly in Ardupilot?