PocketBeagle: PWM, PRU and brushless motors with ESC

I’m working on a quadcopter drone with the pocketBeagle since it should be possible to get high refresh rates with the PRU’s for sensor reading and motor control. However, I ran into a problem while communicating with the ESC (T-Motor F35a-32 bit SLIM 11mm):

  • I can control motors through /sys/class/pwm…$, but not through PWM code from the PRUCookbook (although the PRU PWM-code will blink an LED).

  • It is inefficient to execute code on a PRU and call Linux commands through Bash to change PWM duty cycles right?

  • I see around the internet that ESC with PWM should be at 50 Hz (20 ms period and duty cycle 1 -2 ms), but the ESC documention indicates that you can reach kHz in frequency with input protocols as Dshot, Proshot etc. Is there any way for me to access these communication rates through the PRU’s?

Do you know about the bbbmini and pocketpilot projects - capes for ardupilot running with beaglebones and pocketbeagle?
there is an implementation of PWM using PRU - ardupilot/Tools/Linux_HAL_Essentials/pru at master · ArduPilot/ardupilot · GitHub

Thank you, I will check it out!

To partly answer my own question, and for anyone wondering: when I got it to work with the PWM class, I accidently got it to work with one of the fastest input protocols the ESC supports (Multshot) which has inputs between 5 us and 25 us which is just shy of 40 kHZ. The reason for my accidental success was that PWM period/duty cycle is given in nanoseconds and not microseconds as I thought at the time.