AnsweredAssumed Answered

SPIMaster_LDD not working correctly

Question asked by Yadhukrishnan V M on Dec 27, 2016
Latest reply on Jan 8, 2017 by Kerry Zhou

Hi,

   I am doing SPI operations on SST25VF020 spi flash memmory in KL25Z128 custom board. The below is my code

 

 

#define BLOCK_SIZE 1

 

int main(void)

 

{

uint8_t OutData[BLOCK_SIZE ] = {0x05}; 

uint8_t InpData[BLOCK_SIZE];
LDD_TDeviceData *spi_ptr;
LDD_TUserData *fp;
LDD_TError Error;

PE_low_level_init();

 

HOLD_SetVal();

WP_SetVal();
spi_ptr=SM1_Init(NULL);
while(1)
{
CS_ClrVal();
Error = SM1_ReceiveBlock(spi_ptr, InpData, BLOCK_SIZE);
Error = SM1_SendBlock(spi_ptr, OutData, BLOCK_SIZE );

 

while (!SM1_GetBlockReceivedStatus(spi_ptr))

{
SM1_Main(spi_ptr);
}

CS_SetVal();
}


#ifdef PEX_RTOS_START
PEX_RTOS_START(); /* Startup of the selected RTOS. Macro is defined by the RTOS component. */
#endif

 

for(;;){}
}

 

The above code is for just reading the status register of spi memory. I got the correct output. But when I tried to read the manufacure ID of the spi flash. I didn't get the output. For reading the manufature ID we have to send "0x90" instruction and "0x000000" memory address. Please anybody tell me how to send multiple bits using the "SendBlock" instruction.

Outcomes