4
\$\begingroup\$

I have interfaced M25P16 with PIC32MX795F512L. MISO and CS is pulled up to VCC with 10k resistor. I am sending the 0x9f (MSB first) command for reading device ID and after that 20 dummy bytes are transmitted for generating clock for receiving bytes. But I'm getting unexpected noise pulses on MISO pin as shown in image below.

waveform I have selected clock mode as 1 (i.e. CPOL = 0 and CPHA = 1). I'm sampling input in middle of clock. One more thing HOLD# and W# are directly connected to VCC(3.3 V). Do I need to make changes in W# and HOLD# states?

\$\endgroup\$
18
  • 1
    \$\begingroup\$ You say you've set your clock mode to 1, but your scope traces show your data is clocked on the rising edge (so it's mode 0, CPOL & CPHA=0). Was this a typo? And what is the state of the HOLD pin? \$\endgroup\$ Jul 26, 2016 at 11:28
  • \$\begingroup\$ What do you mean by "I'm sampling input in middle of clock"? \$\endgroup\$
    – JimmyB
    Jul 26, 2016 at 11:35
  • \$\begingroup\$ @Cheibriados : Yes that was typo, sorry. But I tried with all 4 modes. Everytime negative result. \$\endgroup\$
    – Ravi C
    Jul 26, 2016 at 11:42
  • \$\begingroup\$ @JimmyB : SPI Data Input Sample phase in middle. \$\endgroup\$
    – Ravi C
    Jul 26, 2016 at 11:45
  • 2
    \$\begingroup\$ Do you have an oscilloscope to look at the signals? And how about Vcc, do you have adequate decoupling? \$\endgroup\$ Jul 27, 2016 at 12:52

2 Answers 2

2
\$\begingroup\$

I not sure if this problem was solved, I had exactly the same problem as you two days ago and nothing on the internet I found helped, it seems everyone had a unique problem expect yours...

After 2 days of debugging I found the solution, its very simple.. the chip 3.3V tolerant (power supply and input signals.. they NOT 5V tolerant!), if your input signals is NOT 3.3v i.e (Input CLOCK, CS, MOSI, MISO) the flash chip will not respond.

All I did was use a level translation using a 74HC4050, it is always a good test to make sure communication is 100% by sending a device id request to the chip, then proceeding to working with memory writes and reads.

Funny, after two days of exceeding the input signals with a 5V input the chip still works, maybe internally some sort of (undocumented) protection clamp was active.

I hope this helps.

\$\endgroup\$
1
  • \$\begingroup\$ Yeah... WE have to follow I/O voltage ratings as per standard datasheet, and I was following same. But don't know why It's not working. After modifying some part of circuit, it's working. Thanks \$\endgroup\$
    – Ravi C
    Dec 19, 2016 at 17:17
0
\$\begingroup\$

It looks like the flash memory is trying to respond to the command, but can't. I would check that there are no conflicts with the MISO pin. Make sure that some other peripheral on your microcontroller isn't using the MISO pin, that the MISO pin is not shorted to another pin, and make sure there is not a problem with any other device on the SPI bus.

\$\endgroup\$
1
  • \$\begingroup\$ I agree with you. But as per my knowledge no other device is using my SPI peripheral pins. PIC32MX795F512L have 4 SPI channels. from that I'm using SPI3 as master and SPI4 as slave. I tested by sending few bytes from master SPI to slave channel and vice versa, at that time it was transferring correctly with no error. So I think SPI peripheral is fine. am I right? \$\endgroup\$
    – Ravi C
    Jul 27, 2016 at 13:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.