Skip to content

GIGA R1 - SPI - SPI_INTERFACES_COUNT is not defined #738

@KurtE

Description

@KurtE

I am debugging why the Adafruit_ILI9341 library does not work on the GIGA board when you are trying to use the
SPI pins that are on the outer pins (11-13), which are defined as SPI1.

I debugged it up to Adafruit SPITFT code in GFX, that has code like:

    if (
#if !defined(SPI_INTERFACES_COUNT)
        1
#else
#if SPI_INTERFACES_COUNT > 0
        (hwspi._spi == &SPI)
#endif
#if SPI_INTERFACES_COUNT > 1
        || (hwspi._spi == &SPI1)
#endif
#if SPI_INTERFACES_COUNT > 2
        || (hwspi._spi == &SPI2)
#endif
#if SPI_INTERFACES_COUNT > 3
        || (hwspi._spi == &SPI3)
#endif
#if SPI_INTERFACES_COUNT > 4
        || (hwspi._spi == &SPI4)
#endif
#if SPI_INTERFACES_COUNT > 5
        || (hwspi._spi == &SPI5)
#endif
#endif // end SPI_INTERFACES_COUNT
    ) {
      Serial.println("\t *** Start the SPI object ***");
      hwspi._spi->begin();
    }
  } else if (connection == TFT_SOFT_SPI) {

Since SPI_INTERFACES_COUNT defined, it will not check against SPI1.

In my local copy I have defined it which is till not properly working on the SPI1 pins. It does work when you configure
your code by defining all of the pins, which then uses software SPI. It also appears to work if I use the SPI pins on the six
pins connector.

Edit: - It is working now on SPI1. The issue with the SPI1 setup I had was expecting that the constructors for the Adafruit_ILI9341 objects were consistent in the order of pins for the two Hardware Serial constructors. The one where you do not specify which SPI port to use, the pins are in the order (cs, dc, rst) and the one where you do specify a pointer to the SPI port to use, the order is (dc, cs, rst). So once I had the parameters in the right order, it worked.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions