JoshMcguigan / betafpv-f3

Board Support Crate for the BetaFPV F3 Drone Flight Controller
Apache License 2.0
44 stars 1 forks source link

Sending data to companion computer #2

Open tekjar opened 5 years ago

tekjar commented 5 years ago

Hi. How are you planning to send data to computer from flight controller. Through UART connected to microusb?

JoshMcguigan commented 5 years ago

Hi @tekjar, thanks for the question.

In the short term, I've created a bit bang serial crate which I am using to transmit debugging data from the flight controller to the development computer using one of the motor outputs. An example demonstrating this is available here.

I think the next step would be using the UART pins which are exposed through the USB connector to communicate serially (this would require a USB-serial converter as well on the development computer side). The final step would be implementing a USB stack in rust which would eliminate the need for the usb-serial converter and make the board show up as a serial port.

Now that I've got basic communication working well enough for debugging, my attention has shifted to working on the sensor fusion. But this communication stuff would be a great place for an additional contributor to start.

tekjar commented 5 years ago

I would like to do the usb stuff but I have zero knowledge on how this works. Are there any references to start this work?

I'll start working on this on f3discovery

JoshMcguigan commented 5 years ago

For the purposes of the betafpv-f3 there are two separate ways to go about this, with pros/cons to each.

UART using the pins exposed by the USB connector

I believe this would be the simplest to get working. Basically it would be to determine which UART is connected to the USB port and write an example which uses that for serial communication with the development PC. This work would be specific to the betafpv-f3 so you would have to have the board to work on this.

Serial over USB (implementing a USB stack in nostd Rust)

This would likely be the more challenging approach, but it would be more rewarding as well. The end goal here would be to implement a USB stack in nostd Rust, which would make the board look like a usb-serial adapter when connected to the computer. Work on this could be done on the f3discovery, using the usb user port. This issue, rust-embedded/wg#40, is probably the best starting point for information.