Shop OBEX P1 Docs P2 Docs Learn Events
Propeller to Ipod Communication - Page 2 — Parallax Forums

Propeller to Ipod Communication

2»

Comments

  • Luis_PLuis_P Posts: 246
    edited 2011-06-08 08:20
    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. :(


    Long live to the BS2!
  • JonnyMacJonnyMac Posts: 9,208
    edited 2011-06-08 16:31
    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.
  • Luis_PLuis_P Posts: 246
    edited 2011-06-08 20:51
    BS2 Listing? There's nothing else than:
    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.
  • JonnyMacJonnyMac Posts: 9,208
    edited 2011-06-08 23:25
    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).
  • Luis_PLuis_P Posts: 246
    edited 2011-06-09 12:39
    I can try that Jonny.
    Also the Bs2 code use a pace (2) which the Propeller doesn't have. That could be the problem. may be...
  • JonnyMacJonnyMac Posts: 9,208
    edited 2011-06-09 13:06
    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)
    
  • jagrifenjagrifen Posts: 36
    edited 2011-06-09 13:55
    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.
  • jagrifenjagrifen Posts: 36
    edited 2011-06-09 20:04
    I threw this code together after dinner and it worked right off the bat.
    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.
  • jagrifenjagrifen Posts: 36
    edited 2011-06-10 03:29
    JonnyMac wrote: »
    Thanks for the link.



    What I was looking for is a link to the physical connections on the connector to the iPod and, hopefully, a source of experimental connectors.

    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
  • Luis_PLuis_P Posts: 246
    edited 2011-06-10 18:14
    JAGRIFEN, Why? two codes? How come when I run Ipod.Spin I get a lot of errors? Sory I'm new on the propeller.
  • jagrifenjagrifen Posts: 36
    edited 2011-06-10 20:14
    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.
  • Luis_PLuis_P Posts: 246
    edited 2011-06-11 08:47
    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!
  • jagrifenjagrifen Posts: 36
    edited 2011-06-13 20:30
  • SSteveSSteve Posts: 808
    edited 2011-06-13 21:55
    Very cool. Except for one problem: now I have another very cool thing I don't have enough time to play with.
Sign In or Register to comment.