In an earlier column (the one before my Game of Life blog), I was looking at building the core of the PicoBlaze, but had not really done much else. So it's time to fix that and get a light-emitting diode (LED) we shall call Blinky up and running. Now, controlling a light-emitting diode (LED) might not sound like a big deal, so why is a blinking LED so important?
Getting new hardware or software up and running is best achieved by taking small steps. I once heard a software engineer say that you can write a program in a day and then spend weeks debugging it. The problem is exacerbated if you trying to bring up both the hardware and the software at the same time. If something doesn’t work, is it the hardware that's letting you down, or is it the software that's at fault?
Here we see Blinky the LED in the lower lefthand corner of the breadboard.
The first step is to make sure that the target hardware is really working, but how can you tell you have managed to get something working for the first time? The answer is Blinky the flashing LED, which I believe is the most powerful debug tool you will ever own (I'll let you read my blog, thereby saving you from being regaled by my passion for this topic).
The point is that getting an LED to blink means a lot, because it provides a way to demonstrate that you have achieved some goal. Over the last few days, this has meant proving that (on the hardware side) I could add the required support logic in the form of an output port and its control circuitry. I've also had to assemble a PicoBlaze program, synthesize everything, and -- ultimately -- get Blinky up and running.
I started to play around with picoblaze(KCPSM6) and tried to fit it into my project's Spartan 6 chip. Weird thing is the picoblaze synthesized by xilinx's XST is able to complete implementation whereas for picoblaze synthesized by synplify pro is not able to get past mapping (with some pack:2811 errors).
I intended to fit in picoblaze in the existing FPGA design for some hacking/debugging purposes and the whole project is synthesized in synplify pro so I need to get picoblaze workable in synplify pro as well but seems like there's some obstacles in my way :(
Well, I'll try to talk to xilinx guy who implemented picoblaze, he seems pretty helpful.
Max Maxfield 8/7/2012 3:50:10 PM User Rank Blogger
Re: PicoBlaze
@nsuresheee: I agree. Even if you don't have an imperitive need to use PicoBlaze, it's nice to build one in so it's available for "housekeeping stuff" like monitoring switches or flashing LEDs...
Max Maxfield 8/7/2012 3:45:40 PM User Rank Blogger
Re: In support of Blinky
@Bill: Quite apart from anything else, when you plug a board in it's nice to see a LED flash on and off just to tell you that power is getting through...
Paul, I have spent quite some time with picoblaze in my projects which I used it with spartan 3 FPGA. I liked the idea of controlling the LED using the processor. I have used picoblaze with uart, spi, i2c and interrupt controller modules. Its nice educating about picoblaze in a forum like this.
Duane Benson 8/2/2012 12:30:49 PM User Rank Blogger
Re: In support of Blinky
Bill - $.02 can go a long way with new hardware. I usually design a few LEDs onto my MCU board layouts with no purpose other than to help with my debuggin and test. I can always leave them de-populated in the final board if I want to save the few pennies.
@Duane--isn't it amazing how the blinking of a $.02 LED can tell you so much? Now I know why the "Blinky" program is included on so many eval and promotional boards.
Max Maxfield 7/31/2012 12:12:02 PM User Rank Blogger
Re: The error that gets me most often.
@Paul: Re your interview story, I have a similar tale. As part of an interview I was once asked how I would diagnose a board that was exhibiting strange behavior.
I replied that my first approach would be to take a WAG (wild ass guess) ... although I'm sure I didn't use those words ... based on whatever I could see (flashing lights, what other parts of the system were doing). My rational was that when you have experiance, just looking at what something is doing can give you a lot of clues as to what the fault might be.
I also said that if this failed, then I would revert to the methodical approach, going step-by-step through all the possible problems. The thing is that using your intuition can often get you where you want to be a lot faster than doing it "by the book" ... but you also have to know when to draw the line and say "OK, that wasn't the problem, now let's start from ground zero..."
The PicoBlaze does not come with the ability to single step, set breakpoints, and monitor registers and memory, so we need a way to get around these limitations.
As opposed to rebuilding the entire design every time we "tweak" the code we wish to run on the PicoBlaze soft microcontroller core, we can simply use a JTAG tool to load our executable code directly into the FPGA's on-chip memory.
To save this item to your list of favorite All Programmable Planet content so you can find it later in your Profile page, click the "Save It" button next to the item.
If you found this interesting or useful, please use the links to the services below to share it with other readers. You will need a free account with each service to share an item via that service.