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.

Atomic Inclusion

Misc., MyUSB Library, Projects, University No Comments »

After submitting my “atomic.h” header file (which dealt with the problem of atomic access blocks in a easy manner) to the avr-lib-c project about a year ago, It’s finally gone into the CVS repository. That gives me a nice warm feeling - I’ve now officially contributed to the project in some small way.

My new “interrupt.h” header file is also almost ready, pending any extra change requests. Having to make the header files for the project has reinforced my love for working solo on projects. The red tape to get a simple change into a public collaborative project is enormous; first any changes have to be discussed, then written, then documented, then reviewed, then any changes made before it is incorporated into the source mainline. It’s rather reminiscent of the “Vogons” and their over-the-top bureaucracy in Scott Adam’s “Hitchhiker’s Guide to the Galaxy” novel. Being the sole programmer for your own project gives you a lot of freedom to make the changes you want to make in a timely manner.

I’ve recently updated the MyUSB main source (again) as well as the Mouse Demo source to reflect the new advancements in the library. I’ve also solved the problem of being unable to easily determine which events are not hooked in the user application, by a quick Java application I wrote up this morning. That gives birth to a new “HelperApps” directory of MyUSB, which houses any Java applications I make to automate MyUSB library related tasks for building and for the end-user. Having to make a whole Java applet for a simple task is a little overkill, but is cross-platform, and gives a nice formatted list of the unhooked events by checking the MyUSB events header files, and the target application’s linker MAP file.

The helper application is yet to make it into the source on my site, while I fix up the bugs and get it suitable for general use.

SWATVAC week has now started, which is the week of holidays before my exams start. Next week I’ll be doing my exams proper, and I’m petrified.

UPDATE: My new Interrupt.h header file has now also made it into the CVS. Hurrah!

University - End of Year 1

MyUSB Library, Projects, University, Website No Comments »

Tomorrow will be my final day at University for my first year of my EE/CS double degree, with only exams left to do. It’s quite scary - I still feel like I’ve only just walked through the doors!

Some more minor updates to the MyUSB library, with the code again updated on the project page. I’ve put off updating the mouse example while I stabilize the new changes, to avoid doing the same work twice. The latest update moves the user device routines from a seperate file in the MyUSB configuration folder out into their own hookable events. That’s quite neat - now if the events are unused, the user application can just not specify an event handler for them rather than having to compile and link files that contain empty functions. It also allows me to deprecate them in the future easily, which is also a huge plus.

With that configuration file gone, the only one left is the descriptors configuration files. That’s what I wanted - now updating the library should be as simple as pasting the old over the new, with only the descriptors file needing to be preserved. Much cleaner than having to retain (and update if the new library version has modified) a whole bunch of configuration files.

On the examples front, I should be able to release a keyboard example soon, thanks to the work of Denver Gingerich (barring licensing negotiations for the keyboard descriptor he’s used from a different USB project). Once the library has become stable I hope to work on quite a few examples for it, including a CDC example (virtual serial port) and possibly even an audio example if it’s possible with the hardware.

On a final note to those who are curious, the following is an image showing the bandwidth consumed by my site on the server since it was put online early this year:

Bandwidth 2007

The notable sections are numbered.

1) Site uploaded and made available to the public
2) Blog started and advertised on AVRFreaks
3) Initial DB101 Review
4) High Resolution DB101 Photos

Seems there are a lot of people out there interested in the new board!

MyUSB Update

MyUSB Library, Projects, University No Comments »

As an update to my last entry; no, it didn’t work. Specifically, the SYS assignment worked just fine, but a small algorithmic bug in the Java assignment saw me loose the greater portion of the marks. Unfortunately my marker decided that the rest of the operation, although correct in the context of the algorithmic mistake, was not valid for marks, so I’ve managed to only scrape by in the execution test. Oh well, win some, loose some, at least I know what I’m doing and I’ll pass the Java exam with no trouble at all.

Now, back to MyUSB. After toying around with the new event system I was working on, I’ve incorporated it into the main code (on the MyUSB project page) and updated the wiki documentation accordingly. It’s very nice to work with now - all event hooks are done transparently through some GCC attribute magic, which also allows for old event names to be deprecated. The new system is a lot cleaner than the old configuration header file full of hook defines, and so will make updating a project’s MyUSB library code a lot easier in the future.

An interesting side effect is that the resulting binary code decreased slightly. I haven’t analyzed why this is the case, but I would have thought adding in function calls and returns rather than inline code would have bloated rather than reduced the code size. I can only speculate that the use of proper functions freed up enough registers or gave the compiler enough room to make some better compile optimizations. Whatever the reason may be, I’m one happy chappy, so to speak.

Another advancement was the addition of switches in the makefile to enable unused function garbage collecting (found in this thread) which may prove useful in the future, as well as linker relaxations (good discussion here). The latter is a great find - it causes the linked functions to use the smaller RCALL assembly opcode rather than the larger CALL opcode where possible when calling other functions. That alone resulted in fantastic code space savings.

But does it work?

MyUSB Library, Projects, University No Comments »

I’m now into the second of my five last days at University this year. Amazing - it’s been a whole year already! I really feel like I’ve only just started at this place, so it’s scary to know I’m one fifth the way to a career as an EE and CS engineer.

Both my Java and Systems (that’s C/C++) assignments have been handed in, the latter of which is due for an execution test this afternoon to validate that it does in fact do what it is supposed to do. I’ve personally no idea - the whole assignment’s been a real disaster from the start (with the lecturer posting the solutions instead of the template) and no one I’ve talked to has figured out what values to input into the given program formulas to test the output. I’ll be passing the assignment however, as the code’s good and all the tasks are done, even if the exact implementation may be a little wonky.

I’m actually rather enjoying playing the role of a teaching assistant. I’ve found no issues this year in the programming side of the course, and I’ve picked up both Java and C++ very quickly. Having people I’ve never met come up and ask me a question, and then being able to answer the question thoroughly and with the use of diagrams on a whiteboard and marker gives quite a bit of personal satisfaction. I’ve struggled with the Physics and Maths side of things this year, which is an area outside my experience, so being regareded as the come-to guy for something is a nice change. Eventually I expect to get an actual TA job at my Uni in my third or fourth years, helping out the first years in the programming labs.

Next week SWATVAC starts, which is the study break before exams. I’ve got a lot of things to study! When it’s all over I’ll be finishing off MyUSB, as I thoroughly miss working with AVRs.

Speaking of MyUSB, from the recent discussions on AVRFreaks about discarding unused functions at the linking stage, I think I might have a way of re-implementing the USB event hook system to a similar way that the ISR system works in GCC. By using the weak attribute I can create overrideable functions, something I’ve experimented with before. However I’ve had the problem of the overridden library functions still making their way into the resulting binary, even if they’re unused. But by using a few strategic GCC command line arguments I might be able to force the linker to discard the unused functions, eliminating the code cost.

Such an implementation would require the extra command line arguments to be documented, as the rest of the implementation is now in the wiki. The implementation would be along the lines of the following:

MYUSB_EVENT(USB_Connected)
{
// Event code here
}

Rather than the existing method of changing the hook #define lines in the config directory. I think this is a better idea - anyone else care to comment?

Assignments

General, University No Comments »

Sorry folks, nothing new to report.

That’s not to say I haven’t been busy - quite the contrary. I’ve been working from 8AM-11PM for the last week, trying to finish all my university programming assignments. They’re still not done, with my second (and last) one still unfinished with only a few days left until the deadline. It’s for this reason I’ve been neglecting posting here, as well as being less active on AVRFreaks than usual. By next week I should be back to my normal workload, and into exam revision.

Some exciting news about someone else’s efforts however - Martin Thomas, of AVRFreaks, has ported the DB101 application code over to the GCC compiler. It’s available for download from his website, here.

Looking forward to keeping sane hours again. That’s all (for now) folks!

Micromachines

General, MyUSB Library, Projects, University No Comments »

Half the USBKEY is now soldered up with the adapter boards, which are already proving useful. Having easy access to the serial USART is fantastic, as it allows for a much higher-level debugging than the JTAG MKII allows. Both systems combined make for very easy debugging - from a technical standpoint, that is.

The other half of the boards will have to wait. I underestimated just how darn difficult - even with a fine-point iron - it is to solder the absolutely minute pads on the USBKEY. If there’s ever a petition to up the size to normal 1mm pads, I’ll be the first to sign.

Time for me at the moment is very short and very precious - plenty of homework to keep me busy until the mid-semester break in another two weeks or so. Then I’ll have a nice long week of rest before being pushed right back into the thick of things for the last term of my first year.

In other news, Atmel have just released a very interesting AVR video blog post about the history of AVRs which I highly recommend that everyone so-inclined should watch. Lots of interesting behind-the-scenes footage of the Atmel fabs and design house, which is what I’ve been craving to see ever since the AVRTV website started up a few months ago.

Last week, my latest USB memory stick died, making it the third or fourth I’ve gone through. I seem to have a bad juju about me about USB memory sticks (and packages, which is another story) with fake sticks, bad flash chips and dead controllers being the norm. My next stick will hopefully last a little longer. After the first one died, I was taught a painful lesson about keeping backups on the hard drive after loosing two weeks worth of code. This time I faired better, with only inconsequential files being lost (as I was using it as a transport between computers).

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