Before I left for our holiday travels, I ordered a couple of extra toys for my Raspberry Pi, both from UK dealer Proto-PIC.co.uk The first was a "prototyping plate" from Aadafruit which brings out the on-board connections to a circuit board and some screw connectors for solderless cabling. This one is "some assembly required", so I'll save that for when I have some more hardware-y ideas. The second item was a USB to TTL mini-UART serial cable.
When we got back home, the two items had arrived. I was particularly interested in the serial cable, in the hope that it might help me with instrumenting my bare-metal code. Built on to the Raspberry Pi board is what they call a "mini UART" (Universal Asynchronous Receiver / Transmitter). Although a bit more complicated than simply flashing an LED, the mini-UART is also controlled by writing and reading memory ports on the GPIO device. I wanted to crack on with this, so I unwrapped it and got started straight away. I had already decided to initially test the connection using the Linux card I had been using for my C programming a few days ago. When Linux starts up on the Raspberry Pi it treats the mini-UART as a "console" and sends a slew of start-up information to it, followed by a login prompt. My hope was that I would just plug the cable in and see this output on my PC.
As it turned out, it was not that simple. Unlike the more traditional RS232 serial ports which used to be on most PC motherboards and were built in to the BIOS, this kind of USB serial port only exists when the cable is plugged in. This scuppered my first attempt to open a "terminal" on the PC. In the past I have used HyperTerminal, but I couldn't find it in Windows XP, so I decided to use a serial session in the swiss-army-knife MobXterm. Unfortunately MobaXterm would not let me open a session before I plugged the cable in because it could not find the port. So I plugged the cable in. It seems that I probably made a mistake at this point. Having not bothered to fully read the instructions I foolishly allowed Windows to search for a driver. It found one, so I thought at the time that everything was OK. I set up a terminal session in MobaXterm for the new device, at the recommended 115200 baud, and got ready to plug the cable into the powered-off Raspberry Pi.
The cable came with no instructions itself, and the wiring instructions on the web site are a bit vague, so my first attempt at connecting the cable to the Pi was a bit speculative:
When I did this I got a bit of a surprise. Immediately on connecting the black and red cables, the Raspberry Pi powered up. Apparently the USB cable provides enough juice through its cables to run the whole computer. This seems a really neat feature, but might make it tricky to switch the power on and off when I am swapping SD cards and re-booting to try new versions of my software.
Once I had got over that I tried to see some output. Nothing.
Unsure about my wiring, I tried a few other options, also with no result. Eventually (after looking around the web for suggestions) I ended up with what I later discovered is the wiring shown on the product website. D'oh. If only I had looked properly rather than rushing in blindly. Among these changes I had tried different power and ground pins, and even swapped TX and RX in case they were named from the other end's viewpoint.
Eventually I re-read the web page and realised that there is a link to a recommended driver, so I downloaded and installed that one. By this point I was not particularly surprised that I got no output, even after re-booting the PC, but it was still depressing..
When I get a chance I will try it on another computer, to see if I can make it work at all . Seems a shame to end the year on a down note, but I am still confident that the new one holds much promise!