{"id":5613,"date":"2020-01-08T03:29:52","date_gmt":"2020-01-08T03:29:52","guid":{"rendered":"http:\/\/41j.com\/blog\/?p=5613"},"modified":"2020-01-08T03:29:58","modified_gmt":"2020-01-08T03:29:58","slug":"nmigen-pll-ice40hx8k-hx1k","status":"publish","type":"post","link":"https:\/\/41j.com\/blog\/2020\/01\/nmigen-pll-ice40hx8k-hx1k\/","title":{"rendered":"Nmigen PLL ICE40HX8K\/HX1K"},"content":{"rendered":"\n<p>I&#8217;ve been playing with a couple of ICE40 boards. These are some quick notes on using the PLL with the HX8K and HX1K. There&#8217;s nothing particularly innovative here, but I wanted to get some notes down.<\/p>\n\n\n\n<p>I used pll.py from this repository: https:\/\/github.com\/kbob\/nmigen-examples\/tree\/master\/nmigen_lib<\/p>\n\n\n\n<p>The examples in this repository are for the ICEBreaker platform, which uses ICE40UP5K. The code doesn&#8217;t work with the HX1K and HX8K as laid out on the ICEStick and ICE40HX8KBEVN (these are the boards supplied by Lattice).<\/p>\n\n\n\n<p>In particular pll.py is hardcoded to use B_PLL40_PAD. It appears that the oscillator on the above platforms can not be connected to this type of PLL. As such, if you try and use pll.py unmodified with these platforms you&#8217;ll get the following error (as I understand it from nextpnr):<\/p>\n\n\n\n<p>ERROR: PLL &#8216;U$$0.U$$0&#8217; PACKAGEPIN SB_IO &#8216;clk12_0__io$sb_io&#8217; is not connected to any PLL BEL<\/p>\n\n\n\n<p>Instead I use SB_PLL40_CORE. This also means you need to use i_REFERENCECLK instead of i_PACKAGEPIN. So the following changes are required:<\/p>\n\n\n\n<p>pll = Instance(&#8220;SB_PLL40_CORE&#8221;, <strong>becomes<\/strong> pll = Instance(&#8220;SB_PLL40_PAD&#8221;,<\/p>\n\n\n\n<p>and<\/p>\n\n\n\n<p>i_PACKAGEPIN=self.clk_pin, <strong>becomes<\/strong> i_REFERENCECLK=self.clk_pin,<\/p>\n\n\n\n<p>In pll.py. A tarball containing a working example for the Icestick is below (if you want to use the HX8K, just change the platform).<\/p>\n\n\n\n<p>Aside from the PLL stuff, I had an issue programming the ICE40HX8KBEVN. As I understand it &#8220;platform.build(Top(), do_program=True)&#8221; should program this board. iceprog gets called, and appears to succeed but the ICE40 doesn&#8217;t seem to get programmed correctly (possibly it needs to be erased first?). I need to run iceprog manually. Programming the Icestick doesn&#8217;t have this issue.<\/p>\n\n\n\n<p>Tarball: <a href=\"http:\/\/41j.com\/blog\/wp-content\/uploads\/2020\/01\/pll-blinker.tar.gz\">here<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve been playing with a couple of ICE40 boards. These are some quick notes on using the PLL with the HX8K and HX1K. There&#8217;s nothing particularly innovative here, but I wanted to get some notes down. I used pll.py from this repository: https:\/\/github.com\/kbob\/nmigen-examples\/tree\/master\/nmigen_lib The examples in this repository are for the ICEBreaker platform, which uses [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[1],"tags":[],"class_list":["post-5613","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p1RRoU-1sx","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/posts\/5613","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/comments?post=5613"}],"version-history":[{"count":2,"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/posts\/5613\/revisions"}],"predecessor-version":[{"id":5616,"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/posts\/5613\/revisions\/5616"}],"wp:attachment":[{"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/media?parent=5613"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/categories?post=5613"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/tags?post=5613"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}