-
Notifications
You must be signed in to change notification settings - Fork 109
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
Initial support for Tang nano 9k board #208
Conversation
The CI is stuck on "amaranth.vendor.gowin" missing. |
Yes, that's right @josuah, that's up to @whitequark. I've ironed out a few more things in the last weeks while actually working with the board. |
…O pins by default.
part = "GW1NR-LV9QN88PC6/I5" | ||
family = "GW1NR-9C" | ||
default_clk = "clk27" # or "OSC" to use on-chip oscillator | ||
osc_frequency = 2500000 # Hz |
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.
Our general policy here is that if default_clk
points to a pin (like here), then osc_frequency
is unspecified. However if the external clock is missing or unusable (like on the original Tang Nano), then default_clk
would be OSC
and the frequency would be specified by the designer, with some reasonable default (like 24 MHz).
from amaranth.vendor.gowin import * | ||
|
||
try: | ||
from .resources import * |
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.
This should only be from .resources import *
; for testing you can install amaranth-boards in "editable mode".
|
||
if __name__ == "__main__": | ||
try: | ||
from .test.blinky import * |
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.
Likewise here.
" 54 55 56 57 68 69" | ||
), | ||
# TODO: Convert to Resource | ||
Connector("rgb_lcd", 0, |
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.
You can take this for inspiration.
family = "GW1NR-9C" | ||
default_clk = "clk27" # or "OSC" to use on-chip oscillator | ||
osc_frequency = 2500000 # Hz | ||
board = "tangnano9k" |
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.
Our convention is to inline the board
field you have here into toolchain_program
.
clk="36", cmd="37", dat0="39", dat3="38", wp_n="-", | ||
attrs=Attrs(IO_TYPE="LVCMOS33")), | ||
|
||
Resource("backlight_pwm", 0, Pins("86", dir="o"), |
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.
Resource("backlight_pwm", 0, Pins("86", dir="o"), | |
Resource("lcd_backlight", 0, Pins("86", dir="o"), |
UARTResource(0, rx="18", tx="17", | ||
attrs=Attrs(PULL_MODE="UP", IO_TYPE="LVCMOS33")), | ||
|
||
*SPIFlashResources(0, |
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.
Is this also a PSRAM on the 9k? If so, it should be:
*SPIFlashResources(0, | |
*SPIFlashResources("psram", 0, |
# PIN76_MCLK SCL | ||
# PIN48_CS CS | ||
|
||
Resource("hdmi", 0, # FPGA_HDMI |
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.
Would you like to add HDMIResource
?
|
||
] | ||
connectors = [ | ||
Connector("gpio", 0, |
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.
The silk that is printed on the board refers to FPGA pin numbers, is that correct?
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.
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.
By silk I mean the other side (not visible on the diagram).
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.
Yes, they just number their pins and also put these numbers on the silkscreen next to the GPIO headers.
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.
Then we probably don't need this connector since it's much easier and less error prone to use actual pin numbers.
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 now have a Tang Nano 9K and can test this PR. |
See #233. |
Obsoleted by #233. Thank you for this work! |
Pending PR amaranth-lang/amaranth#734 for platform support.