Shop OBEX P1 Docs P2 Docs Learn Events
Help needed to free 1 pin with SD module — Parallax Forums

Help needed to free 1 pin with SD module

Alex.StanfieldAlex.Stanfield Posts: 198
edited 2012-04-14 13:33 in Propeller 1
I just ran out pins on my project where I plan to use de SD filesystem driver for logging and config values. I'm just needing 1 more pin to fit everything on board.

Has anyone shared one of the minimum 7 pins needed for the SD+RTC drivers? I was also planing to be able to query the RTC independently of the filesystem driver.

Any help is greatly appreciated

Alex

Edit: Several solutions below. Opted for changing the original design in order to use a DS1307 sharing the memory pins (28/29)

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2012-04-14 09:22
    The SD card needs 4 I/O pins. There are all sorts of RTCs available. Some of them use an SPI interface which requires a minimum of 3 I/O pins. Some of them (like the DS1307) use an I2C interface which is the same as used by the Propeller's EEPROM and can share those two I/O pins with the EEPROM.

    Kye's SD card driver already supports the DS1307 and includes an object for its use.
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2012-04-14 09:27
    There are 4 pins associated with the SD card and the RTC uses I2C which can be shared with the EEPROM's I2C. In fact I use the I2C clock and data for the SD card clock and data-in (to card) so really you only need 2 other I/O besides the EEPROM's I2C. The card detect is handled by not using a pullup on the SD chip enable signal (not necessary) but instead relying upon the card's internal pullup to detect a card as specified in the SD card standards.

    SD CARD.png
    323 x 328 - 9K
  • pedwardpedward Posts: 1,642
    edited 2012-04-14 12:45
    The RTC that the filesystem driver uses is the DS1302 IIRC. This chip *does not* play well with others when sharing pins. I found out first hand that it does not have a 40k output impedance when deselected, it actually has low enough an impedance that it holds the com line low. I haven't experimented to find out what value resistor would be appropriate to prevent it from holding the line low, but the consensus was it could be done. You need a resistor that is large enough to allow the other chips to overcome the pull-down, while still allowing the DS1302 to communicate.
  • Alex.StanfieldAlex.Stanfield Posts: 198
    edited 2012-04-14 12:48
    Mike, Peter, thanks for the insight. I forgot to mention that I wanted to use a DS1302 because of the trickle charging. But looking at the specs of the DS1307 maybe I'll switch over to it and then I'll still have 2 free pins.

    Since I'll be using a super-cap maybe doing the diode and resistor outside the IC it's a good deal in exchange of free pins.

    Thanks
    Alex
  • Duane DegnDuane Degn Posts: 10,588
    edited 2012-04-14 12:56
    Kye's has versions of his driver for several different RTC. I've used it with the DS1307 the most. As Peter said, the DS1307 can share pins with the Prop's EEPROM (I also use this method).

    I haven't tried sharing any of the SD card pins with the I2C pins though. That's an interesting idea. (I've noticed Peter has a lot of those.)
  • Alex.StanfieldAlex.Stanfield Posts: 198
    edited 2012-04-14 12:58
    pedward wrote: »
    The RTC that the filesystem driver uses is the DS1302 IIRC. This chip *does not* play well with others when sharing pins. I found out first hand that it does not have a 40k output impedance when deselected, it actually has low enough an impedance that it holds the com line low. I haven't experimented to find out what value resistor would be appropriate to prevent it from holding the line low, but the consensus was it could be done. You need a resistor that is large enough to allow the other chips to overcome the pull-down, while still allowing the DS1302 to communicate.

    Good to know that! Thanks.

    I'm decided now, going for a DS1307 (which I already have). All I need to figure out are the right values for the charging net to charge a super-cap (1F).

    This is going to be always on for several years (I hope :tongue:) while I need it to survive power failures. What would you go for, a coin cell or the super-cap?

    Alex
  • pedwardpedward Posts: 1,642
    edited 2012-04-14 13:12
    I would use a coin cell. They are cheap, have a long shelf life, and are relatively power dense in the event you decide to repurpose it in an application that isn't on 24x7. I suspect that supercaps have more significant leakage than a coin cell, meaning even though the power draw from the clock is very tiny, the internal resistance and leakage will be more significant to discharge rate.
  • codevipercodeviper Posts: 208
    edited 2012-04-14 13:33
    I use the 1307 too.
    but couldent you share the data and clock lines and use a circuit to provide a priority to the CS of the SD then you could have two pins for CS, one for SD and one pin for clock then a logic circuit for enuring the SD when selected will automatically deselect the clock. wait I got it one CS line and the CS of the clock has a not gate going to it! then anytime the SD card isn't selected the clock is selected. and change the driver for the clock to take advantage of this.
    that might work.
    up until I tried load runner for the prop i was sharing the SD and NES on the same pins. don't worry I was running the NES ports off 3.3volts.
Sign In or Register to comment.