greatscottgadgets / apollo

microcontroller-based FPGA / JTAG programmer
BSD 3-Clause "New" or "Revised" License
61 stars 29 forks source link

Add support for one-way FPGA advertisement pin #22

Closed mndza closed 6 months ago

mndza commented 1 year ago

Apollo firmware will keep the USB switch handed over to the FPGA as long as the gateware keeps advertising its usage through the FPGA_ADV pin (FPGA_INT). When these messages stop arriving, Apollo will take over the port. If the ads resume, the port will not be handed off to the FPGA again until a "honor FPGA_ADV" (0xc2) vendor request arrives.

Additionally, the host tools can request a gateware to hand off the USB port to Apollo if the necessary request is available.

Merge in block with:

mossmann commented 11 months ago

This started failing CI due to a tinyusb change in master. See 3802956 for how to fix it.

mossmann commented 11 months ago

Should we also add a vendor request that asks firmware to hand off the USB port to the FPGA? If the advertising fails for any reason (e.g. older or broken gateware), it might be nice to be able to explicitly switch the port.

martinling commented 11 months ago

Should we also add a vendor request that asks firmware to hand off the USB port to the FPGA? If the advertising fails for any reason (e.g. older or broken gateware), it might be nice to be able to explicitly switch the port.

Another reason this would be useful is that it would switch immediately, rather than potentially waiting some time for the next periodic advertising message.

mndza commented 11 months ago

Should we also add a vendor request that asks firmware to hand off the USB port to the FPGA? If the advertising fails for any reason (e.g. older or broken gateware), it might be nice to be able to explicitly switch the port.

Should this request hand off the USB port to the FPGA until the PROGRAM button is pressed?

Another reason this would be useful is that it would switch immediately, rather than potentially waiting some time for the next periodic advertising message.

The current vendor request will switch immediately in most cases. It will only have to wait if the vendor request is called before advertisement starts, which we are not doing.

mndza commented 11 months ago

I agree with your concerns. The configuration flash bridge uses the scheme that you mention, where the vendor request targets a specific interface. However, the configuration descriptor there is fixed.

Let me try to find a way to append this interface descriptor to an existing configuration descriptor.

martinling commented 11 months ago

I also wonder whether the ApolloAdvertiser gateware should live here in the Apollo repo rather than in LUNA.