Monday, July 7, 2014

Using the mBuino with Linux


mBuino is a powerful tiny circuit for all your needs... ARM® Cortex™ 50Mhz, UART, SPI, I2C...programmed using the mbed™ online compiler IDE

It currently (as of July 7, 2014) has 9 days left on kickstarter.

https://www.kickstarter.com/projects/1359959821/mbuino-a-programmable-mbed-keychain

I was given one to test out using linux, as it seems that the NXP LPC11U24 has some issues with linux. Namely firmwares get written to the wrong space on the flash drive. They seem to be 4 blocks off.

With some googling and search a solution was found, and I can verify that with a slight modification the solution works.

My initial testing, coping the mBuino Firmware (just in case something happens), I will have a copy of the firmware that was installed by The OutrageousCircuits team at GHI Electronics.

But I can confirm that it will work with linux, using the DD command.
There are a couple of things you'll need to be aware of before you get started, and a couple of WARNINGS!

Until, I or someone else can get a script written to automate this process, you'll need to know the mount point of the drive.
 One of the easier ways to find this is the DF command:

lfmiller@lfmiller-Inspiron-One-2330 ~/Downloads $ df -h | grep "CRP DISABLD"

/dev/sdb         32K   32K     0 100% /media/lfmiller/CRP DISABLD
lfmiller@lfmiller-Inspiron-One-2330 ~/Downloads $

You could also grep "32K" if you want anyways you'll need the mount point, in my case it's "/dev/sdb" this time around. Also make a note of the directory, you'll need this to erase the current firmware.bin file, and that is what we will do
next. Erase the firmware.bin file that is on the drive, ***WARNING*** THIS STEP CAN NOT BE SKIPPED, if you skip it it will cause problems * See my notes below *

rm "/media/lfmiller/CRP DISABLD/firmware.bin"

So now you have a blank (empty) device. Now we want to put a new firmware on it.
issue this command:
sudo dd if=firmwaretoupdate.bin of=/dev/sdb seek=4

lfmiller@lfmiller-Inspiron-One-2330 ~/Desktop $ sudo dd if="mbunio factory firmware.bin" of=/dev/sdb seek=4
[sudo] password for lfmiller:
64+0 records in
64+0 records out
32768 bytes (33 kB) copied, 0.014345 s, 2.3 MB/s
lfmiller@lfmiller-Inspiron-One-2330 ~/Desktop $

 The very last step is to wait, I've found that there is a very large write delay, and it takes a while for the firmware to update. This seems to be a limitation of linux, as when I tried this with a Windows box, I did not have a delay issue.

2nd ***** WARNING *****
I have had to wait anywhere from 20 secs to 45 secs.
if you don't wait, it will fail, and the old firmware will still be on the device.

If you forget the sudo in the dd command you'll get something like this:
lfmiller@lfmiller-Inspiron-One-2330 ~/Desktop $ dd if="mbunio factory firmware.bin" of=/dev/sdb seek=4
dd: opening ‘/dev/sdb’: Permission denied
lfmiller@lfmiller-Inspiron-One-2330 ~/Desktop $

Bash Shell script:
https://github.com/kd8bxp/mBuino_Linux_uploader
  1. This is a quick dirty script, run it with the sudo command IE: sudo ./uploadfirmware.sh
    run it in the directory that the new firmware is in. Make sure it has execute rights
  2. It doesn't do a whole lot of error checking at this point, and my brain is getting to tired to figure it. It will fail if the mBuino is not plugged in, or not in upload mode
  3. It will not ask you to confirm, it will just do it, so be sure.
  4. It will look for the newest firmware (bin file), that is the file it will upload.
  5. It will tell you the mount points that you need if something does go wrong
  6. It was tested on a few different firmwares, and worked, each time.
  7. It has a sleep delay of 30 seconds, and prompts you to not remove the device before hand, see my blog for details on that.
  8. Fork this and fix it up :-)

** NOTES:

 Here are a few things I've found that are a bit quirky, but could cause issues.

I forgot to erase the old firmware once (and then I did it again to duplicate the results) - What ended up happening, is my linux box couldn't decide what the device was, and didn't mount it, thou it did show it in the drives list, it did not show it as "CRP DISABLD", and refused to do anything with it.
I ended up rebooting the computer, holding the reset button again, and the drive appeared as it should. Erased the firmware, and put a new firmware on it,
 I still had to wait for a while, but this time the reset button didn't work, I had to remove power and plug it back in. This worked at least for me.

It's very important to note that this also happened to me when I put a firmware that had an error on it, I did this on purpose as well, Something similar happened, but this time I was able to remount the device and make changes.

I've done limited tested so far, and hope to update this more over time.  And I hope to get a more automated way to update written soon.









Sunday, June 1, 2014

Where to Start! FPGA, PSOC?

Ok, so I was looking at some kickstarter campaigns again. And came across this:
https://www.kickstarter.com/projects/13588168/papilio-duo-drag-and-drop-fpga-circuit-lab-for-mak

I read it, and thought, wow, that's pretty neat.
And so I had to find out more.
So if you don't already know a FPGA is a Field-programmable gate array. And the way I understand it (which isn't that much really) IS it's all digital, and it's all logic based like on AND, OR, NOT gates, but using these you can "build" timers, switches, computers, and just about anything that uses logic gates. They are on a signal chip, or sometimes a couple of chips.

Well, that is really all I know about these, they sound completely amazing, and I'm wondering just what they really can do if there were millions of them together (Yup, I'm thinking of building Data, come on I can't be the only one who has thought this).

Anyways, FPGA are made by a few different companys, Xilinx, Altera, Lattice, Actel, Achronix, and that is just a few.
The Papilio uses a Spartan 6.

OK, good so far right? These devices seem to be all over the place in price, I've found a few Altera boards on ebay for as little as $15 bucks from China. But typically the prices seem to sit around $45 to ???? (Yup I've seen a few board that go into the 4 digitals a few, very few, but they are out there)

And other then finding boards and manufacturers, I'm really no more along to understanding how to use or program these boards. Speaking of programming,
some of the boards seem to use JTAG, some FTDI (Serial), some "emulate" either JTAG or FTDI using USB.
They all seem to use VHDL or Verilog (or a combination of the two), it also seems that each board manufacture may or may not have a variation of VHDL or use it's own IDE.

There are some but not many tutorials on how to use these, Papilio does have a descent amount of tutorials. So I have been leaning toward one of those boards, but it's hard to make a descision with out a whole lot of information.

 Cost isn't the only factor here, how ever it is a big factor, so a lower cost board that is just as capable as it's pricey brothers would be better. 

Here is what I found, and what I don't understand:
Papilio One 250K - $38 marked down from $50 - Ok I get it doesn't have much ram I guess IS that important for one of these? OR is it all about the processor? and is processor even the right word for these?
Processor: Xlinx XC3S250E and 4Mbit SPI Flash memory
easy introduction to FPGA, digital electronics, and system on a chip design
easily add new functionality with wings that snap onto the board (OK? So these are like Arduino shields from what I gather, and seem to only be offered from Papilio and only work on Papilio - Appears the Papillios don't have anything on board other then just what they need to work)
Two-Channel USB connection for JTAG and Serial Communications (OK does this mean I don't need a JTAG programmer? it's not real clear, but I'm assuming that the board is USB/JTAG emulation)
Four independent power rails at 5v, 3.3v, 2.5v, and 1.2v Ok this might come in handy for something
Power supplied by a power connector or USB
Input Voltage (recommended) 6.5 to 15v (IT doesn't say, but I'm pretty sure this has to be DC)
48 I/O lines
Papilio One 500K - $65 marked down from $80 - Big price dereference here and I'm not sure what the real differences are. So lets look:
Processor: Xlinx XC3S500E and 4Mbit SPI flash memory (Ok, so it's a different processor, but is it better or worse, I don't know I don't have enough info)

Everything else looks like it's the same as above.

 Papilio Pro - $85 marked down from $100, but this looks like a very different board to me.
Processor: Spartan 6 LX8 FPGA
high efficiency LTC3419 step down dual voltage regulator
dual channel FTDI FT2232 USB 2.0 Full speed interface
64MBit micron MT48LC4M16 SPI Flash
48 I/O pins arranged in a Papilio Wing form factor
32mhz crystal oscillator

I don't know if this is good or bad for this board, I really don't understand what it can or can't do, and I don't know why it's different from the other two boards.

Papilio also has that kickstarter campaign running.

So a couple of other boards I was looking at:

 Elbert V2 - Spartan 3A FPGA development board.
Spartan XC3S50A in TQG144 package (Similar boar as the Papilio 50K?)

16Mb SPI flash memory, USB 2.0 interface for on-board flash programming, FPGA configuration via JTAG and USB.
8 LEDs, Six Push Buttons and 8 way DIP switch for user defined application,
VGA output, stereo audio out, Micro SD card adapter, three seven segment displays, 39 I/O lines, on-board voltage regulators for single power rail operation.

OK,  I didn't tell you the price for all this: $30 bucks.


The Numato Labs website looks like it has the information for this board, but doesn't really look like it has a tutorial for using FPGA - So that leaves the question will any tutorial work (IE: the one from Papilio?) Will any software work, IE: if I want to use the pac-man game from papilio will it work on this board?

I'm thinking this board is better in a lot of ways and worse in some other ways.

Cost wise, seems to be better (but maybe not, I don't know enough to know if I'm looking at an old processor or what)
But it does have a lot of "extras" on board, is all that needed? I would have to say yes and no, and here's why. IF you aren't going to use the 7 segment display it's just taking up room that could be used for something you are going to use.
BUT on the other hand you don't have to buy anything extra to get something useful working right out of the box either.
Papilio has what they call wings, including some "mega-wings", Wings seem to range anywhere from a $5 - 8 dollars to $15 - $20 dollars,
"mega-wings" on the other hand seem to go from $25 to $150 dollars, I will say thou they do have a megawing arcade system that is very reasonable price
The nice thing about Papilio is if you don't need it you don't pay for it, but it ends up costing more in the long term.
Elbert V2 vs The Papilio boards:
Elbert 39 I/O pins - Papilio 48 I/O pins - ok I think this is probably a toss up, you lose 9 pins with the Elbert, but if you add any wings to the papilio you lose pins (and you'll almost certainly have to add things to the Papilio to make it useful)


As I sit and write this document, I am starting to wonder if the Elbert wouldn't be the board to buy. Then again I don't have enough information

But you've made it this far, and so have I - My title said FPGA and PSOC!
Let's talk about PSOC so while I was trying to find out more and FPGA I came across the Cypress CY8CKIT-042 PSoC 4 Pioneer Kit - only $25 bucks
Like FPGA there appears to be a lot of different types of PSoc controllers, unlike FPGA Cypress seems to be the only one who makes them. I kind of take that back, there is something call FreeSoc (But I think Cypress still makes the chip for that project)

So PSoC is Programmable System on Chip, and they are "mixed-signal" arrays, and there is a micro controller that controls the array I guess, I'm not sure how they work. Supposedly these are easier to learn how to use if you only have a micro-controller background.
These can do both analog and digital I/O. From what I gather they are similar to FPGA but are very different to use

So I don't know where to get started in something that is more then a  micro-controller, and less then "Commander Data", but might get me a "Data" one day.

The way either sound it sounds like fun times, and a great chance to learn something new.

Any helpful info would be - well helpful!

Wednesday, January 29, 2014

Robot's of the Future are based on Apple II computers! WOW!!!!!!

After seeing this blog: Terminator: Do Robots Think in Apple II source code http://mentalfloss.com/article/15832/terminator-do-robots-think-apple-ii-source-code I got to think about it, and I saw another robot that must at least think in Apple II source code - at least his processor would support that idea.
Of course you all know the Apple II has a MOS 6502 processor right, so I think all robots in the future must be made from our old Apple II machines.... :-)