0

I encountered some problems when using M93C46. I can read data in 93C46 through spi communication, but I cannot write data to 93C46. I checked the timing of my spi, but no problem was found.

Here are the sequences pictures:

enter image description here

enter image description here

Here is the code table and sequences pictures:

enter image description here

enter image description here

Barbora
  • 921
  • 1
  • 6
  • 11
  • Can you be more specific about how you are trying to write ? i.e. 1) Assert CS 2) EWEN 3) WRITE 0x20 0x00 0x00 .. 4) Assert CS – Sorenp Jun 03 '21 at 08:01
  • the ch1 is clk, the ch2 is cs, the ch3 is mosi ,the ch4 is miso. – SaltedFish Jun 03 '21 at 08:03
  • read code is 1 10 A6-A0 write code is 1 01 A6-A0 D7-D0 write enable is 1 00 11 xxxxx write disable is 1 00 00 xxxxx – SaltedFish Jun 03 '21 at 08:05
  • and there is a code table and sequences pictures in the datasheet.if you have the time. i will send the 93c46's datasheet to you.and thanks for your help – SaltedFish Jun 03 '21 at 08:07
  • I'd rather you step through your code and find the exact spot where you expect some output and then show a picture of the register view. – Sorenp Jun 03 '21 at 08:10
  • you mean the spi master chip? and i dont understand what is the exact spot.can you elaborate more? – SaltedFish Jun 03 '21 at 08:29
  • Yes, you list M93C46 which is an EEPROM from st, then you list AT93C46 which is also an EEPROM from atmel, what are you using as master? A million things could be wrong so it's super hard for me to just guess, it could be everything from crosstalk, to wrong clock settings to some clock gating that hasn't been asserted or some interrupt that isn't cleared or simply addressing the eeprom wrong, we need to see what you are doing, how you are doing it and what you expect and the actual result (the register view). – Sorenp Jun 03 '21 at 08:39
  • i use the st's m93c46,and SPC1168 chip as the spi master, i dont use the spi interrupt.and now the project is just a demo.it dont use any interupt.i think maybe the clock settings was wrong. i just want to know why i cant write data to the 93c46.now I am using an oscilloscope and logic analyzer to see if the spi timing and spi clock are correct. – SaltedFish Jun 03 '21 at 08:48

1 Answers1

0

It looks like your D signal (what would be MOSI if this were SPI) is transitioning simultaneously with the rising edge of the clock. This would be SPI mode 1.

These "microwire" parts are not SPI, they are a pain in the backside.

You have to use a different clock edge when reading and writing. Write data before the rising edge of clock, the memory samples it on the rising edge (equivalent to SPI mode 0). However, the memory only outputs data on Q (equivalent to MISO) after the rising edge of the clock, so you have to read it on the falling edge of the clock (SPI mode 1).

Tom V
  • 4,827
  • 2
  • 5
  • 22
  • yes,it is the spi mode wrong.but when i use the mode 0, i can read the chips and it's data is also right.so i thought i use the right spi mode. thanks for your help. – SaltedFish Jun 07 '21 at 02:33
  • also ,can you tell me why i use the wrong spi mode. i still can read the chip's data?i want to know the reason.the datasheet dont have this things. – SaltedFish Jun 07 '21 at 02:39
  • To be certain that it will always work, you must send commands and write data in mode 0, you must read data in mode 1. If you do everything in mode 0 or everything in mode 1 then it might work some days and not work on other days. This is because of variation in the setup and hold times. These will depend on supply voltage variation, temperature and board trace capacitance among other things. – Tom V Jun 07 '21 at 07:01