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
Pixhawk flashing via USB #1566
Conversation
@@ -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 |
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 change UART TX buffer when changing to USB?
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.
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.
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.
Maybe it would be a good idea to increase the default buffer size? See #1453
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 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.
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.
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?
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.
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.
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.
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.
Please follow pep8 (4 spaces for indentation) for python files as per our style guide... |
So is it working reliably now? |
Yes, this works reliably as far as I know. |
Ok, cool! It would really be great if you could add some comments on the timeout and (potientially infinite??) while usbd stall loop. |
@podhrmic maybe you can test this as well? |
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 :) |
@gautierhattenberger @podhrmic any feedback here? |
I ll test it on Lisa MX today. |
|
@podhrmic Thx for testing!on Lisa MX |
You're welcome:) FYI with the latest master I am getting the same results (usb_telemetry compiles, but the usb module examples don't). |
Add flash through usb functionality PX4.
Automatically detects which target is being flashed, and redirects accordingly.