Versions Compared

Key

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

CPU_BOOLEAN FSDev_BSP_SPI_Open (FS_QTY unit_nbr);

File

Called from

Code enabled by

fs_dev_<dev_name>_bsp.c

Device driver

N/A

...

DEF_FAIL, otherwise.

Notes/Warnings

...

  1. This function will be called every time the device is opened.

...

  1. Several aspects of SPI communication may need to be configured, including:

    ...

      • Transfer unit length

    ...

      • Shift direction

    ...

      • Clock frequency

    ...

      • Clock polarity and phase (CPOL and CPHA)

    ...

      • Slave select polarity

    ...

    1. For a SD/MMC card, the following settings should be used:

      ...

        • Transfer unit length: 8-bits

      ...

        • Shift direction: MSB first

      ...

        • Clock frequency: 400-kHz (initially)

      ...

        • Clock polarity and phase (CPOL and CPHA): CPOL = 0, CPHA = 0

      ...

        • Slave select polarity: active low.

      ...

      1. 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.