Not Getting Device ID for W25Q32 flash memory using S32k312 SPI Ev Board.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Not Getting Device ID for W25Q32 flash memory using S32k312 SPI Ev Board.

1,005 Views
aryandis
Contributor II

Hello NXP,

 

I am trying to read Device id and for W25Q32 flash memory using S32k312 EV Board SPI in all mode Sync and Async INT ,Poll , but not getting data on SIN pin.

Do you have any W25Q32 lib support for SPI.?

 

0 Kudos
Reply
10 Replies

873 Views
aryandis
Contributor II

What would be SPI sequence for for below CASE for reading external flash?

1 - Send ID read command  to the external flash

2 - Read 3 bytes back from the external flash

0 Kudos
Reply

977 Views
Julián_AragónM
NXP TechSupport
NXP TechSupport

Hi @aryandis

We do not provide a library for the W25Q32 flash memory specifically, but you can find some examples in other websites (ex: LibDriver W25QXX).

Are you using an example for the SPI code? You can use this one, for example: Example S32K312 SPI Transmit & Receive Using Interrupt DS3.5 RTD300 - NXP Community.

Best regards,
Julián

0 Kudos
Reply

949 Views
aryandis
Contributor II

Yes i have used exampled you mentioned in thread. And to ensure Flash memory i also used Arduino board, getting data correctly in Arduino board.

Can you please attached any reference for configuring S32 IDE in Sync and Async SPI mode.?

0 Kudos
Reply

916 Views
Julián_AragónM
NXP TechSupport
NXP TechSupport

Hi @aryandis,

You can refer to S32K3 SPI examples from the RTD package. Keep in mind that the RTD package only release examples for the 344 & 358 derivatives, so you will need to port the example, or use the already existing one I've previously shared.

Lpspi_Ip_DmaRepeatedTransfer demonstrates how to configure the DMA + SPI, and uses Lpspi_Ip_AsyncTransmitand Lpspi_Ip_HalfDuplexTransfer uses both Sync and Async methods for transfer. 

Julin_AragnM_0-1749664303893.png

Also, I can see in external websites that the W25QXX memory may need some dummy cycles. Please refer to some posts like: Solved: QSPI - Read UNIQUE ID from W25Qxx NOR memory - STMicroelectronics Community.

It would also be helpful to see the data transmission through an oscilloscope or logic analyzer.

Best regards,
Julián.

0 Kudos
Reply

853 Views
aryandis
Contributor II

Here i ma trying to read JEDEC ID of external flash in half duplex mode bit always getting 0.

aryandis_0-1749459786965.png

Can you please check why , even i have checked with altered the API being called in image for TransfersSync (Tx first, Rx second).

0 Kudos
Reply

812 Views
Julián_AragónM
NXP TechSupport
NXP TechSupport

Hi @aryandis

Sorry for the late reply, and the blurry image, I've replaced it.

How are you sending the commands to the W25 memory? I think the easiest way to debug this, is to read the Arduino's output, and compare it with the S32K312's output through a logic analyzer, or oscilloscope.

I can see from the git repository I've previously shared, all of the command definition is written in the w25qxx.c file. In this case, since this is a third-party device, you will need to implement these commands through the SPI functions.

Please share your project configuration, so I can test the SPI communication. Just keep in mind that I am not able to test the memory's init and read/write commands; I will simply analyze the SPI's frame through a logic analyzer.

 

 

0 Kudos
Reply

782 Views
aryandis
Contributor II

Now i am able to read/write in SPI full duplex mode. but issue is here 

Spi_SetupEB and SyncTransmit" which i am using to write and read data.

In this function a parameter length  is assigned to both Tx/Rx buffer.

What should i do  if I am writing command 1 byte of data and expecting more than 1 byte to receive?. Basically Command Read /Write for external flash.

I am expecting like byte by byte transfer operation like below mentioned.

Ex.

W25qxx_Spi(0x4B);
for(uint8_t i=0;i<4;i++)
W25qxx_Spi(W25QXX_DUMMY_BYTE);
for(uint8_t i=0;i<8;i++)
w25qxx.UniqID[i] = W25qxx_Spi(W25QXX_DUMMY_BYTE);
If am doing this with S32k312 SPI am not getting any data over SPI.
 
But if am doing like below then am getting data.
Spi_DataBufferType W25Qxx_WriteUniqueIDCmd[13]  =  {0x4B,0x00,0x00,0x00,0x00}; 
Spi_DataBufferType W25Qxx_ReadUniqueID[13] =       {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
 
ret = Spi_SetupEB(SpiConf_SpiChannel_SpiChannel_master, W25Qxx_WriteUniqueIDCmd, W25Qxx_ReadUniqueID, 13u);
Spi_SyncTransmit(SpiConf_SpiChannel_SpiChannel_master);
0 Kudos
Reply

766 Views
Julián_AragónM
NXP TechSupport
NXP TechSupport

Hi @aryandis

You could prepare a Tx buffer with the command byte (0x4B) and dummy bytes (e.g., 4 dummy bytes), prepare the Rx buffer of the same length, and extract the received data from the Rx buffer by skipping the first few bytes.

#define TOTAL_LENGTH 13
Spi_DataBufferType txBuffer[TOTAL_LENGTH] = {0x4B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
Spi_DataBufferType rxBuffer[TOTAL_LENGTH] = {0};
 
Spi_SetupEB(SpiConf_SpiChannel_SpiChannel_master, txBuffer, rxBuffer, TOTAL_LENGTH);
Spi_SyncTransmit(SpiConf_SpiChannel_SpiChannel_master);
 

Best regards,
Julián

0 Kudos
Reply

871 Views
aryandis
Contributor II

Attached PNG is completely blur can you please attached new one.

 

Thanks

0 Kudos
Reply

938 Views
aryandis
Contributor II

For SPI mode 0 , is this config is ok?

aryandis_0-1749183896818.png

 

0 Kudos
Reply