- 1 Fold handling with Collapse-O-Matic plugin
- 2 Status
- 3 To make a linear timer switch?
- 4 Unpacking
- 5 BlackIce Mx = (IceCore + BlackIce Mx) @ BlackEdge
- 6 IceCore Getting Started’s design
- 7 CAD/drawing tool iCircuit, Eagle, Fritzing or..?
- 8 My open scratchpad
- 9 myStorm forum
This note is in group My FPGA pages and is a follow-up from My FPGA notes and i where the IceCore has been discussed extensively. This note is going to be with the hands-on experience, since I am at the moment (5Nov2019) awaiting two boards in the mail.
Fold handling with Collapse-O-Matic plugin
I am using Collape-O-Matic (here) on many pages.
|Expand All (for searching)|
I now have made a box from two plastic trays, as I have come into a habit of doing. One at the bottom and the other upside down on the top. Then held together with plastic, inner corners and two brass pins. From Søstrene Grene, acrylics, each tray 23.9 cm * 11.9 cm * 3.0 cm at the bottom, about a mm wider at the top. (More at My materials science notes.) In addition to the myStorm boards (below) it also contains some breakout boards from Adafruit and three buttons, available from the outside. I am so much looking forwards to this work!
The Adafruits boards are the following (standard disclaimer as for all of my blog notes):
- Bi-Color (Red/Green) 24-Bar Bargraph Backpack Kit, with I2C (PID: 1721)
- 16×8 1.2″ LED Matrix + Backpack – Ultra Bright Round White LEDs, with I2C (PID: 2038)
- 10 Segment Light Bar Graph LED Display – White – KWL- R1025WB-Y, direct control of each LED, no mux’ing (PID: 1816)
To make a linear timer switch?
My goal is to make a timer switch with the IceCore FPGA board. In Verilog, doing circuit diagram drawing and using a hot soldering iron. The picture above shows the inspiration, the oldest ones I have in my box. There is no picture of any digital timer there, even if I have several. I don’t use them because they are so difficult to set up. Even changing between summer and winter time requires the paper manual.
For my timer switch I would need some buttons and a single 24 LED bargraph element mounted horizontally. So I just made up the term linear timer switch here. The ruler in the above picture is meant to show 24 LEDs which indicate that the switch will be on 08.00-11.00 and 18.00-24.00. 24 on the ruler?
Shouldn’t it be 0 at the start instead, and no 24? The mechanical timers have 1..24, but that’s around a circle, and makes more sense there, because the numbers are across the index. Of ’24’ then ‘2’ is on the left side and ‘4’ on the right side of the midnight index. The only way I could do that with LEDs is to add a separate, skewed paper scale.
But perhaps with both 24 and 0, instead of the strange texting above. Like below. But then, the paper scale would become wider than the LEDs?
Some interesting matters to decide upon! Then I would need a 230V AC relay. It would become a prototype in a rather large box, expecting nothing but that future. I have no plans to make it a product, only to learn a lot. Especially FPGA and Verilog.
It was actually my wife Mari who helped me brainstorm what I might make. I told her about the radio chips in all the remote controls we had, ..not anything like that, but similar – and she reminded me of a timer switch where we have had comments on its ticking. Voila!
POS in the text below refers to the photo (above).
|1||BlackIce Mx carrier|
|3,4,5||MixMod BreadBoard addon: MixMod BreadBoard Triple (3 adaptors)||$14.95|
|6,7,8||MixMod Prototype addon: MixMod Prototype Triple pack||$14.95|
|9,10,11||MixMod Tester (Extender) addon: MixMod Tester Triple (3 adaptors)||$14.95|
|12||MixMod 7-Segment Adaptor: single MixMod 7-Segment Adaptor||$14.95||$118.80|
|13||BlackIce Mx carrier|
|15||MixMod 7-Segment Adaptor: single MixMod 7-Segment Adaptor||$14.95||$73.95|
|SUM NOK $1 = 9.58 NOK||1961.63|
My first impression is that the IceCore board, by visual inspection, looks like a very well designed and produced board. It does not feel fragile. Like any good board for home use it has silkscreen text, on both sides, even if there are only a few components on the bottom side. Nice. Plus, it is so small, only 50 * 50 mm. Much smaller than on the pictures ?. It also has four 2.5 mm ⌀ fastening holes that are replicated on the carrier board. Nice II.
The package was made tracked for me, at no extra cost. This was nice since it took about nine days from UK to my post-in-shop office in Norway. However, there was no packing slip in the envelope (not box), so any customs authorities that might want to open and inspect would have to do the research themselves. This is possible, since all boards have their type in silkscreen. But a printout of the order from Tindie would not have hurt. The two BlacIce Mx boards were each in an anti-static bubble plastic envelope. All were taped well, and finally all had been slipped inside a larger anti-static plastic envelope. Then, a paper board to make it stiff (from a cat’s food box, so the seller most probably has a cat..). I was not impressed by the packaging. For $283 (total for me, including local VAT and handling) I think the risk (or rather consequence) would have been too high for me if something bad happened. Some of the connector’s pins were slightly bent; not a big problem. I have not tested the IceCore boards yet. Which I very much look forwards to!
This chapter was also posted at the Tindie shop where I bought the stuff, see https://www.tindie.com/products/Folknology/blackice-mx/. Except the photo.
The IceCore contents
- Processor: ARMA STM32F730
- FPGA: Lattice iCE40HX4K
BlackIce Mx = (IceCore + BlackIce Mx) @ BlackEdge
I will start with repeating a single paragraph from the previous note.
The heading’s formula is not as recursive as it looks:
@folknology writes at myStorm forum (here) that BlackIce Mx is composed of a core (IceCore) and a carrier (BlackIce Mx), these were built and designed to the BlackEdge standard. BTW ‘BlackIce Mx’ is commonly used to refer to the combination of these parts together which is a little confusing.. And @lawrie adds and BlackEdge is sometimes used to refer to the combination that includes the future ECP5 core, which is also confusing.
IceCore Getting Started’s design
I follow the example from IceCore Getting Started at My FPGA notes . Plus help on the myStorm forum, at IceCore getting _really_ Started on macOS where @folknology and @AndyCap helped. Observe I am always using Apple Mac and macOS.
Cloning the example code from GitHub
mymachine:~ teig$ git clone https://github.com/folknology/IceCore.git Cloning into 'IceCore'... remote: Enumerating objects: 104, done. remote: Counting objects: 100% (104/104), done. remote: Compressing objects: 100% (73/73), done. remote: Total 1294 (delta 44), reused 71 (delta 26), pack-reused 1190 Receiving objects: 100% (1294/1294), 26.51 MiB | 8.40 MiB/s, done. Resolving deltas: 100% (643/643), done. Checking connectivity... done.
Plugging the IceCore to my machine and flashing it with new code
When I plug my micro USB cable to the rightmost connector on the IceCore the leftmost blue and the rightmost red LEDs are lit. In addition the center four LEDs are blinking. This is what it came with out of the box. Now we’ll reprogram it:
Downloading binary from Verilog example code
Open two terminal windows. The first goes like this:
Last login: Tue Nov 19 18:46:41 on ttys002 -bash: /private/tmp/com.apple.launchd..../org.macosforge.xquartz:0: Permission denied Mountain Lion: X11 at http://support.apple.com/kb/HT5293 XQuartz-2.7.4.dmg XQuartz (is X11) must be running “Øyvind 2013.01.09 17:49 - running .profile C” mymachine:~ teig$ bash bash-3.2$ cat /dev/cu.usbmodem1421
And the second Terminal window. This may be started any time, but the STM32 bootloader’s message <myStorm 0.601> must be present before the chip.bin is downloaded to it:
Last login: Tue Nov 19 20:34:38 on ttys003 -bash: /private/tmp/com.apple.launchd..../org.macosforge.xquartz:0: Permission denied Mountain Lion: X11 at http://support.apple.com/kb/HT5293 XQuartz-2.7.4.dmg XQuartz (is X11) must be running “Øyvind 2013.01.09 17:49 - running .profile C” mymachine:~ teig$ cd IceCore/Examples/blink mymachine:blink teig$ ls Makefile blink.pcf blink.v chip.bin chip.blif chip.txt chip.v readme.txt mymachine:blink teig$ cat chip.bin >/dev/cu.usbmodem1421 mymachine:blink teig$
Now the red LED shall blink. I will come back with compiling via make. This download also contains files like IceCore.sch (see below).
Flashing the code
@folknology wrote that “if you want it to be permanent switch the board into flash mode by pressing the mode button, the yellow LED will come on to indicate flash mode. Now when you program it, it writes to flash and will be permanent”. This works!
Where is the USB connection and driver?
To check that the cable is ok for more than charging, start a Terminal window. Then run:
ioreg -p IOUSB
Among the other USB devices you should see the IceCore as something like this:
-o STM32 Virtual ComPort@14200000 <class AppleUSBDevice, id 0x10000bdd7, registered, matched, active, busy 0 (22 ms), retain 13>
Plus, if you, in the Terminal window do:
cd / cd dev bash-3.2# ls cu.usb* cu.usbmodem1421
The driver for the IceCore i cu.usbmodem1421. It appeared when the unit was plugged in. Observe that macOS will return different values, but here ComPort@14200000 relates to cu.usbmodem1421. It’s plus 1 kind of (1420+1=1421). See USB driver @address plus 1? on the myStorm forum.
The IceCore draws 50-60 mA @ 5.04V USB. Rather impressing how little these millions of transistors need.
Building the code with make
The example source directories contain the makefile file. Open it in TextEdit just to see. You run it simply by typing make in Terminal. The log file is here:
195 – make blink log file – first part is initial build, and second part is the diff of the build logs:
I modified in blink.v from 24 to 26 and rebuilt. The diff log is in the second part of the file referred above. It now blinks 4 times slower. From a period of 1.34 s to 5.36 s. Even if I thought that this did not hint at a basic 25 MHz clk, it certainly does. Again, @lawrie helped me get things in place at the myStorm forum, see Blink example, clk frequency and blinking rate: the period is of course N+1 bits (25 and 27).
/****************************************************************************** * * * Copyright 2016 myStorm Copyright and related * * rights are licensed under the Solderpad Hardware License, Version 0.51 * * (the “License”); you may not use this file except in compliance with * * the License. You may obtain a copy of the License at * * http://solderpad.org/licenses/SHL-0.51. Unless required by applicable * * law or agreed to in writing, software, hardware and materials * * distributed under this License is distributed on an “AS IS” BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or * * implied. See the License for the specific language governing * * permissions and limitations under the License. * * * ******************************************************************************/ module blink(input clk, output led); /* clk is 25 MHz */ reg [26:0] count; /* orig 24 */ assign led = count; /* orig 24 */ always @(posedge clk) count <= count + 1; endmodule
Also see Automatic generation of Makefile? on myStorm forum.
CAD/drawing tool iCircuit, Eagle, Fritzing or..?
This chapter also turned out to become an overview of some circuit drawing tools.
CAD-tool, graphical circuit diagram editor. This is for those who might use iCircuit (http://icircuitapp.com) by Krueger Systems.
The Comp_BlackIceMx.zip contains the following files:
Comp_BlackIceMx_MXn_generic.icircuit Comp_BlackIceMx_MXn_generic.pdf Comp_BlackIceMx_MX1.icircuit Comp_BlackIceMx_MX1.pdf Comp_BlackIceMx_MX2.icircuit Comp_BlackIceMx_MX2.pdf Comp_BlackIceMx_MX3.icircuit Comp_BlackIceMx_MX3.pdf Drawing_100_TransparentIceBox.icircuit // Just to see how MX1-MX3 looks when used Drawing_100_TransparentIceBox.pdf
Eagle, Cadsoft, Autodesk
However, I see in the IceCore.sch (dowloaded, see above) that it starts with
<!DOCTYPE eagle SYSTEM "eagle.dtd"> <eagle version="7.7.0">
which means that the IceCore people use Eagle (here). I read it is from CadSoft since its inception in 1988, but since 2016 as Autodesk. Trying to make an account on the Eagle pages I already had one, in the name of Autodesk of course. However, I see that it costs 191 NOK per month (but cheaper for you guys: UK 12£, US 15$) – ruled out for me. I don’t want subscriptions of that type and size. But there is a limited and free download (compare here – also referred to from the Norwegian page). I did download Autodesk_EAGLE_9.5.2_English_Mac_64bit.pkg and the install took more than 500 MB. I started it (with a log-on), and I do see that I probably should learn to input to it. But as a start I can now open the sch-files that come with IceStorm.
I already have Fritzing installed – but then, I like to draw diagrams with IEC symbols, not connection-type diagrams as starting points.
The KiCad tool was suggested in myStorm forum (9).
http://www.falstad.com/ – Circuit drawing and simulation. Nice export properies. Very interesting product.
(Thanks, son Andreas for this tip)
My open scratchpad
Connecting not yet existing boards
- I have queried about how 5V goes through on the myStorm forum (here)
- Level shifting needed for Adafruit 1721 and 2038 LED boards (above)
- Adafruit product 757 (here) is a bidirectional level shifter that also works with the pull-ups of the I2C bus
- Also a SparkFun BOB-12009 here (available from DigiKey in Norway)
- They both to follow NXP (Philips) application note AN10441 (here)
- There are circuit diagram examples from Adafruit products that have built-in level shifting, like displays (here).
- It is based on the N-channel BSS138 MOSFET, which does not seem to have any through hole versions (StackExchange: here). At Elfa Distrelec in SOT-23 as 300-41-274 (here). SOT-23 since I have Adafruit SMT breakout boards 1230 (here)
- I have an I2C isolater click board from MIKROE (here). It is based on an Texas Instriments ISO1540 (here). But this isolates as well as shifts levels
Newest on the bottom. I am only listing those that I have started. I give summaries, but you need to go there to get the details and see who took the time to answer:
- Continues from here
- Kneading on which breadboard? There are four expander/extender breadboards. This topic also contains an overview of them all plus circuit diagrams:. More in the post:
- MixMod Breadboard
- MixMod Proto
- MixMod Tester (Extender)
- MixMod 7-Segment Adaptor
- Driving LEDs directly from ICE40 pins? – 5Nov2019
- Pin outputs are max. 3V3 @ max 8 mA (push to max-0.4V and also pull low to 0.4V)
- Direct connection of 24 LEDs @ 1k should then be ok (about 1mW per LED)
- There are no high current LED driving pins on the ICE40 that’s used on the Mx board
- I2C as in comm bus or something else? – 5Nov2019
- I2C or I2C is always, in any context Philips communication with SDA and SCL lines etc.
- Any I2C functionality from the ICE40 must be done in Verilog. Any pin may be used. There is a reference to an I2C “core” (as they call it) in the post
- The STM32 processor has SPI and I2C pins also on the BlackEdge connectors. There is a url to a diagram of the connections in the post
- Download of ICE40 configuration is via the USB PRG connector to the STM32 and then over SPI to ICE40. More in the post
- The Lattice documentation is difficult to read because they make it rather generic and then it’s difficult to extract what’s in it for me
- IceCore Getting _really_ Started on macOS – 19Nov2019
- USB driver @address plus 1? – 20Nov2019
- Automatic generation of Makefile? – 20Nov2019
- Blink example, clk frequency and blinking rate – 21Nov2019
- CAD or drawing tool? – 1Dec2019 (CAD-tool, graphical circuit diagram editor)
- KiCad was suggested and is free: http://www.kicad-pcb.org (I will use it on my next circuit diagram)
- Hard to find P16,P17,P20,P21 in blackice-mx.pcf – 14Dec2019
- Potentially dangerous to connect a button directly to an FGPA pin? – 18Dec2019
- Magic clk 60 represents pin number or 25 MHz speed? – 28Dec2019
- Chisel, the big picture? – 10Jan2020
- Raising the level of abstraction in digital design with Chisel3 and FIRRTL
by Jack Koenig, SiFive (https://en.wikipedia.org/wiki/SiFive) at
- Raising the level of abstraction in digital design with Chisel3 and FIRRTL