Semester Two Results

General, University 1 Comment »

Cue my first heartattack of the Christmas season — University results came out today, unbenownst to me. Nothing like having a cold, feeling like death incarnate and having someone at 1AM tell you to check your emails to get the blood pumping.
Well, I’ve passed second semester in all subjects. I’ve got atrocious results in analogue electronics (brutal exam), Physics (brutally bad lecturer) and Maths (I’m dumb). On the lighter side, I’m still getting fantastic results in the computer science and digital electronics portions of the course however - so there’s still hope yet. My worst fear - repeating calculus for a third time - has passed with me scraping by, so no great derailment to next year’s course structure like this year.

I’ve got to admit that I’ve really not fallen in love with the analogue side of electronics. I do like simple analogue circuits but complex feedback systems and the like bore me to death, and I’ve found that I don’t have the mindset nor the interest in them. Thankfully, course units from next year on will start to focus more on the digital and computer science portions, which equate to my version of nerd heaven.

So all in all, not the best results, but enough to get me into next year and into the subjects I enjoy rather than the subjects I’m forced to take. No more physics (heaven!) for me, just TCP/IP, Java, C++, Digital Design, and a whole host of other awesome subjects.

Macguyver’s Shack, Raytracer Improvements

AI Space Game, ButtLoad, General, Misc., Projects, Uncategorized, University No Comments »

I’ve not been completely idle these past few days, despite “being on holidays” from University until next semester starts in 2009. On Monday and Tuesday, my friends and I undertook some work from my microprocessors lecturer to design and build some low-cost educational robots for use in schools to get young students interested in the world of electronics.

We ended up with two prototypes, a submarine built by myself and my friend Luke, and a obstacle avoidance robot built by my friends Alan and Jim. Both are made from cheap components (PVC tubing, foam, film canisters, hobby motors, etc.) and are specifically designed to be educational rather than amazing feats of engineering. The submarine shown here uses three hobby motors mounted in film canisters and sealed with electrical tape, petroleum jelly and blue-tack for propulsion and dive/surface control:

Pictured without the right propellor, as we only had two at the time, and were testing the third (dive/surface) motor when the photo was taken.

The second model to come out of what can only be described as a Mythbuster’s lab was the avoidance robot, pictured below. Built using a CD as a base with small Perspex wheels lined with rubber bands for traction, it ended up working reasonably well, for a design with zero components other than batteries, micro switches and motors. Of course, I was itching to put in an ATTINY to make it somewhat intelligent, but alas that was out of the project’s complete-beginner scope.

Aside from the above, I’ve also been busy working on some more contract work over at the local Alfred hospital, continuing my work on a blood barcoding project which is progressing slowly but surely. In my downtime at night, I’ve been working on my Ray Tracer I blogged about previously, to improve its capabilities somewhat. I’ve managed to accomplish the following in the last week:

  • Fixed shadowing - was accidentally taking the compliment of the shadow factor
  • Fixed horrible hack for preventing secondary rays from returning a collision with the stating object - a better (and common) hack of moving the start point slightly in the ray’s direction fixes “invisible starting object” problems I was having when calculating shadows
  • Added Max U/V values to the TexImage image texture object, so that the texture image can be tiled any number of times across an object
  • Added correct Phong shading, moving the ambient light to a constant rather than a lighting object for speed, including correct diffusion and specular lighting
  • Added in translucency support for transparent or semi-transparent objects
  • Added in spot and flood lights in addition to the existing omni light lighting object
  • Added refractions and corrected reflection mixing routine to give better results

The results of which are much better than the previous code’s output (click to enlarge):

EDIT: Added photo of avoidance robot - thanks Jim!

I’m a free man!

LUFA (Formerly MyUSB) Library, Projects, University 1 Comment »

Woohooo - exams are officially over! I’m now a free man for the next few months, excluding any contract work I decide to take up. Yesterday I recieved my results for my Java Algorithms class, which was to design an efficient (non-database) transaction system for a ficticious phone company. Emphasis was placed on efficiency, which was a nice change from regular “whatever works” Java classes; I got to do some proper profiling of my Java code and ended up with something quite decent (the fastest in the class, in fact).

From that, I’ve learned one interesting thing: Exceptions really aren’t that bad. Last year when I first started out into the mystical land of Exceptions I honestly couldn’t see the appeal — it just seemed like an alternative to the tried and true method of returning an error code in a function. Of course, I’ve since seen the light and I realise how powerful exceptions are and how much clearer exception handled code can be in contrast to the old methods. The fact that my assignment was the fastest (slightly edging out my friend Alan, who took a very similar approach to mine minus all the exceptions) seems to reinforce that notion.

I’ve also discovered the fearesome power of hindsight, along with my other discovery that Javadoc/Doxygen comments don’t have to make your code into a complete an utter unreadable mess. I really wish I found that out for myself sooner, since I’m now stuck documenting all my demos in the MyUSB library — and there are a lot of demos. Still, with the addition of a few extra “articles” in the documentation on how the demos work from a higher level than the raw code, the next release should be sock-propelling-off-feet good. There are a lot of other changes to the library scheduled for the next release as well, of course, including a fixed and cleaned version of the DFU bootloader — no more bugs and wonky logic!

I’m thinking of setting up a freely editable “brainstorm” wiki, for people to leave suggestions for me - either new projects, interesting things to investigate, or ideas on inproving my existing projects. The comments I’ve recieved here and via email have been good, but I’m perpetually in danger of losing some of them, so a Wiki or something similar seems like a good idea to me.

UPDATE: I’ve started the new suggestion Wiki here: http://wikihost.org/wikis/myusbsuggestion/.

Not long now.

General, LUFA (Formerly MyUSB) Library, Projects, University No Comments »

Next week I’ll be attending my final two exams for the year, first DDP (Digital Design and Programming — essentially, a beginner’s course to the VHDL language on CPLD chips) on Monday, then ALG (Algorithms) on Thursday. Neither are particularly difficult in the brains department, but both require a lot of memorizing. While I fully understand all the algorithms covered, I do think it’s a bit much to make students remember every possible case for every covered algorithm for repitition on demand — Red-Black Trees alone have a good five seperate cases for insertion. I’ve always been cursed with a poor memory, so I’m possibly doomed on that alone.

On a brighter note, Gary sent me a link to his own blog, detailing some of his AVR exploits, the most recent of which is MyUSB related. It’s always gratifying to see my work being used by both commercial and hobbyists - the latter was a great consern in the design of the library, since commercial outfits would use a bad library warts-and-all if no alternative was avaliable. It’s fantastic to see that people are using it for their personal projects, proving to me that it is at least somewhat accessible to the normal AVR folk out there.

During the course of our exam study the other day, myself and my techno-geek friends got to discussing absurd communication mediums. Honestly — the lot of us looked almost identical to the characters in the awesome show “The Big Bang Theory”, with a tablet PC connected to our TV, and iPhones and laptops flying every which way. That’s neither here nor there however, as the discussion moved from the mundane (TCP/IP over LEDs) to the outrageous (TCP/IP over SMS). This was my suggestion; correctly coupled with a free online SMS service, it would be theoretically possible to write a proxy which sent out TCP/IP packets over 150 byte long SMS messages.

I don’t think SMS supports much other than the basic latin alphabet, so that means that packets would be base-64 encoded. A typical TCP/IP data packet (as opposed to a non-data containing signalling packet such as an ACK, SYN or FIN) header is around 50 bytes, so there would be sufficient space for a tenth of a kilobyte or so of data to be transmitted per message. I can’t imaging the phone company being to happy about the torrents of messages it would produce, but the TCP layer would ensure data integrity on the recieving end (even for out-of-order packets) and would probably out-strip GPRS anyway ;).

I really should spend more time studying.

It has begun…

LUFA (Formerly MyUSB) Library, Projects, University No Comments »

One thing I’ve learned in the last week - everyone loves a good ray tracer. Even my first, poorly written one. It seems that every man and his dog who has ever touched a computer has written one, and is able to give me advice. That’s a neat feeling; I’m following in the footsteps of many of those before me, and poorly reinventing the wheel for my own amusement and education.

I’ve just submitted my course enrollment for next year. It seems my fears about my failed calculus unit in first year preventing me from doing anything until I’ve completed the subsequent maths units is unfounded, as while I have different units to normal students in my course this and next year (due to the shifted maths units), I’ve still got a normal workload. It sucks that my course will be extended by at least six months at the end due to my inability to keep up in second semester last year, but it’s a part of life and something I cannot change.

For my specialties next year, I’ve decided to skip database fundamentals - I already have them, “DROP {Tablename}”, “TRUNCATE {TableName}”, “‘ OR 1=1″, *grin* - and go for the network engineering instead. That means I’ll be learning TCP/IP for real next year, which should cement the knowedge of TCP/IP I gained this year while writing my RNDIS Ethernet USB demo application for my MyUSB stack.

Speaking of the MyUSB stack, I’ve bitten the bullet and started to fully document all the demos with Doxygen. That means that the next release will contain function, macro, enum, file and global documentation for all of the demos, projects and bootloaders in the MyUSB library. It’s an absolutely enormous amount of work to be done, which will delay 1.5.4 for quite a while, especially due to my end of year exams which start in two days. Pray for my sanity, or better yet, donate!

My continued apologies to anyone whose messages to me I’m neglecting while I study for my exams. Please be patient, and above all understanding!

Ray Tracer, Exams

Misc., Projects, University No Comments »

Quite a while back I posted that I was working on my own ray tracer in my spare time, to learn the concepts behind modern realistic graphics. While the theory behind simple ray tracers was straightforward enough to myself, I had difficulty actually writing a working implementation, so the project languished. Fast forward to last week and in my spare time I started to look back over my code, and realised my errors which were preventing it from working correctly. Since then, I’ve gone from rendering two colored spheres onto the screen, to rendering many textured (image or mathematical based) spheres onto the screen with correct sphere-mapping, shadowing, reflections, omni lighting, sky lighting and super sampling.

While my small project will never develop to the point of anything capable of rending amazing images (like POVRay), it has allowed me to explore a new field which I’ve previously been interested in, but never examined. The best way to learn something is to write an implementation - be it USB, TCP/IP, Graphics or anything else technical related. Without formal study in those areas I won’t be able to place it in the skills section of my resume, but the personal satisfaction of knowing just how something works is good enough for me for now.

Here’s a small image of what it currently performs:

I’ll be exploring other possible features such as spot lighting and refractions at a later date. At the moment I’m currently in the pre-exam panic phase, with end of year exams being only two weeks away. Time for me to start the study processes that I hate oh-so-much. This means that I’ll be posting less, and email responses may be delayed by a day or two; if you’ve emailed, please be patient when waiting on a reply.

VHD(hel)L

General, LUFA (Formerly MyUSB) Library, Projects, University 3 Comments »

I found an interesting presentation today from the “Sketching in Hardware ‘08″ conference, something of which I’ve never heard before. I find the presentation interesting for many reasons, but one of them is definitely the mention of MyUSB - and there’s a nice looking USB board in the presentation too, which presumably uses MyUSB (since the library is mentioned). It’s nice to see even a little momentum being built up about MyUSB, as the more people using it the happer I become.

Since he seems to be bursting at the seams, I’ll also put another mention to Casainho’s Bicycle POV project over on Google Code. While the use of MyUSB is ancillary (used as a command and data transport from the host) the project itself is quite spectactular, and the latest pictures of the finished prototype boards are top-notch. All the best to Casainho, and I only ask that he take a picture of the final design showing a MyUSB/FourWalledCubicle themed picture ;).

Actually, It’s been an interesting week. On Sunday night I battled over timezones with another user, to help him get the MyUSB Mass Storage demo working on his custom AT90USB162 board. It turns out I’ve done the dumb thing of making the endpoints in the demo double banked (why do I keep doing this?!) which doesn’t work in that situation on the AT90USB162. Writing demos that work across the full USB AVR range is difficult when I only have an AT90USB1287 handy, but hopefully that will change in the near(ish) future and I’ll be able to fully test out the demos.

In lieu of payment for my assistance on Sunday, the user has agreed to send me a few of his custom boards. The boards themselves are (deliberately) simple - they’re actually business cards which will have my name, contact details, website and the like printed on them, with my resume and a few odds-and-ends located on the card’s dataflash, accessable when plugged into a computer over USB. It seems like a rather cool idea in my mind — a business card where the firmware of the board itself is an example of my skills — which is why I agreed to grab a few. Now all I need to do is figure out what to put on the card’s 1MB of space, other than my resume, picture and contact details. I’ll post pictures of the cards when they arrive, but the user should be posting his own information about them on AVRFreaks soon.

It also seems that the MassStore demo is broken on XP, but not for the usual reasons. The demo itself works fine as a disk — but Windows XP refuses to format the dataflashes if they’re not already formatted (which they are from the factory on Atmel’s demo boards). This is due to XP requiring the implementation of a few SCSI commands marked as non-mandatory, which nevertheless cause problems if not present. Fortunately I have backups of the old code in my local SVN and was able to re-implemented the needed SCSI commands, which are simple dummy handlers anyway.

This semester we’ve move on from blasphemous TI microcontrollers into the exciting world of CPLDs. That means I now have to learn the VHDL language, something I’m already hating. VHDL, in my experience, looks like the illegitemate inbred offspring of C, BASIC and Delphi. So many well established syntax patterns are broken in the language it makes my head hurt, and my body wish for a more C-like language for the chips.

MIghTy improvements

LUFA (Formerly MyUSB) Library, Projects, University No Comments »

Good news to all MyUSB fans! As of now, MyUSB is now retroactively released under the following permissive MIT license:

Permission to use, copy, modify, and distribute this software
and its documentation for any purpose and without fee is hereby
granted, provided that the above copyright notice appear in all
copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of the author not be used in
advertising or publicity pertaining to distribution of the
software without specific, written prior permission.

The author disclaim all warranties with regard to this
software, including all implied warranties of merchantability
and fitness.  In no event shall the author be liable for any
special, indirect or consequential damages or any damages
whatsoever resulting from loss of use, data or profits, whether
in an action of contract, negligence or other tortious action,
arising out of or in connection with the use or performance of
this software.

Which is a great step forward to getting the library into more commercial (and non-commercial) products. Essentially, this allows myself to retain the copyright and credit for my work, but allows the library to be integrated into commercial products without source code disclosure. This change will be visible in future library releases, however the above license now applies to previously released versions (including but not limited to the current release) with the exception of the Keyboard device demo and demos derived from the keyboard device demo. This exception is due to the keyboard demo being contributed by Denver Gingerich over at OSSGuy rather than myself, thus I do not have the power to relicence his contributions.

This exception may also (depending on Denver’s response to my enquiry about relicencing his portions) extend to the next release, but more will be known later.

University’s back on again and I’m going to be as busy as ever. Still, I appreciate all the feedback and questions I get by email, so don’t hesistate to drop me a line. If you’re an avid MyUSB or ButtLoad fan and want to give back to the developer (*ahem*, me!), don’t forget that I accept donations of any amount on my site via PayPal. Such donations allow me to get new toys for development and allow me to buy shiny things  while I slave away at Univeristy, so a big thanks to all those who have donated so far!

Ok, that’s my begging spiel over. Now on to the next related topic - an AVR32 MyUSB port. One of the guys behind this interesting MyUSB powered project contacted me this week enquiring about a port of MyUSB to the AVR32 line of AVR microcontrollers from Atmel. After having a look at the datasheets - I’ve not had access to any AVR32s yet - I’ve determined that it *may* be possible to expand MyUSB to support the UC3B (not the UC3A) microcontrollers using the same (or near identical) API, since the former has a USB controller very similar to the 8-bit USB AVRs.

Before I begin work on such an expansion, I’d like an interest check. If you are interested in an AVR32 UC3B series port of MyUSB, please send me an email or leave a comment so I can assess whether it is worth the development effort or not.

Reinstalls, bugfixes and timetables, oh my!

General, LUFA (Formerly MyUSB) Library, Projects, University No Comments »

Today was spent doing what seems to be my new favourite hobby - reinstalling Windows on my laptop once again. This time the reinstall was sparked by something screwing in the OS chewing threw mountains of memory for no discernable reason; a good half gigabyte chunk of RAM was totally MIA and unaccounted for. After having the Aero interface kill itself (out of memory) while trying to do nothing more than play a DVD on my system with 2GB RAM, I backed up my data and started the system reinstall.

This morning I was actually doing my second favourite hobby (neither this one nor the above I enjoy, for the record) - fixing bugs. An email from a MyUSB user indicated that the current Mass Storage demo fails to work, so off I went to investigate.

First, I narrowed down the release revision which showed the symptioms - 1.4.1 (good) to 1.5.0 (bad). No surpise there; the differences between the two are striking due to the addition of DoxyGen documentation comments, and many code changes to make the library more uniform and inline with the USB specification names and mandates. Next I did my second MyUSB bug-fixing trick, transplanting the working demo code onto the new library (fixing up any changes in the process to make it compatible). After that too failed to work, I was able to determine that the fault lay in the library code itself, rather than the demo application.

My JTAG showed that the code was failing to get out of a spinloop, waiting for the Mass Storage IN data endpoint to become ready to write to. Further probing showed this was due to the endpoint being permenantly stalled, preventing it from ever becomming data-ready. Honestly, I’m a FIRM beleiver that all AVR users need a JTAG - those who cannot see the utility have obviously not had access to one for any useful length of time. The units high cost is quickly offset by the hours saved debugging using more primative methods such as serial logging or (gasp) LED indicators.

What puzzled me was that the storage demo only stalled the data IN endpoint when the command sent from the host was unable to be processed. Not a rare occurrence; the demo only supports a limited (mandatory) subset of the SCSI command set, while the host tries to use the more obscure (but more efficient) commands where possible to speed up the transfers. However, the spinloop the code was getting stuck in was after the loop waiting for the host to un-stall the endpoint via a standard Clear Feature endpoint request.

That, coupled with my previous experiment telling me the fault lay in the library pointed to the problem — the Clear Feature standard request handler code was broken. A SVN diff showed the cause; between the two versions I had altered the code slightly, removing a critical endpoint mask from one of the parameters from the host. Adding it back in fixes the problem.

For those unable to wait for the next release, you can fix the code manually. In MyUSB/Drivers/USB/LowLevel/DevChapter9.c, the second line of SB_Device_ClearSetFeature() should be changed from:

uint16_t wIndex = Endpoint_Read_Word_LE();

Into:

uint16_t wIndex = (Endpoint_Read_Word_LE() & ENDPOINT_EPNUM_MASK);

To make the code work once again.

Yesterday I made up my semester 2 university timetable, and it’s a doozy! With five subjects each with homework, I can unhappily kiss most of my leisure time goodbye.

Exams {union} Anxiety {intersect} Me

General, LUFA (Formerly MyUSB) Library, Projects, University 1 Comment »

In case anyone is wondering, now is mid-year University exam time, which is the main reason for my lack of updates here. Actually, truth be told, discovering the (modern) Battlestar Galactica series has been the main contributor towards my laziness.

After tomorrow I’ll be free from Univeristy for a whole month. That’s great, but I’m going into my usual axiety spiral; not knowing what exactly to do any one one moment, causing me to do nothing and stress about wasting my free time. If my new contract job eventually gets of the ground I’ll have both a source of income (finally - ramen noodles, sleeping on burlap sacks and begging are tiresome!) and a sink for my creative *cough* tallent.

Soon I think I’ll release MyUSB 1.5.1, a very minor update fixing a couple of bugs in the demos and other non-critical aspects of the library like typos and the like. The library is for all intents and purposes done, so barring an ephiphany all updates in the near future will be minor only - no more frenzied development of new APIs.

It’s probably about time I got back to writing my USB book, which I’ve neglected. Hang on, I think I hear the next Battlestar Galactica episode calling me…

WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS Log in