GithubHelp home page GithubHelp logo

greatscottgadgets / apollo Goto Github PK

View Code? Open in Web Editor NEW
51.0 9.0 27.0 385 KB

microcontroller-based FPGA / JTAG programmer

License: BSD 3-Clause "New" or "Revised" License

GDB 0.01% Makefile 0.98% C 47.93% Python 51.09%
fpga programmer debugger jtag

apollo's People

Contributors

antoinevg avatar cyber-murmel avatar gregdavill avatar ktemkin avatar martinling avatar miek avatar mkj avatar mndza avatar mossmann avatar straithe avatar supersat avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

apollo's Issues

JTAG failure on older Cynthion boards

Seen so far on r0.3 and r0.4 hardware:

(venv) mossmann@costard:~/src/cynthion/cynthion/python$ ~/src/luna/examples/blinky/blinky.py 
INFO    | __init__    | Building and uploading gateware to attached Cynthion r0.3...
Traceback (most recent call last):
  File "/home/mossmann/src/luna/examples/blinky/blinky.py", line 41, in <module>
    top_level_cli(Blinky)
  File "/home/mossmann/src/cynthion/cynthion/python/venv/lib/python3.11/site-packages/luna/__init__.py", line 113, in top_level_cli
    products = platform.build(fragment,
               ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/mossmann/src/cynthion/cynthion/python/venv/lib/python3.11/site-packages/amaranth/build/plat.py", line 113, in build
    self.toolchain_program(products, name, **(program_opts or {}))
  File "/home/mossmann/src/cynthion/cynthion/python/venv/lib/python3.11/site-packages/cynthion/gateware/platform/core.py", line 79, in toolchain_program
    programmer.configure(bitstream)
  File "/home/mossmann/src/cynthion/cynthion/python/venv/lib/python3.11/site-packages/apollo_fpga/ecp5.py", line 461, in configure
    self._validate_status(status, expect_done=True)
  File "/home/mossmann/src/cynthion/cynthion/python/venv/lib/python3.11/site-packages/apollo_fpga/ecp5.py", line 334, in _validate_status
    error_handler("Failed to execute last command!{}".format(error_text))
  File "/home/mossmann/src/cynthion/cynthion/python/venv/lib/python3.11/site-packages/apollo_fpga/ecp5.py", line 318, in raise_error
    raise IOError(msg)
OSError: Failed to execute last command! (bitstream provides data past the device's SRAM array / ffffffff)

See greatscottgadgets/luna#241 for how we first encountered this.

I was unable to reproduce this problem with older Apollo firmware (version unknown, but it was using 4 KiB bootloader), but immediately reproduced it upon updating Apollo firmware to 171556d.

Enhance error message on bitstream mismatch

In case of a bitstream for a wrong FPGA I get the error message
OSError: Configuration failed: part ID mismatch / (04a00e10)
It seems to be generated here

The message could be a little more clear:

  • Why is this an OSError?
  • what mismatched (part IDs of the FPGA and the bitstream?)
  • add human readable representation of the part IDs
  • which part ID is actually shown? the ID in the bitstream or of the installed FPGA?

I would suggest an error message similar to the following:
configuration failed: trying to load a bitstream generated for FPGA Lattice ECP5 LFE5U-12 partid 04a00e10 onto an incompatible FPGA Lattice ECP5 LFE5U-25 partid 0x41111043

Decide what Apollo (and other gateware) will do on older Cynthion revisions

July 2023, issue #21 states that "From everything I can tell, at the moment there is no way to actually use the sideband PHY port from the FPGA. At least on the Luna v0.4 that I have." @martinling mentions that Apollo works quite differently in later versions of the Cynthion hardware, compared to v0.4 of Cynthion. Martin goes on to explain more about the changes and answers each of the questions in the issue, but a new issue remains to be resolved: What Apollo and other gateware should do on older board revisions.

Release Apollo 1.0.0

Tasks not yet associated with an Issue or Pull Request

Sideband PHY unusable on older Cynthions

From everything I can tell, at the moment there is no way to actually use the sideband PHY port from the FPGA. At least on the Luna v0.4 that I have.

The schematic for the LUNA implies that this should simply be a matter of how the SIDEBAND_RESET signal is driven, and indeed, this controls if the ULPI PHY is kept in reset, but the microcontroller's data lines stay attached to D+ and D-, so the PHY cannot actually take over once out of reset (making this seem to be an issue on Apollo's side).

I looked through the documentation and code for LUNA and Apollo but the only references to the sideband port are tests in LUNA that will pass so long as the FPGA can simply talk to the PHY itself, and floating the reset pin in fpga_io_init() in Apollo. So if there's some other logic involved with that sideband port I'm not seeing it.

Let me know if there's something I'm missing and if I should move this issue to LUNA itself or create a linked issue on that side.

FPGA not allowed to take over shared USB port by default

This can result in Apollo claiming the CONTROL port on Cynthion instead of handing it off to the FPGA shortly after start-up.

Due to a quirk of Apollo's behavior, some gateware that starts requesting the CONTROL port early at start-up can gain control of the port, but this is unreliable due to unpredictable timing (presumably FPGA PLL start-up).

apollo flash_program should check part_IDs

Similarly to apollo configure the command apollo flash_program should check whether the partID of the bitstream matches the partID of the installed FPGA. If not, an error message as described in #14 should be given.

CLI help text outdated

The CLI help text in apollo_fpga/commands/cli.py is outdated. In particular, it mentions the "program" command, which seems to have been renamed "flash" and "flash-program." It is also missing the "leds" command. There might be some other inconsistencies.

firmware: `make clean` does not remove _build/firmware

This can result in modifications such as a change to BOARD_REVISION_MINOR not taking effect.

Workaround: rm -r _build

I'm not sure what the best solution is. The clean target is defined in an include from tinyusb.

Update LED usage

Proposed plan:

  • LED A: USB switch is in Apollo/Saturn-V mode (see #38)
  • LED B: FPGA is being held offline
  • LED C: Saturn-V heartbeat
  • LED D: fault, e.g. FPGA failed to configure from flash
  • LED E: Apollo heartbeat

[proposal replaced by "Alternative scheme" in comment below]

All LEDs would change function temporarily if a pattern other than idle is in use. The idle pattern would restore the indications above.

Firmware assumes JTAG in RESET state in `jtag_init()`

jtag_init() in jtag_tap.c uses jtag_set_current_state(STATE_TEST_LOGIC_RESET) which sets the microcontroller's understanding of the state to Test-Logic-Reset without actually ensuring that the FPGA's JTAG TAP is in that state. This is worked around by calling jtag_go_to_state(STATE_TEST_LOGIC_RESET) immediately after calling jtag_init() (which is done from the host side with vendor request REQUEST_JTAG_GO_TO_STATE after REQUEST_JTAG_START) every time JTAG is initialized.

This is arguably a bug, but it needs further investigation and test.

Release Apollo 0.0.6

This is the tracking issue for the next Apollo release.

Tasks not yet associated with an Issue or Pull Request

Issues

Review, merge or close outstanding pull requests

  1. martinling

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.