Race condition during service shutdown

There’s a race condition in the service shutdown code which is most likely to show up if there’s an exception thrown from your implementation of ContinueService(), PauseService() or StopService() but that could show up during any service shutdown sequence. This race condition is present in all versions of the Service Library and so far has only been reported by one client. A fix is available, please contact me directly if you need it, or think you need it.

Bug fix in performance counter instance activation code

There’s a bug in all releases of our performance counter library that may cause the creation of an instance with a name that has been previously used as an instance but that has been released to fail by connecting the new instance to the previously released instance data structure. The bug is in PerformanceDataBlock.cpp, the else if around line 167 in AllocateObjectInstance() should be changed from: if (pInstance->NameLength == 0 && !

L'Hexapod: Atmel ATtiny2313 Servo Controller v0.1 - source code

Previously published This article was previously published on lhexapod.com as part of my journey of discovery into robotics and embedded assembly programming. A full index of these articles can be found here. The jitters and general instability of the hacked together simple servo controller (see here) for the ATtiny2313 were, it seems, down to the fact that the internal clock wasn’t stable enough and this caused enough timing issues to throw the PWM off enough to jiggle the servo position around rather than hold it steady.

L'Hexapod: CD74HCT238E

Previously published This article was previously published on lhexapod.com as part of my journey of discovery into robotics and embedded assembly programming. A full index of these articles can be found here. My progress has been slow over the past couple of weeks because a) I’ve been rather busy with other things and b) an order of components has gone missing in the post. The order contains some 4mhz crystals and therefore my server controller firmware testing has been on hold as I’d like to remove the potential clock instability as a potential cause of the controller jitters before continuing my debugging.

#pragma unmanaged

I’ve just spent a little too long trying to track down a bug in a mixed mode DLL that I’m building. The DLL exposes a set of entry point functions that are defined as taking a single pointer argument and lies to the application that hosts it so that the application can call it with various numbers of arguments. The arguments could change from call to call or from ‘session’ to ‘session’.

Building an inproc ATL COM object as x86 and x64

I’m currently wrapping a server’s client side API in an ATL COM object for a client. The COM object will be used to communicate with the server from managed code or VB or other COM compatible systems. It’s a fairly straight forward process as the original ‘C’ DLL interface client API was built with this kind of thing in mind and I’ve done enough C++ objects wrapping a ‘C’ API conversions in the past to make the whole process relatively painless and straight forward.

Embedded assembly programming

Well, I’ve finally done something that I’ve been meaning to do for a long time. I’ve written some non-trivial assembly language code. Up until recently I wasn’t expecting this to be embedded assembly, but it actually seems like a sensible way to get into this low level stuff. Programming an 8bit RISC microcontroller in assembly is considerably easier than trying to do something with a PC. The chips are cheap (as chips), the tools are free, there’s an active user community and the electronics required is relatively simple.

L'Hexapod: Atmel ATtiny2313 Servo Controller v0.1

Previously published This article was previously published on lhexapod.com as part of my journey of discovery into robotics and embedded assembly programming. A full index of these articles can be found here. This morning I tested the first version of my custom servo controller. It’s currently heavily based on the source for 16 channel servo controller that I’ve mentioned before. What I did was simply adjust that source for my target processor and the fact that I’m using it with a 4Mhz internal clock rather than the more standard “RS232 baud rate friendly” 3.

L'Hexapod: AVR Studio 4

Previously published This article was previously published on lhexapod.com as part of my journey of discovery into robotics and embedded assembly programming. A full index of these articles can be found here. I’ve been spending some time getting to know AVR Studio 4, especially the simulation and debugging functionality. It’s a very functional and very useful free development suite that can be downloaded from Atmel from here. As I mentioned a while back I have had a C compiler and development and programming tool chain set up for a while now but I hadn’t got around to working out how to debug the code.

Everything you need to know about timers and periodic scheduling in the server framework

Often when you’re writing a server or client application with The Server Framework you will find yourself needing to perform operations periodically or after a timeout. The Server Framework provides a light-weight timer queue that can be used to schedule timers and that uses minimal system resources so that there’s no problem with having multiple timers per connection; even on systems with 10,000 connections. The class used to manage per connection timers is the CThreadedCallbackTimerQueue class.