====== Tools ====== Useful things which are by no means part of the end result, but are essential or convenient to making it all happen. ===== USB Sniffer ===== Originally I tried USB.org's [[http://www.usb.org/developers/tools/|USB Command Verifier]], but this proved very unsuccessful indeed --- it failed to detect any devices connected to my laptop at all, perhaps I was at fault for using devices which are not high-speed, I'm not sure. The bottom line is that it did not prove productive spending time on it. After much scouring of the web, I eventually came upon [[http://sourceforge.net/projects/usbsnoop/ |SnoopyPro 0.20]], a low-level USB sniffer for Windows NT/XP/2000. It's an opensource, sourceforge-hosted project and hence is freeware. Below is a screenshot of the first two expanded nodes of a USB HID Keyboard device enumerating: {{ project:enumeration-expanded.gif }} I tested the functionality of this using a USB keyboard, and typed the classic ''Hello World!'' phrase into it, the collapsed nodes were presented thus: {{ project:hello-world_-collapsed.gif }} You can see the data on the right, which showed the depressed keys on each update --- so the updates translate as: Shift, Shift + h, Shift, [none], e, [none], l, [none], l, [none], o. **Note:** I have also tested [[http://www.hhdsoftware.com/usbmon.html|HHD USB Monitor]], which is highly recommended and appears to be used by Microsoft judging from some of the screenshots in one of their powerpoint presentations on USB, and while it does format the data better and can give more background information on a device, it does not perform significantly better than SnoopyPro for my purposes, and more importantly **neither can tell you about the USB traffic of a device which didn't enumerate (at least partially)**. So while I have the demonstration version of HHD installed, I feel that SnoopyPro is enough --- and it's open source! ^_^ ===== Terminals (Dumb Terminal & Hyperterminal) ===== {{ project:dumbterminal.jpg}} Once the PIC16F877 was working I attached it to a dumb terminal and, after very little effort configuring it, got it to display ''Hello World!'' repeatedly. The settings I used for the dumb terminal: FDX PFKEY: NO BAUD: 9600 DATA BITS: 8 PARITY ENABLED: NO PARITY: SPACE STOP BITS: 1 HANDSHAKE MODE: NONE AUTO NEWLINE: YES RET KEY: CR KEYBOARD: UK RATE: 60HZ CLICK ENABLED: YES MARGIN BELL ENABLED: YES KEYBOARD LOCK ENABLED: NO SO/SI: LOCK SCREEN REVERSE ENABLED: NO SCREENSAVER ENABLED YES SCROLL ENABLED: YES CURSOR: BLINK CURSOR: BLOCK PROG MODE ENABLED: NO L25 OFF: MSG MODE: ADM3E I tried to plug this into my laptop's USB serial port and use HyperTerminal, but had no success until one of the technicians, Barry, suggested I first try connecting the dumb terminal straight to HyperTerminal, and get them to communicate --- i.e. PC to dumb terminal. By luck the gender of the plugs were incompatilbe, and we were unable to find a proper adaptor, so we used two RS232 plugs connected to the patch board as our adaptor. HyperTerminal and the dumb terminal talked to each other first time! The only slight issue I noted that that pressing return moved the cursor to the begging of the //current// line, and not a new line. {{project:helloworld.jpg }} I'd cheekily wired both plugs to the correct pins of my MAX3232 to avoid having to plug and unplug all the time, and to my dismay powering up the PIC output ''Hello World!'' to the dumb terminal, but not HyperTerminal. Thanks to this setup, I realised that I only needed to swap the Tx/Rx wires on the patch board for the HyperTerminal plug and all was well! HyperTerminal displayed the repeating ''Hello World!'' lines! :!: Note: I have recently had trouble using HyperTerminal. It appeared that data was only flowing in one direction (I could see debugging output from the PIC only) --- the problem? I had 'ScrollLock'((ScrollLock is a seldom used and somewhat mysterious button between PrintScreen and Pause/Break just right of the F12 key on most keyboards)) on. Interestingly, the two plugs I have now (each with different wiring Rx/Tx) cannot be swapped, they only work with the device they were wired up for; so to speak. I used the following settings: ^ Bits per second: | 9600 | ^ Data Bits: | 8 | ^ Parity: | None | ^ Stop bits: | 1 | ^ Flow control: | None | An informative illustration of this setup: {{ project:terminalssetup.jpg }} HyperTerminal working with my [[:project:usb:code:goodlink]] test code: {{ project:hyperterminal_goodlink_code.gif }} ==== Tera Term Pro ==== The best replacement for HyperTerminal, in my experience, is [[http://hp.vector.co.jp/authors/VA002416/teraterm.html|Tera Term Pro]]. Don't let the website put you off, if you want something useful and free for doing Terminal emulation over the serial port, look no further. I use this every day at work to log into an embedded Linux platform, and it does everything I care about - including copying text to clipboard when you select it, and pasting the clipboard when you right click. ==== Advanced Serial Port Monitor ==== HyperTerminal was giving my some trouble once the logs from my firmware started to become quite involved and took up more than a 'screen' in HyperTerminal - for some reason HyperTerminal was corrupting all of the scrollback buffer, so I couldn't trust anything which requred scrolling back to read. I looked around and settled on [[http://www.kmint21.com/serial-port-monitor/|Advanced Serial Port Monitor]] - this does allow scrolling back, has a great interface and some options I'm really thankful of - like a nice button to toggle 'Write to file', also this file is not locked by the application, so I can add seperators and comments to the log inbetween firmwares quite conveniently. Also it supports adding timestamps to the end of each data packet (and this end of packet is detected by a sequence of character you can specify). Other than the usability features, it performs the same function as the above, so I won't go into any more detail. I will add that **it is shareware**.