Shop OBEX P1 Docs P2 Docs Learn Events
W5200 vs microSD — Parallax Forums

W5200 vs microSD

DynamoBenDynamoBen Posts: 366
edited 2013-01-27 17:09 in Propeller 1
I'm trying to get a microSD card and a W5200 to share the same SPI buss. They are wired correctly (shared MISO, MOSI, SCLK, separate CS), independently they work fine however if I start both drivers and write to the W5200 I can no longer communicate with the SDcard. I've been stuck on this for a few days and am looking for ideas about what the conflict might be.

SD driver
W5200 driver

Comments

  • kuronekokuroneko Posts: 3,623
    edited 2013-01-26 20:30
    DynamoBen wrote: »
    I'm trying to get a microSD card and a W5200 to share the same SPI buss. They are wired correctly (shared MISO, MOSI, SCLK, separate CS), independently they work fine however if I start both drivers and write to the W5200 I can no longer communicate with the SDcard.
    The W5200 driver has MOSI driven by a counter. After writing a byte (wSPI_Data) phsb isn't cleared which means that the last bit sent remains on the bus. This may interfere with any other driver on the bus. It should be sufficient to clear phsb before returning from rSPI, wSPI and wSPI_Data.
  • DynamoBenDynamoBen Posts: 366
    edited 2013-01-27 10:35
    kuroneko wrote: »
    The W5200 driver has MOSI driven by a counter. After writing a byte (wSPI_Data) phsb isn't cleared which means that the last bit sent remains on the bus. This may interfere with any other driver on the bus. It should be sufficient to clear phsb before returning from rSPI, wSPI and wSPI_Data.

    While thinking about this yesterday I thought it might be related to counters. I've implemented your suggested change and that seems to have loosed things up, I will continue testing. Thank you!
  • DynamoBenDynamoBen Posts: 366
    edited 2013-01-27 12:14
    Follow on opinion poll: In the interests of be thorough I'm thinking about tristating CS, MISO, and SCLK like the SD card driver is doing. Worth it or wasted cycles?
  • kuronekokuroneko Posts: 3,623
    edited 2013-01-27 17:09
    The requirement is don't get in the way. Personally I'd settle for the zero-bit-option (I mean you come back anyway and use those pins). Depending on the actual code it's probably the same cost either way.
Sign In or Register to comment.