• 201011.21

    Vim: Cursor at beginning of tab in normal mode

    One thing that annoys me in Vim is that in normal mode, the cursor defaults to being at the end of a tab character. When I hit "Home" I expect the cursor to go all the way to the left, but instead it hovers 4 spaces to the right of where I expect it to. I stumbled across the answer after reading a mailing list thread for vim.

    set list lcs=tab:\ \ 
    " Note the extra space after the second \

    You can put this in your .vimrc to automatically set this behavior. Very useful.

    Comments
  • 201003.21

    How to get the TOP2004 programmer running under Windows 7 64-bit

    UPDATE - Apparently closing the VM, unplugging the programmer, unselecting the programmer from the USB device menu, or pausing the VM after the programmer has been loaded by the VM makes Windows 7 bluescreen. So far, I have not found a way around this, as such the TOP2004 is effectively useless again. At least it's able to program chips and stuff, but once loaded, the VM has to stay open and has to be running. Pretty lame. I'll try to find a fix and update (BTW I'm using the latest VirtualBox as of this writing). Any ideas?


    top2004I love electronics. Building basic circuits, programming microcontrollers, making malicious self-replicating robots programmed to hate humans, and even so much as wiring up complete motherboards with old processors and LCDs. I had to find a USB flash/eeprom programmer that fit my hardcore lifestyle. On ebay a few years back, I bought the TOP2004. This wondrous piece of Chinese equipment is cheap, cheap, and USB. I needed USB because in the process of making my own flash programmer a while back, I destroyed half the pins on my parallel port. The programmer worked great, but only worked for one chip. I needed something a bit more versatile. The top2004 isn't a bad piece of equipment. The manual was translated poorly from Chinese, as is the software that comes with it.

    Well, for the longest time, I was a Windows XP guy. Nowadays it's all about Windows 7. Don't get me wrong, I'm Slackware through and through, but I need my gaming. So I installed 64-bit Windows and love it, but my programmer no longer works.

    Requirements: a 64-bit OS that doesn't let you use 32-bit drivers (namely Windows 7 x64), a 32-bit version of Windows laying around, virtualization software (check out VirtualBox) which is running your 32-bit version of Windows, a Top2004 programmer, DSEO, and the infwizard utility with libusb drivers (virus free, I promise).

    Here's the fix:

    1. I remembered when jailbreaking my iPod a while back with Quickfreedom that there was a utility used to sniff out USB devices called infwizard, which I believe is part of the libusb package. I never liked libusb because I remember it royally messing up my computer, but the infwizard program was dandy. It can write very simple drivers for USB devices without any prior knowledge of what they are. I used this with the programmer plugged in to create a makeshift driver. Note: Make sure the libusb* files in that zip provided are in the same directory as the .INF file you create for the programmer.
    2. 64-bit Windows doesn't like you to load unsigned drivers. In fact, it doesn't allow it at all. You have to download a utility called DSEO (Driver Signature Enforcement Override) to convince Windows that it should let you load the driver you just created.
    3. Once you turn driver enforcement off and load up the driver, you should now be able to see your TOP programmer in the device list. Boot your VM, which previously couldn't use the programmer (because it had no driver), and install v2.52 of the TopWin software. Once installed, you should be able to select the TOP2004 from the USB device list, and voilá...your programmer works.

    Obviously running it in a VM is less than ideal, but it's better than dropping $200 on a real programmer that might actually have 64-bit support. The great part about this version (2.52) of the TopWin software is that it supports the atmega168, which is almost exactly the same as the atmega328...meaning arduino fans new and old can use it. I'm not an arduino guy and use the chip just by itself with avr-gcc, but you can do whatever the hell you want once you get the TOP programmer working.

    Comments