AnsweredAssumed Answered

SPIMaster_Ldd    Slave select  Issue

Question asked by kiger Zhang on Aug 2, 2018
Latest reply on Aug 9, 2018 by kiger Zhang

In a project based on KEAZ128 , the PE  component  "SPIMaster_Ldd"  was used . 

The  slave select signals were configured as GPIO . But the CS output is wrong  as shown in the following picture:

 

SPI CLOCK=500KHz

spi0 out put signals

 

The IDE: 

- CodeWarrior for MCU
Version: 10.7
Build Id:160721

 

 

 The spi write code :

 

#define SPI0_SLAVE_CS_CTRL (UI_PTE->PDOR)

#define SPI0_SLAVE_CS_ALL 0x00000038
#define SPI0_SLAVE_CS_MASK 0x00000008

 

void spi0_write(uint8_t spi_slave_id,uint8_t data)
{
    SPI0_SLAVE_CS_CTRL |= SPI0_SLAVE_CS_ALL; // all cs bit set to 1

    SPI0_SLAVE_CS_CTRL &= ~(SPI0_SLAVE_CS_MASK << spi_slave_id); //active the slave

    (void)SM1_SendBlock(SM1_DeviceData, &data, sizeof(data));
    while(! SM1_GetBlockSentStatus(SM1_DeviceData)){}

 

    SPI0_SLAVE_CS_CTRL |= SPI0_SLAVE_CS_ALL; // all cs bit set to 1
}

 

 

Why the CS single   goes HIGH before the clock?

 

 

 

**************************************************************************************************************

I tried different setting:

 

SPI CLOCK=250KHz

 

 

 

 

SPI CLOCK=1MHz

 

 

 

SO,  the function "SM1_GetBlockSentStatus"  DO NOT work!    A bug? 

 

Need dig into the SPIMaster_Ldd code to check how the function to work. 

Outcomes