This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

SPI flash MISO on GPIO 24 does not work (?)

Hi,

I have connected and SPI flash module to my pca10040 dev board. I wrote a test cycle of erase/write/verify for the entire flash and it works correctly. My initial pinout setup is:

#define FLASH_SPI_SS_PIN 3
#define FLASH_SPI_MISO_PIN 4
#define FLASH_SPI_SCK_PIN 28
#define FLASH_SPI_MOSI_PIN 29

Then I tried to move the pins to different GPIOs but the test fails at random at the first write/verify cycle (i.e. write and read data don't match). The new pins are:

#define FLASH_SPI_SS_PIN 25
#define FLASH_SPI_MISO_PIN 24
#define FLASH_SPI_SCK_PIN 23
#define FLASH_SPI_MOSI_PIN 22

What's most puzzling is that I found out that the troublesome pin is GPIO 24. Leaving it to previous 4 and moving all other pins makes the test pass. What's even more strange is than exchanging wires and pin configuration, the test also passes. So this configuration works:

#define FLASH_SPI_SS_PIN 24  // Was 25
#define FLASH_SPI_MISO_PIN 25  // Was 24
#define FLASH_SPI_SCK_PIN 23
#define FLASH_SPI_MOSI_PIN 22

I'm not sure what's going on. Notice I don't use those pins anywhere else in my code.

Any ideas?

Thanks a lot!

Parents
  • I do not see any reason why this should fail, have you tried toggling P0.24 to check that it works in the first place, and/or connect a logic analyzer to the pin to check operation?

  • Sadly I don't have a logic analyzer to use. One thing I've found is that some pins are near the antenna and it's suggested not to use them for high frequency signals. It seems that it could disrupt antenna operations, not otherwise. Also it's not clear to my why GPIO not affected by this have been used on pca10040 for buttons instead of those suggested to work al low freq.

    P0.24 seems to be working because I can read JEDEC data using it and also connecting a led behaves ok. It's not a great test, but I have not suspects on it. I have to say that my cables are about 10cm long and this may make SPI more troublesome, but with the same cables on other pins it works perfectly at 8Mhz.

  • Bragma said:
    It seems that it could disrupt antenna operations, not otherwise.

     Correct, no other impact than possible radio performance.

    Have you tried to enable high drive on the pin, in case you are on the edge of operation due to cables, capacitance and clock speed.

Reply Children
Related