If you’ve not already read the other parts, you should : Part 1Part 2
As already mentioned we need to do something about power. There are two issues here.
Firstly it seems the BIOS power on AC loss setting isnt quite right with the board I’ve chosen. For some reason the board doesnt always power up, this may be related to the aformentioned hardware issue with the board but it’d be nice to be able to do away with this setting. So first up we have a relay across the ATX power pins. When the board powers up it checks the state of the +5 rail to the board, if its not there after a short delay the atx power input is pulsed to start the board up. We’ll also as mentioned earlier, go play with the standby LED too.
Now the second issue is the power button. Depending on what is going on it needs to do different things. For example if the board is shut down it needs to send an ATX power up and bring the board up. If the board is powered then it needs to send a command to the driver to start the hibernation process. A simple state machine should do this with a flag set to notify the keypad routines that the power button is special.
One final idea, MCE and wondows do ocasionally deadlock. So the thinking is that I may add a ‘watchdog’ The panel controller pings the driver which pings back, if more than X pings go astray in a fixed period of time we will send a hard ATX power down.
Anyway, thats where we are at the moment. The boards were ordered today from OSH Park so we should have more to play with in a couple of weeks.
So if you’ve not looked already, go look at Part 1.
At this point I’v discovered that my mainboard is screwed, it wont reboot cleanly and after a lot of playing the board is at fault. Its a brand new board so thats off to the suppliers. In the mean time more fiddling with the front panel.
An hour with a multimeter, pen and paper and I have the matrix mapped out, a bit of experimentation with LEDs and I’ve confirmed the wiring. Time to break out the breadboard.
I chose to use a fairly high end PIC, the 16F870. Totally over the top for this BUT it leaves space for other things to go in there and importantly, unlike the 14 pin PICs I can use the ICD facility and I have at least two 8 bit ports. So the matrix is wired up to port b and we statr scanning. The code is pretty simple, it scans contantly in 1ms steps and looks for changes. If there is one the port is read yeilding the first 4 bits with the row being scanned and the lower 4 with the column thats active. Its crude but I just blast these out the serial port as raw scancodes rather than formatting. This does mean that if another keypad were used its just a software tweak in the driver to make it work (I may make the key vals customisable).
Now back to that power LED. Once the driver app runs it turns on the red standby LED and then wait for Media Centre to respond. When it does it switches the LED off and turns the green one on. Thats fine and dandy BUT if the machine is hibernating, if the driver crashes or something interrupts the boot you have no indication the box is doing anything. So we want that RED power LED on at power up and not needing to rely on the board booting. On top of that I’ve found the board doesnt always auto start AND the standby/power button needs handling.
First up I’ve thrown a handful of AND gates into the serial lines, this means I can now steer where the PIC’s serial goes. This means the first thing the PIC does is connect itself to the panel and turn that damn LED on. It then wires itself back to the serial from the PC and is hapy again at the same time making sure the inboud serial is shunted back to the front panel. The PIC can listen to this stream too but at the moment I have no use for that (It may get used for a watchdog) The driver now turns on both red and green LEDs giving an orange LED as the driver waits for MCE to start.
Our Sky+ HD box had been getting more and more flakey over the last few months so we decided it was time to replace it. We dont actually have an HD subscription and we’ve been a long term customer so we phoned up and moved stuff about and managed to blag a free replacement box. So it arrives, is plugged in and ye-olde-faithful Samsung box is finally retired.
The thing then sat at the end of my desk for a week being used as a step-stool for Kevin and generally getting in the way. I opened it up out of curiosity and liberated the HD, this turned out to be royally screwed (ok I could have just changed the HD). There was an ungodly amount of dust in there and not really much else of use. So the question turned to what to do with it.
Knowing how locked down these are there was little point in trying to hack it, I’m not overly interested in breaking into it although its in theory possible to get a custom linux firmware in there (been done on older boxes) so its time to go in the in. However at this point I realised a standard micro ATX board would go in, with space to spare. It would make a nice replacement for the NEC PC that lives with our AV kit running Windows Media Centre. Three hours later its all running and does indeed fit perfectly. So some metal working and I have a Pentium G2030 in there, 64Gb SSD, 4GB of ram and a GF210 (I wanted this for HDMI out). We stream everything off a server so the small drive worked niceley. A quick visit to ebay and a 1U server PSU and PCI-E extender finished it all off.
This is a mix of pics from the first and second machine. Both are more or less the same excpet the lower scart hole has gone on the second and there is no GFX card in it. I also spent a lot more time on the rear panel as its for a friend. Mine was wiped with degreaser and sprayed with two coats of hammerite where as the second was sanded, filled, primered, sandeed… well you get the point.
Now I’m not the first to do this, you can find similar here: http://forums.bit-tech.net/showthread.php?t=220767 but its not quite ‘there’ in my eyes. The hardware and aproach is a little different, I wanted this to behave exactly as a Sky box in terms of lights, cabling etc so that I could give this box to anyone and it’ll work as if it was meant to be thi way. I do have the knowledge and ability to do the same and make new boards for the front panel but it seemed a waste. Now theres a micro on that front board and I have a logic analyser. So the box was partialy reassembled and the poking started. Hoping to find I2C or similar I was surprised to find the fron panel board speaks plain old RS232 at 19200 baud. A bit of poking, some quick software bashed up in Delphi and I have full control over the panel. Ace, and the board handles things like the sequencing of the LED ring so loads of work to make these behave now no longer needs doing. As its the Sky firmware doing it, it looks right. The buttons were sadly another story, they are a 4×4 matrix, a pain as it would be nice to use plain serial for both but hey, its still useful.
So I wrote some more code to listen to events generated by VMCController and then dispatch the apropriate serial commands. I was then the owner of a front panel that worked with MCE exactly the way the Sky one does on a real box, more or less. The power LED is an issue but that will come later.
Well I’ve been meaning to do this for ages. I have a lot of bits of random Info I keep meaning to post up and share, projects etc. Although Facebook is handy for some of it, it’s toally the wrong place. Especially when its a solution to a problem I know many have been looking for or something of interest to the world in general rather than my imediate friends. So here it is.
Expect copious amounts of garbage interspersed with ocasionally useful information. This is quite literaly destimed to become my mental dumping ground 🙂