Last update:
I beep all my wiring and check connections I even changed the resistors on Pin 21. The Ipod doesn't respond to the command sent by the Propeller. I tested the code sending the data to the PC and I see the commands getting out from the chip. Not luck with the Ipod.
Before you go trashing the Propeller it would be nice to see your entire BS2 listing (as an attachment); there is truth in "If the BS2 can do it, the Propeller can do it -- and do it faster and likely better." Snippets of code don't always tell the whole story.
I would be inclined to add a 10K pull-up (to 3.3v) on the TX and RX pins (one on each). This will keep those lines in a know state (idle) while the Propeller is in reset. When you were using the 5v-to-3.3v buffer circuit you had this. I'm wondering if the floating input on the iPod.RX pin is causing some sort of problem (false input to iPod).
I the demo I wrote for you the ipod_str() method allows you to insert the pace. There are a lot of thing not built in to the Propeller, but anything the BASIC Stamp can do the Propeller can handle, albeit differently in many cases.
BTW... in the version of that program that's no my PC I have made an update: I'm storing the standard strings to send to the iPod Pascal style, with the first byte being the length of the string -- like this:
dat
' "strings" are stored Pascal-style with index[0] byte holding length
cfg1 byte 7, 255, 85, 3, 2, 0, 1, 250
And now the ipod_str() method is updated as follows:
pub ipod_str(pntr, pace) | count
'' Sends "count" bytes at "pntr" with "pace" milliseconds between each
count := byte[pntr++] ' get byte count
repeat while (count-- > 0)
ipod.tx(byte[pntr++])
if (pace > 0)
pause(pace)
Have you tried communicating at 19200 instead of 9600?
Also, I don't see any need for pausing between each byte sent. Be sure to send a button release command or the iPod will think the play button is still pressed.
Put both spin files in one directory and open the iPod file. Then connect power to the prop and whatever cable you use to program the chip. Hit F10 and it should compile and program the prop. There are two files because one of the files (pcFullDuplex) is from the Object Exchange. It takes care of all the hard work in getting the serial communication to function properly. The object I wrote (Ipod.spin) uses that file.
It works! but don't forget a pause and button release. Interesting, in the BS2 you don't need 29 and 30 (ipod) to GND. But in the propeller you do. Jonny take notes!!!. Thanks Mike!
Comments
I beep all my wiring and check connections I even changed the resistors on Pin 21. The Ipod doesn't respond to the command sent by the Propeller. I tested the code sending the data to the PC and I see the commands getting out from the chip. Not luck with the Ipod.
Long live to the BS2!
SEROUT 1,$4054,2,[255,85,4,2,0,0,1,249] 'only Play
That little piece of code simulate the play button thats all and work perfect. No Object or PUB nothing just that.
Also the Bs2 code use a pace (2) which the Propeller doesn't have. That could be the problem. may be...
BTW... in the version of that program that's no my PC I have made an update: I'm storing the standard strings to send to the iPod Pascal style, with the first byte being the length of the string -- like this:
And now the ipod_str() method is updated as follows:
Also, I don't see any need for pausing between each byte sent. Be sure to send a button release command or the iPod will think the play button is still pressed.
OBJ
com : "pcFullduplexSerial4FC"
CON
_clkmode = xtal1 + pll16x
_xinfreq = 5_000_000
RX = 1
TX = 0
baud = 19_200
PUB Initialize
com.Init
com.AddPort(0, RX, TX,com#PINNOTUSED,com#PINNOTUSED,com#DEFAULTTHRESHOLD,com#NOMODE,baud)
com.Start
com.tx(0,$FF)
com.tx(0,$55)
com.tx(0,$04)
com.tx(0,$02)
com.tx(0,$00)
com.tx(0,$00)
com.tx(0,$01)
com.tx(0,$F9)
com.tx(0,$FF)
com.tx(0,$55)
com.tx(0,$03)
com.tx(0,$02)
com.tx(0,$00)
com.tx(0,$00)
com.tx(0,$FB)
Feel free to clean it up/adjust as needed. I am using Pin0 as the Tx to iPod in this example.
500KOhms between pin 21 and pin30. Tie 29 to 30 and tie 30 to Prop Vss. Then you just need to connect pin 13 to your Prop Tx pin.
http://www.allpinouts.org/index.php/Apple_iPod,_iPad_and_iPhone_dock