VHD(hel)L

General, 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

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, 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, 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…

Semi-literate

General, MyUSB Library, Projects, University No Comments »

Birthday’s are neat. While I’m not much of a consumer - at all - birthday’s do allow one to indulge slightly and make living just a little more pleasant. In the case of this birthday, I’m now a proud owner of a few more Stargate seasons, a new Maxtor Onetouch Mini 4 external hard disk for backups and a new Logitech VX Revolution wireless mouse.

Paying a little more gives a lot more benefit, I’ve come to learn. Cheap is cheap, in both quality and service. Now I’ve got a good quality Toshiba notebook and Logitech headphones and mouse, I’ve realized just how much nicer the spit-and-polish is on the name-brand products. No more Chinese cheapies for me!

One gripe so far; the Maxtor Onetouch backup software doesn’t work for me. The software detects the presence of my drive fine, but is hell-bent on indicating it as drive C:\ instead of its real drive letter allocation. Not a huge problem if I could manually set it, but as it is I can currently only backup C:\ to itself. Not a very useful proposition but one I hope to rectify with technical support.

As for the bootloader, I can now read back data correctly. Writing is still an issue which I have to tackle, but at least it’s the only remaining issue. I got back to University for year 2 in a week and a half, so I hope to have it finished completely well before then.

Format Complete!

Misc., Projects, University No Comments »

Today marks some real progress with the Mass Storage code - it’s almost finished. With the latest code I can now format a 16MB flash disk, give it a name and drop very small files onto it (less than 64KB or so each). For some reason folders or any files larger than about 64KB aren’t reading (or writing) correctly, and have the data above the ~64KB mark all repeating garbage. I’ll have to look into that and try to suss out the source of the problem.

My previous problems with the formatting was down to a few mis-calculations in the MODE SENSE command, as well as a few bugs in the READ/WRITE command (one of which was a missing check for the endpoint recieved flag, resulting in writing and reading before the host was ready). Tests show that the host doesn’t seem to use the READ SENSE (10) command at all, so I’ve thrown all that code away in favor of just the MODE SENSE (6) command, which is definitely used and required.

With any luck the example will be finished by Friday, when I get my second semester University exam results.

Free at last!

General, University No Comments »

Today marked my end of University exams, with my Physics For Engineers exam being my final one for the year. I’m officially free of all duties for the next three months, and it feels great!

One whole year of University down, four more to go. Boy, this year has really flew by!

Now’s the time to get to doing the things that I actually want to do - work on my projects, help out with the AVR-GCC/avr-lib-c projects, find some work and earn some money, write more tutorials and get my learner’s permit for learning to drive. Tally-ho!

Device Addressed!

MyUSB Library, Projects, University No Comments »

Finally, I’ve done it. And about time, too. MyUSB can now successfully enumerate and address my USB Keyboard, acting as a USB Host.

That’s exciting news (to me at least) as it’s a decent milestone towards getting the library complete. The host code isn’t finished by any stretch of the imagination - bugs to fix, and the API to flesh out. Lots of things are still missing, like data stages for USB control requests, and a good API for reading out data from the pipe. Still, I can now talk to the keyboard correctly, which is what I was setting out to do.

The first USB host demonstration application, which I’m currently working on, is a USB mouse host. Similar to the official Atmel demo program, it will enable the user to plug in a USB mouse, and have the mouse movement/button presses shown on the two bicolour LEDs of the USBKEY board.

Only two more days to go, before I have my last Physics exam on Tuesday. I’ll be quite relieved to have them all out of the way, so I have free time to finish MyUSB. As always, stay tuned for project updates!

Totally PO’d…

General, MyUSB Library, Projects, University No Comments »

Halfway through exams now, with three to go. Tomorrow brings a Java exam, Friday a C/C++ and Tuesday sports a Physics exam. I’m very shaky on the latter, so I’m doing a lot of studying up this week.

Some happy news. Thanks to a rather generous soul, Adam Eberbach, who rather liked my tutorials I wrote about AVRs, I’ll soon be the proud owner of a PoScope. It’s no replacement for a real high-bandwith scope, but it’s neat none-the-less. It’s suitable for audio-signal analysis, but also (what I’m really looking forward to) for logic analysis at 8MHz. I’d tossed up previously between trying to get a logic analyzer and trying to get a scope, but this way I’ll be able to have my cake and analyze it too.

Denver Gingerich, the man behind the MyUSB keyboard demo, has sent me a new patch for a magnetic stripe card reader. It’s now included in the MyUSB source code. Built on the keyboard demo, the project enumerates as a standard USB keyboard, and transmits read card data as a 1-0 ASCII stream over to the computer. He’s also got a nice support page set up for it, located here. Oh, and a blog post about it, too.

I’m slowly working on the host code. I’ve been fixing a number of bugs with the library, and currently the plugged-in device is just returning a USB Setup Stall request in response to my GetDescriptor control request. Further work is needed to debug the problem and get the code working. Still, at least it is being worked on. Stay tuned!

One down, four to go…

MyUSB Library, Projects, University No Comments »

This morning I completed my first end-of-year exam, my Math for Engineers paper. Three hours of tedious matrix multiplication, probability distributions and the solving of several types of differential equations. I’m glad that’s over!

With the completion of my first exam comes a new update to the MyUSB codebase, which now includes Denver Gingerich’s keyboard demonstration application. I’ve also fixed a number of bugs, which means the code is even better than before. After exams have completed I’ll get back to the host code (which requires a lot of effort and time), rather than just the small bug-fixes, restructuring and additions I’m doing now. Despite the limited time I have, I think I’ve accomplished quite a lot in the past week or so, with the new event system and the decoupling of the library from the end-application.

Once again, if you’ve been using MyUSB I’d love to hear from you!

I’d also like to publicly thank Christian of Object Development for being such a good sport about letting Denver’s keyboard demo copy the keyboard USB report descriptor he made. There’s a great firmware-only USB driver (for AVRs lacking the inbuilt USB controller which MyUSB requires) over on the Object Development website, which I highly recommend to those who aren’t using the AT90USB series AVRs and thus can’t use MyUSB.

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