cancel
Showing results for 
Search instead for 
Did you mean: 

stm32 EEPROM Read

MBaig.1
Associate II

Hello Every one i am using the STM32WB35CC SoC for custom BOARD, I am facing an issue that when i tries to write EEPROM I get correct response checked using Logic Analyzer but when i tried to read eeprom I GET HIGH impedance with every address. The Eeprom i am using is CAT25320 .... waiting for solution

22 REPLIES 22
TDK
Guru

Can you provide more info? What does "correct response" mean exactly?

Show the logic analyzer plot of a write attempt followed by a read attempt at the same address.

If you feel a post has answered your question, please click "Accept as Solution".
MBaig.1
Associate II

Sorry for my Silly Mistake.

Here below is the explanation of what i meant to say:

According to Datasheet of CAT25320 I first sent command to RDSR register and got 0x00

According to which BP0 and BP1 defining no protection and WEL is disabled and Device is ready

0693W00000DqRhIQAV.pngThen i sent WREN command 0x06 and again checked status register and received 0x02 which is means WEL bit is enabled

0693W00000DqReUQAV.pngAfter this i sent WRITE command following Address then Data as below Address is 4094 tested with starting addresses too byte to write is 0xAB

After sending Write command i wait for RDY bit to be 0 so i can perform read

Then i send READ command followed by Address but i get nothing then high impedance

0693W00000DqRtJQAV.pngAfter performing Read command i check for WEL to be disable correctly

According to my knowledge the responses I am getting are correct

ONadr.1
Senior III

I think, that CS must be set to high after operation and low for next operation.

ONadr.1
Senior III

Sorry, I dont notice Channel 0. Oops.

MBaig.1
Associate II

Yes it is set already .. the EEPROM is supported mode 0 and 3 at frequency up to 10MHz I am currently using 8MH, also tried frequencies Low but same results

Following are my current configuration for EEPROM spi:

 hspi1.Instance = SPI1;

 hspi1.Init.Mode = SPI_MODE_MASTER;

 hspi1.Init.Direction = SPI_DIRECTION_2LINES;

 hspi1.Init.DataSize = SPI_DATASIZE_8BIT;

 hspi1.Init.CLKPolarity = SPI_POLARITY_HIGH;

 hspi1.Init.CLKPhase = SPI_PHASE_2EDGE;

 hspi1.Init.NSS = SPI_NSS_SOFT;

 hspi1.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_16;

 hspi1.Init.FirstBit = SPI_FIRSTBIT_MSB;

 hspi1.Init.TIMode = SPI_TIMODE_DISABLE;

 hspi1.Init.CRCCalculation = SPI_CRCCALCULATION_DISABLE;

 hspi1.Init.CRCPolynomial = 7;

 hspi1.Init.CRCLength = SPI_CRC_LENGTH_DATASIZE;

 hspi1.Init.NSSPMode = SPI_NSS_PULSE_DISABLE;

 if ( HAL_SPI_Init ( &hspi1 ) != HAL_OK )

 {

  Error_Handler ( );

 }

ONadr.1
Senior III

On the last picture, write operation. There must be 32clock pulses. 8bits OP code, 16bits adress, 8bits data, but you have 40 bits (0x02, 0xFE, 0x00,0x00,0xAB)

MBaig.1
Associate II

0693W00000DqUsnQAF.pngSorry there was a mistake I forgot to put this image this one is for EEPROM Write command can you guide me what i am doing wrong

I am using eeprom first time for spi

ONadr.1
Senior III

There is only 24bits, on the picture and CS goes high in the middle of the operation.

You must set CS low, send op Code 0x02, high byte of adress 0x0F, low byte of adress 0xE0, one byte of data 0xAB and then set CS to high. After that, you should check RDSR register, busy bit. Operation is finished, when RDY bit is low. Or, you can wait some time (write time cycle is aprox. 5ms)

TDK
Guru

Your waveforms don't match those in the datasheet. CS cannot be toggled mid-transaction.

If you feel a post has answered your question, please click "Accept as Solution".