Trouble with SPI on the SL6087


I was wondering if anyone has had any trouble with the SPI port on the SL6087 with Firmware 7.45? It is reporting that SPI bus not supported when subscribing to the SPI bus. The trouble code is as follows:

u32 SPI_Init ( void )
      adl_busSPISettings_t spiSettings;

      spiSettings.BusySignal = ADL_BUS_SPI_BUSY_UNUSED;
      spiSettings.ChipSelect = ADL_BUS_SPI_ADDR_CS_HARD;
      spiSettings.ChipSelectPolarity = ADL_BUS_SPI_CS_POL_LOW;
      spiSettings.Clk_Mode = ADL_BUS_SPI_CLK_MODE_0;
      spiSettings.Clk_Speed = 1;
      spiSettings.DataLinesConf = ADL_BUS_SPI_DATA_UNIDIR;
      spiSettings.GpioChipSelect = ADL_IO_GPIO | 22;
      spiSettings.LoadSignal = ADL_BUS_SPI_LOAD_UNUSED;
      spiSettings.LsbFirst = ADL_BUS_SPI_MSB_FIRST;
      spiSettings.MasterMode = ADL_BUS_SPI_MASTER_MODE;

      /* Open SPI bus */
      DriverHdl = adl_busSubscribe ( ADL_BUS_ID_SPI, 1, &spiSettings );

      switch (DriverHdl)
      case ADL_RET_ERR_PARAM:                         
            DebugData(1, "ERROR: SPI bus param err" );                        
            DebugData(1, "ERROR: SPI bus already subscribed" );   
      case ADL_RET_ERR_BAD_HDL:                       
            DebugData(1, "ERROR: SPI bus bad HDL" );                    
      case ADL_RET_ERR_NOT_SUPPORTED:           
            DebugData(1, "ERROR: SPI bus not supported" );              
      case ADL_RET_ERR_SERVICE_LOCKED:          
            DebugData(1, "ERROR: SPI bus locked" );                     
            DebugData(6, "SPI bus subscribed" );
      return DriverHdl;

(DebugData is a UART debug function that I use.)

I also receive similar problems using the demo code in external_storage_spi. Am I setting the port up with the wrong settings? Is there any other port setup I have to do on the device first? I can include the rest of the code if you like, but it doesn’t do anything else.

Thank you,

Yep, the ext_storage_spi demo code works on the Q2687 and not the SL6087. I am most perplexed. :question:

It appears to be an existing problem with the SL6087 and I have heard from my supplier that SiWi has replicated the problem. Problem appears to exist for firmware 7.45 and 7.44.

Ok, someone who is also working on the project has solved the problem. Turns out that:

spiSettings.ChipSelect = ADL_BUS_SPI_ADDR_CS_HARD

which used the dedicated hardware chip select line, doesn’t work on the SL6087 (but it appears to work on the Q2687). The chip select line needs to be addressed using:

BusParam.ChipSelect = ADL_BUS_SPI_ADDR_CS_GPIO; 
BusParam.GpioChipSelect = 20;

which uses exactly the same pin as the hardware chip select line, just through GPIO. Also, setting:

SpiSettings.BusySignal = ADL_BUS_SPI_BUSY_USED;

makes the SPI port unaccessible.