iPod Serial and the iPhone
Friday, 26 March 2010
I have discovered that I am unable to get Advanced Remote mode to work with the iPhone 3G or 3GS. I had been doing all my recent work on Advanced Remote mode with an iPod Photo so as not to put my iPhone through any pain. It was really hard to test before but I wrote an AdvancedRemote_ethernet example sketch (it's in the library in github) to help with that. Recently I spoke with Ben, who is doing some RFID work with a jailbroken iPhone. He could get his iPhone to receive serial commands but not transmit them, and the key for him ended up being the presence of the 500kOhm resistor on pin 21 - without it his app on the iPhone couldn't transmit to the serial port.
Because Ben had been asking me about it, I tried the Advanced Remote mode on my iPhone 3GS and then my wife's 3G. I was surprised to find that the iPhone sees the commands but it sends back a "feedback" response with error 4. The exact same code works perfectly with the old iPod Photo. At first I hoped this was because I'd removed the resistor on pin 21 - which wasn’t needed for the iPod Photo - so I put it back, but still no luck. Then I thought that perhaps the iPhone is fussier about the value of the resistor - I was using a 560kOhm and it's supposed to be 500kOhm - so I ordered some 500kOhm resistors from digikey. These arrived yesterday so I swapped the resistor, but I saw the same problem. So it looks like the resistor is needed for applications on an iPhone to be able to transmit serial data, but for the built-in iPod application there needs to be either something more than that or something instead of that.
I know the iPhone is incredibly specific about the inputs it sees before it will charge itself through the dock connector, so I'm guessing there's something like that about it wanting to see something on some other pins before it's willing to be controlled via Advanced Remote mode too. It has to be possible because my car does it with my 3GS, and it's the kind where the car has a separate display and can show track information etc, so it must be using Advanced Remote mode. I may probe the cable that comes with my car if I can find some time.
The Simple Remote mode commands do work with the iPhone though. I wrote a SimpleRemote_ethernet example sketch and was able to go through the menus, change the volume, play/pause, etc. on my 3GS. The initial remote I had in my old car with the Easy button used this approach.