Installing icestorm on a mac

So I caught a hiccup

You need to install Xcode probably

Firstoff, you need to install libusb

brew install libusb1

make and install libftdi from source

http://www.intra2net.com/en/developer/libftdi/download.php

brew install python3

 

brew install gnu-sed

brew install gawk

brew install mercurial

brew install bison

go to icestorm website

Run all the the commands. like it says. Maybe you’ll find more packages that you need installed that I had already. Look at the error and brew install some guesses.

Here’s a kicker, go into the makefile for the iceprog and add a 1 to the end of -lftdi so it becomes -lftdi1

I changed the Makefile in iceprog to have the following stuff. I don’t think my libftdi was installing where expected by default

LDLIBS = -L/usr/local/lib -L/usr/lib -lftdi1 -lm
CFLAGS = -MD -O0 -ggdb -Wall -std=c99 -I/usr/include/libftdi1
DESTDIR = /usr/local

I guess cc automatically peels lib off the front. Go fig.

Okay. Cool.

Then I git cloned the repository from the hackaday tutorial to see if I could get it to run

http://hackaday.com/2015/08/27/learning-verilog-for-fpgas-hardware-at-last/

./build.sh demo

I got the error

Can’t find iCEstick USB device (vedor_id 0x0403, device_id 0x6010).

D’oh.

Well.

brew install lsusb

used lsusb. I can see it right there. The computer can see the thing.

Apparently i think the arduino drivers I have installed previously conflicted with libftdi or something, so I had to unload them

kextstat | grep FTD

Copy and paste the names you find to unload the ftdi devices

sudo kextunload -b com.FTDI.driver.FTDIUSBSerialDriver

sudo kextunload -b com.apple.driver.AppleUSBFTDI

finally I got blinking lights.

Jesus.

Xbox Controller BeagleBone

So I got my new beaglebone black in the mail today and decided to take it for a spin.

Go to getting started, install the drivers. Make sure you can write a blinking lights program.

Plug in the beaglebone to an ethernet port somewhere

Pull up your terminal

ssh 192.168.7.2

sudo apt-get install xboxdrv

in your cloud9 IDE terminal run this command

npm install node-xbox-drv

Very similar to arduino

Can just use a node library to attach to the controller

https://github.com/Jabbath/node-xboxdrv

Make a new file and put this in it

var xbox = require('node-xboxdrv');
var controller = new xbox("045e","028e",{});
var b = require('bonescript');

b.pinMode(“USR0”, b.OUTPUT);
b.pinMode(“USR1”, b.OUTPUT);
b.pinMode(“USR2”, b.OUTPUT);
b.pinMode(“USR3”, b.OUTPUT);

controller.on(‘a’,toggle);

var state = b.LOW;
controller.on(‘leftY’,function(data){console.log(data);})
controller.on(‘leftY’,function(data){console.log(data);})

function toggle() {
if(state == b.LOW) state = b.HIGH;
else state = b.LOW;
b.digitalWrite(“USR3”, state);
}

Goddamn You H-Bridge

So we bought a motor driver for which unfortunately we let the purple smoke escape and we have decided to embarked upon the dark dark road of building our own primitive motor driver.

Do not do this. Just buy a better one.

Unless your goal is to have a learn or show off the DIY motor board, no one will be impressed. It’ll be a bitch, will cost just as much, not work all that great probably, and suck the enthusiasm out of the real project (In this case a murderous axes robot).

Anyhow, we had a little adventure with the book Practical Electronics for Inventors. We found a diagram for an h-bridge.

It was a boondoggle. The resistors were probably wrong and the P-channel mosfets were written with source and drain switched.

Routers and Switches

So I’ve been a touch confused as to what the difference is between routers and switches. To an outsider they both look like boxes you plug ethernet cables into.

So there’s a couple things. First off, ethernet is a standard for communication. Communicating over wireless (the “ether”) requires careful planning to avoid screaming over the same frequencies at the same time, just like the roads need traffic rules to avoid collisions. Ethernet was designed for a bunch of computers attaching to the same hunk of copper (a coax cable) that they would all scream over so it needs a similar set of rules.

The switch I guess is operating on the ethernet protocol, and is IP agnostic. The switch itself does not necessarily need a MAC address

The router needs to be aware of ethernet protocols to work, but it also needs to be aware of IP. It needs it’s own IP and MAC address.

 

Internet Learns

I’ve started going through a free course offered by Stanford

https://lagunita.stanford.edu/courses/Engineering/Networking-SP

Seems pretty good.  A difficulty I’m having is that I’m familiar-ish enough to get bored sometimes but not so familiar that there aren’t a lot of jewels i didn’t have down.

So,, I’ve gotten through the first section and here is a summary of some of the choicest bits:

network ports are part of TCP. Guess I didn’t know that.

Home routers are doing NAT (Network address translation). To the outside world you have an IP address and a port that maps to internal IP and ports in your internal network. The router stores a table .

 

There is a rhyme and reason to the assignments of IP, both logical and geographical. Routing happens by sort of a wild card matching inside an internal table inside the router. It finds the best match according to the highest level of the address.

ARP lets ethernet or find out IPs for devices on the local physical link.