SPI on OpenAT v6.11

Hi all,

I am trying to work with SPI on OpenAT v6.11 for the Quick Q2686 module and, although the sample code compiles OK, when I’m uploading and running it on the module, I get an error message ADL_RET_ERR_NOT_SUPPORTED when I’m trying to subscribe to the SPI service:

adl_busSPISettings_t SPIConfig =
{
    5,                          // Clk_Speed    (2 MHz)
	ADL_BUS_SPI_CLK_MODE_0, // Mode 0: rest state 0, data valid on rising edge
	ADL_BUS_SPI_ADDR_CS_HARD, // Use dedicated pin to handle the Chip Select signal
	ADL_BUS_SPI_CS_POL_LOW, // Chip Select active in low state
	ADL_BUS_SPI_MSB_FIRST, // Data are sent MSB first
	0, // No GPIO used to handle the Chip Select signal
	ADL_BUS_SPI_FRAME_HANDLING, // LOAD signal not used
	ADL_BUS_SPI_DATA_BIDIR, // 2 Wires configuration
	ADL_BUS_SPI_MASTER_MODE, // Master mode
	ADL_BUS_SPI_BUSY_UNUSED // BUSY signal not used
};
// BUS Handles
s32 SPIHandle;
s32 Result;
s32 SPIerror;

void InitSPI(void)
{
	// Subscribe to the SPI1 BUS
	Result = adl_busSubscribe ( ADL_BUS_ID_SPI, 1, &SPIConfig );
	if (Result >= 0) {
                SPIerror = OK;
		SPIHandle = Result; // Success
	}
	else {
               SPIerror = Result;
	}
}

Any help will be highly appreciated.

P.S. In the Q2686_PTS_revision7.pdf document on page 20 is stated that the OS 6.60 does not drive the serial interface. Instead, the version 4 does. If that’s the case, does anyone know how could I download the latest OpenAT V4?

To download V4 go under Archive in the download page.

Also looking at your code I am not sure you can use the CS_HARD along with the FRAME. If I recall it correctly the manual state they are not compatible, but I maybe wrong. Read the manual, it should tell you.

Briga

Anybody know if the SPI on the Q2687 can be configured as a slave device, instead of master?