2021-08-25 07:13 AM
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
2021-08-25 11:36 AM
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.
2021-08-26 03:00 AM
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
Then i sent WREN command 0x06 and again checked status register and received 0x02 which is means WEL bit is enabled
After 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
After performing Read command i check for WEL to be disable correctly
According to my knowledge the responses I am getting are correct
2021-08-26 06:23 AM
I think, that CS must be set to high after operation and low for next operation.
2021-08-26 06:27 AM
Sorry, I dont notice Channel 0. Oops.
2021-08-26 06:34 AM
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 ( );
}
2021-08-26 08:51 AM
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)
2021-08-26 08:57 AM
Sorry 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
2021-08-26 09:36 AM
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)
2021-08-26 11:17 AM
Your waveforms don't match those in the datasheet. CS cannot be toggled mid-transaction.