Skip to content
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

Pixhawk flashing via USB #1566

Merged
merged 8 commits into from Mar 23, 2016
Merged

Pixhawk flashing via USB #1566

merged 8 commits into from Mar 23, 2016

Conversation

kevindehecker
Copy link
Contributor

Add flash through usb functionality PX4.

Automatically detects which target is being flashed, and redirects accordingly.

@@ -36,8 +36,13 @@
#define UART_RX_BUFFER_SIZE 128
#endif
#ifndef UART_TX_BUFFER_SIZE
#ifdef STM32F4 //the F4 has enough memory, and the PX4 bootloader needs more then 128
Copy link
Member

Choose a reason for hiding this comment

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

? why change UART TX buffer when changing to USB?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In order to flash the FBW f1 through the same USB cable (which is only connected to the AP f4), the f4 is set in a relay mode (pc <-> usb <-> f4 <-> uart <-> f1) . The PX4 upload script uses blocks of 252 bytes, which overan the internal UART buffer of the f4.

Copy link
Member

Choose a reason for hiding this comment

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

Maybe it would be a good idea to increase the default buffer size? See #1453

Copy link
Member

Choose a reason for hiding this comment

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

I'm really not in favour of increasing default buffer size, it's not needed for 99% of use cases and on some of the low end LPCs/F1s not even possible due to ram size.

Defining a bigger buffer for e.g. linux or certain STMs could be done in their respective uart_arch.h files.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Which is why I took the compromise road here and changed it only for the f4 :)

So, what would you like me to do here? Move the define to the uart_arch.h?

Copy link
Member

Choose a reason for hiding this comment

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

As you want.. if you move it to uart_arch.h, you might as well rais the rx buffer size to the same value for F4.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In that case, I prefer leaving it as is. Moving it to uart_arch.h still requires a ifndef and the ifdef f4. Moreover it only makes it less clear to have this definition redefined at another place.

@flixr
Copy link
Member

flixr commented Mar 14, 2016

Please follow pep8 (4 spaces for indentation) for python files as per our style guide...

@flixr
Copy link
Member

flixr commented Mar 15, 2016

So is it working reliably now?
Also it's not like longer multi-line descriptions aren't appreciated, just have one very brief one in the first line... ;-)

@kevindehecker
Copy link
Contributor Author

Yes, this works reliably as far as I know.

@flixr
Copy link
Member

flixr commented Mar 15, 2016

Ok, cool!
The usb serial will need to be tested with transparent_usb on other boards as well.

It would really be great if you could add some comments on the timeout and (potientially infinite??) while usbd stall loop.
Also it really needs to be guaranteed that this will never turn into an infinite loop.

@flixr
Copy link
Member

flixr commented Mar 15, 2016

@podhrmic maybe you can test this as well?

@kevindehecker
Copy link
Contributor Author

I checked the transparant_usb on the Pixhawk (temporarily disabled the flash module) yesterday, it seems to work as before.

Added some extra comments on the timeout stuff. About the potential infinite while loop, not sure what you want me to say here. Internally it checks the USB_EP_TX_STAT bit, which seems about right.... but that is about all I know on this. That, and the fact it has never gone infinite on me up till now :)

@kevindehecker kevindehecker mentioned this pull request Mar 22, 2016
@flixr
Copy link
Member

flixr commented Mar 22, 2016

@gautierhattenberger @podhrmic any feedback here?

@flixr flixr changed the title Px4 usb Pixhawk flashing via USB Mar 22, 2016
@podhrmic
Copy link
Member

I ll test it on Lisa MX today.

@podhrmic
Copy link
Member

transparent_usb telemetry works on Lisa MX

usb_serial_stm32_example1 and usb_serial_stm32_example2 modules don't compile (undefined reference toUsbSChAvailable` ... )

@OpenUAS
Copy link
Contributor

OpenUAS commented Mar 22, 2016

@podhrmic Thx for testing!on Lisa MX

@podhrmic
Copy link
Member

You're welcome:) FYI with the latest master I am getting the same results (usb_telemetry compiles, but the usb module examples don't).

@flixr
Copy link
Member

flixr commented Mar 22, 2016

@podhrmic the usb module examples should be fixed with 0d4c628

@flixr flixr merged commit 2059f47 into paparazzi:master Mar 23, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants