Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. This function will be called every time the device is opened.
  2. Several aspects of SPI communication may need to be configured, including:
      a.
      • Transfer unit length
      b.
      • Shift direction
      c.
      • Clock frequency
      d.
      • Clock polarity and phase (CPOL and CPHA)
      e.
      • Slave select polarity
    • For a SD/MMC card, the following settings should be used:
        a.
        • Transfer unit length: 8-bits
        b.
        • Shift direction: MSB first
        c.
        • Clock frequency: 400-kHz (initially)
        d.
        • Clock polarity and phase (CPOL and CPHA): CPOL = 0, CPHA = 0
        e.
        • Slave select polarity: active low.
      • The slave select (SSEL or CS) must be configured as a GPIO output; it should not be controlled by the CPU’s SPI peripheral. The SPI port’s ChipSelEn() and ChipSelDis() functions manually enable and disable the SSEL.