In this video I cover the hardware design of my development board. As promised in the video, I will post the schematic, board, and production files here shortly.
Note that this project was completed in a project hiatus, so the documentation is sparse and was uploaded after the fact.
I am working with PSoC Creator, and programming in C.
The first thing I had to do was design a driver for the ENC28J60 that ran on the PSoC. This was an adaptation of a driver for this chip that I wrote in assembly in college. Nobody seems to have a working driver for this chip on the internet. I've seen so many people comment in blogs how everything on github just ceases to work after some time. With the power of Already Having Solved This Problem A Long Time Before I Wrote This, I can tell you that my driver works perfectly. I now have a website running on my chip. I've had my chip connected to the internet for months, and I've experienced no issue with communication.
After writing the driver, I started to program my own ethernet stack. I learned a lot there. I successfully got my own stack all the way through DHCP to lease out an IP. I implemented ARP's. I implemented UDP. I was about to implement TCP (so that I could implement HTTP), when I learned that LWIP (Light Weight IP) exists. LWIP is a very small, but full featured stack that is written in C and super easily portable to different system architectures. Its pretty much good to go in anything that will compile C. The only thing that is architecture dependent that you will need to handle is a timer, and calling some of the LWIP functions on that timer, so that the code can manage things in the stack like ARP's, and some functionality of TCP, and possibly some other things that require retrying to send a message.
Once LWIP was set up, I configured it as an HTTP server and began to set up a website. My passion has never, never, never, never, NEVER been HTML, javascript, and CSS. However, for the sake of this project, I endured it long enough. I actually have a very slick drag and drop website that I store in a fake-o filesystem on the chip and send over when its requested.
The goal was to set up a linked list of variadic function pointers inside the PSoC. The UI would be the website. It would be incredibly similar to simulink. The user would drag and drop a control loop on the page. The page would use websockets to communicate with the chip and re-configure this linked list of variadic function pointers. A bonus for this project would have been to hijack cypresses analog routing grid to re-configure the analog routing in run-time. I wrote a search algorithm to make this happen (since their routing grid is not as simple and nice as a crosspoint switch), but I haven't implemented it into the C code.
After I had enough Javascript and CSS, I got slightly tired. I may pick this project back up at some point, but I think I have extracted all I can intellectually from it. In addition to the Hardware Downloads I promised earlier, I am also going to include the PSoC Creator Project file. This zip contains the standard directory structure for PSoC projects, so you will be able to flash the chip with this software. It also includes some files of my own. The website folder contains the current website. If you run the build script in the main directory, it will move the website into the directory structure where it is needed for LWIP. It will compress the website and fit it into the fake-o filesystem used by LWIP. It will also tell you how many bytes the website will use in the chips memory which is very useful.
Do not worry about the run script. At one point, I hacked a raspberry pi to operate on raw ethernet and just pass data through its stack so that I could run my PSoC code on an RPi with only a slightly modded ethernet driver. This let me test versions of my code remotely by ssh-ing into a RPi on a VPN.
Below, I will include images of my beautiful webpage as well as the zip file containing the PSoC Creature Directory and everything else you need.
Bunch of Electricals | Matthew Ian Burns
burns.matthewian@gmail.com