SPI adl_busWrite ends up in WDT


#1

Hi all,

sorry if this question has already been answered, I couldn’t find a solution anywhere around here.

I’m trying to control a LCD display over the SPI interface of my Q2686. This is what my code looks like:

#define SPI_SPEED   1
#define SPI_CLK_MODE    ADL_BUS_SPI_CLK_MODE_3
#define SPI_CS_GPIO ADL_IO_GPIO | 31

s32 spiHandle;
void initSPI ( void )
{
    u32 length = 16;
    s32 retval;

    const   adl_busSPISettings_t spiSettings = { 
        SPI_SPEED ,
        SPI_CLK_MODE ,
        ADL_BUS_SPI_ADDR_CS_GPIO ,
        ADL_BUS_SPI_CS_POL_LOW ,
        ADL_BUS_SPI_MSB_FIRST ,
        SPI_CS_GPIO ,
        ADL_BUS_SPI_FRAME_HANDLING ,
        ADL_BUS_SPI_DATA_BIDIR ,
        ADL_BUS_SPI_MASTER_MODE,
        ADL_BUS_SPI_BUSY_UNUSED
    } ;
    
    /* Open SPI bus */
    spiHandle = adl_busSubscribe(ADL_BUS_SPI1, 2, &spiSettings) ;
    
    length = ADL_BUS_SIZE_BYTE;
    retval = adl_busIOCtl (spiHandle, ADL_BUS_CMD_SET_DATA_SIZE , (void *)&length);
    TRACE((1, "adl_busIOCtl() : %d", retval)) ;
    length = 0;
    retval = adl_busIOCtl (spiHandle, ADL_BUS_CMD_SET_ADD_SIZE , (void *)&length);
    TRACE((1, "adl_busIOCtl() : %d", retval)) ;
    length = 0;
    retval = adl_busIOCtl (spiHandle, ADL_BUS_CMD_SET_OP_SIZE , (void *)&length);     
    TRACE((1, "adl_busIOCtl() : %d", retval)) ;                      
}
s32 spi_Write(u16 DataLen, u8 *Data) 
{
    s32 returncode ;
    const   adl_busAccess_t spiWriteMode = {0, 0} ;

    TRACE((1, "spi_Write()")) ;
    TRACE((1, "spi_Write() : Data Length : %d", DataLen)) ;

    returncode = adl_busWrite(spiHandle, &spiWriteMode, (u32)DataLen, Data);
    TRACE ((1, "adl_busWrite(SPI) : %d", returncode )) ;

    return returncode ;
}

The init works fine but when doing a adl_busWrite the system is freezing up until it is killed by the WDT. Okay, seems like the busWrite is waiting for anything, but for what? I thought in SPI master mode data is just kicked out the data line nevermind whats going on on the other side.

Thanks for your answers.


#2

My fault, SPI only works in Target mode, not in RTE.


#3

Hi,
Is there a list of APIs that are not executable properly under RTE ?