Go Down

Topic: SPIMemory library - Formerly SPIFlash - now supports SPI FRAM as well! :) (Read 99313 times) previous topic - next topic

Marzogh

Hi Etienne, let me try to answer your questions in order:
  • I can access the built-in flash on the ESP12 module in the Huzzah without any issues.
  • Use FlashDiagnostics to test - its cleaner and runs with less of a memory footprint than TestFlash
  • The SPI frequency is not set to 104 MHz. Its set to operate unto a maximum of 104 MHz.
  • You don't need to force the SPI to SPI0 by any method outside the library. If you look at the ReadMe file that comes with the library, under the usage section, you'll see the following note about how to use a non-default SPI interface.

Quote
Every version of the library >= v3.0.0 supports the ability to use any of multiple SPI interfaces (if your micro-controller supports them). Switching to use another SPI interface is done by calling SPIFlash flash(csPin, &SPI1); (or &SPI2 and so on), instead of SPIFlash flash(csPin)[/u]

UginL7

HI! I'm using SPIMemory to work with board Heltec Wifi Kit 32(pinout https://github.com/Heltec-Aaron-Lee/WiFi_Kit_series/blob/master/PinoutDiagram/WIFI%20Kit%2032.pdf) + Winbond w25q128jvsq (installed on board), and allways, in all samples i can't see this flash

Init class:

SPIFlash flash(5);

Output:

rst:0x1 (POWERON_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:928
ho 0 tail 12 room 4
load:0x40078000,len:8516
load:0x40080400,len:5816
entry 0x4008069c
Initialising..........

SPIMemory Library version: < 2.5.0

No comms. Check wiring. Is chip supported? If unable to fix, raise an issue on Github

What i'm doing wrong?

P.S. Sorry for my english

Ksantor

Hi,
I'm trying to use SPIMemory with FM25L16-G and get get understanding how to change defines to successfully work with examples. I need a little guide through there. I'm using ATMega 2560.
Thank in advance.

huibkatja

Hi everyone,

first: thank you to everyone for all your great work, I would have given up on so many things if it wasn't for you.

I have a Sparkfun Redboard Turbo, and I can use SPIMemory up until version 3.3, with some changes in the variant.h file and the diagnostics.cpp (all thanks to replies in this thread).
For some reason, it won't work with the newest version of SPIMemory though. If I run FlashDiagnostics, it says the wiring is wrong. Am I doing something wrong?

Also, with the older library versions that I use, when I use flash.writeStr(), and the string is longer than 255 bytes, my code hangs at the write command. I use the readWriteString example.

If I then reset my board after trying to write a much longer string with flash.writeStr(), and just use flash.readStr(), it reads the whole, longer string. So the writeStr command actually does write the longer string to flash, but for some reason it hangs after or when it does it.

I hope someone can help me fix the writeStr :) so I can write my long string to flash.

Thanks!

sslupsky

Hi,

Are there any plans to add support for SPI NAND flash chips?

Steve

rtek1000

Hi,

I tried with STM32F103C8T6 SPI port 2, but it didn't work, maybe someone can compare the code with the SdFat library, because SdFat already provides for use with SPI2 port:

Code: [Select]
// Use second SPI port
SPIClass SPI_2(2);
SdFat sd2(&SPI_2);


Source: https://github.com/greiman/SdFat/blob/master/examples/STM32Test/STM32Test.ino
Please avoid private messages, your question may be someone's answer in the future!

mirpo

Hi Marzogh,
   great job indeed, Kudos!

I would like to use it with a STM32 Nucleo Board, which would support Dual SPI. Does your library support such a configuration?

Thanks
Best
Mirco

rtek1000

Hello,

This library SPIMemory can be very useful for saving RAM and Flash memory space, but if you want to use a more powerful microcontroller like STM32, and have greater compatibility with an SD card, you might want to look at this other library:

https://github.com/adafruit/Adafruit_SPIFlash


Here is an example of using a W25Q64 Flash being accessed like a USB stick:

[Blue Pill STM32F103C8T6] USB Mass Storage Flash W28Q64 (Like a SD card Reader)

https://forum.arduino.cc/index.php?topic=637442.0

"P.S. Example above uses second SPI port, but you can use another port"
Please avoid private messages, your question may be someone's answer in the future!

mirpo

Thanks a lot @rtek1000, i will look into this new possibility.

Regards

Balisto

is it possible to write files on an spi flash module with an W25Q64 ?
^^-------/\-------^^

konekochi

Hi there

i have an issue with an w25q128FWSIG (same as w25q128FV but with lower Vin)

i run the memory diags and say 0x02... found that error on Git and it says

Quote
0x02 Unknown chip - Unable to identify chip. Are you sure this chip is supported? The library will print out the information it has been able to obtain from the chip to Serial.
regards

prm_ex

#176
Nov 25, 2019, 09:38 pm Last Edit: Nov 29, 2019, 11:04 am by prm_ex Reason: adding more information and semi-solution
Hello, hello
Let me join the thread with my issue.
I use ESP12F module in Arduino IDE and try to deal with extenal (additional to module's one 4MB).
External one is W25Q128FV which is compatible with the library.
But FlashDiagnostic hangs by WTD as follows:
Code: [Select]

ets Jan  8 2013,rst cause:2, boot mode:(3,6)

load 0x4010f000, len 1384, room 16
tail 8
chksum 0x2d
csum 0x2d
v482516e3
~ld
V2
Mo
,⸮Initialising..........

SPIMemory Library version: 3.3.0

JEDEC ID: 0xEF4018
Man ID: 0xEF
Memory ID: 0x40
Capacity: 16777216
Max Pages: 65536
Unique ID: 1174704997871872, 0x65A468A3521D3100
-----------------------------------------------------------------------------------------------------------------------------
 Testing library code
-----------------------------------------------------------------------------------------------------------------------------
 Function Test result     Runtime
-----------------------------------------------------------------------------------------------------------------------------
 Power Down   PASS      0 us
 Power Up   PASS      0 us

 Erase Chip
Soft WDT reset

>>>stack>>>

ctx: cont
sp: 3ffffda0 end: 3fffffc0 offset: 01b0
3fffff50:  3ffee880 3ffee778 00000005 40203524  
3fffff60:  3ffee778 00000001 3ffee778 40203628  
3fffff70:  3ffee778 00000001 3ffee778 402032ff  
3fffff80:  3ffee778 00000000 3ffee778 40201e95  
3fffff90:  3ffee778 00000000 3ffee8a0 40201fa8  
3fffffa0:  3fffdad0 00000000 3ffee8cc 4020514c  
3fffffb0:  feefeffe feefeffe 3ffe84d4 40100c39  
<<<stack<<<


Do You, kind people, have any directions to go with it?


edit 2019-11-29
Playing with the library and exaple TestFlash, I've found how to workarround to fully erase the flash.
Instead of flash.eraseChip() (in my case w25Q128FV) I used:

Code: [Select]

for (uint16_t i=1; i<257; i++){
     
      addr = (i*65536 - 10);
      flash.eraseBlock64K(addr);
      Serial.println("Block " + String(i) + " with address " + String(addr) + " erased");
     
      }


But after a few blocks erased soft WDT reset ocurred again.
So I added yield():

Code: [Select]

for (uint16_t i=1; i<257; i++){
     
      addr = (i*65536 - 10);
      flash.eraseBlock64K(addr);
      Serial.println("Block " + String(i) + " with address " + String(addr) + " erased");
      yield();
      }


Now the flash is fully erased without reset, however it takes 47 seconds.
Don't know how much time flash.eraseChip()  would take but in my case no problem.

ikrajinovic

Hi,

I try library with DUE using SST26 and everything works well.  Now I'm trying work with MEGA using TXB0108 level shifter and I'm stuck. After couple of hours I figured it out that on low side 3v3 I have 1,5volt when I pass 0 and 3v3 when I pass logical 1(5v from mega)

Does anyone have any idea what to do to get it working on 5v Arduino?

BR,
Ivo

poppy381

Hello i'd like to use a Winbond w25q128 with an Arduino Mega2560


When I try the FlashDiagnostics.ino the test is bad.


Do you have any idea or I have miss something ?

My wiring :
50 MISO <- Shift Leveler <-  +5V   <- W25Q128 pin 2 DO
51 MOSI -> Shift Leveler -> +3.3V -> W25Q128 pin 5 DI
52 SCK   -> Shift Leveler -> +3.3V -> W25Q128 pin 6 CLK
53 SS     -> Shift Leveler -> +3.3V -> W25Q128 pin 1 /CS

VCC(8), Reset(7) and /WP(3) at +3.3V
Gnd(4) at GND.
100nF decoupling capacitor on VCC.


The Shift Leveler is this https://www.hobbytronics.co.uk/image/cache/data/sparkfun/logic_level_converter-500x500.jpg


Code: [Select]
Initialising..........

SPIMemory Library version: < 2.5.0

JEDEC ID: 0xF70000
Man ID: 0xF7
Memory ID: 0x0
Capacity: 0
Max Pages: 0
Unique ID: 3131958888497152, 0xE0C0001000000
-----------------------------------------------------------------------------------------------------------------------------
Testing library code
-----------------------------------------------------------------------------------------------------------------------------
Function Test result      Runtime
-----------------------------------------------------------------------------------------------------------------------------
Power Down    PASS       0 us
Power Up    FAIL

Erase Chip    FAIL
Erase 72KB    FAIL
Erase 64KB    FAIL
Erase 32KB    FAIL
Erase 4KB    FAIL
-----------------------------------------------------------------------------------------------------------------------------
Data type I/O Result       Write time       Read time
-----------------------------------------------------------------------------------------------------------------------------
Byte    FAIL       0 us
Char    FAIL       0 us
Word    FAIL       0 us
Short    FAIL       0 us
ULong    FAIL       0 us
Long    FAIL       0 us
Float    FAIL       0 us
Struct    FAIL       0 us
Byte Array    FAIL 0,    FAIL 1,    FAIL 2,    FAIL 3,    FAIL 4,    FAIL 5,    FAIL 6,    FAIL 7,    FAIL 8,    FAIL 9,    FAIL 10,    FAIL 11,    FAIL 12,    FAIL 13,    FAIL 14,    FAIL 15,    FAIL 16,    FAIL 17,    FAIL 18,    FAIL 19,    FAIL 20,    FAIL 21,    FAIL 22,    FAIL 23,    FAIL 24,    FAIL 25,    FAIL 26,    FAIL 27,    FAIL 28,    FAIL 29,    FAIL 30,    FAIL 31,    FAIL 32,    FAIL 33,    FAIL 34,    FAIL 35,    FAIL 36,    FAIL 37,    FAIL 38,    FAIL 39,    FAIL 40,    FAIL 41,    FAIL 42,    FAIL 43,    FAIL 44,    FAIL 45,    FAIL 46,    FAIL 47,    FAIL 48,    FAIL 49,    FAIL 50,    FAIL 51,    FAIL 52,    FAIL 53,    FAIL 54,    FAIL 55,    FAIL 56,    FAIL 57,    FAIL 58,    FAIL 59,    FAIL 60,    FAIL 61,    FAIL 62,    FAIL 63,    FAIL 64,    FAIL 65,    FAIL 66,    FAIL 67,    FAIL 68,    FAIL 69,    FAIL 70,    FAIL 71,    FAIL 72,    FAIL 73,    FAIL 74,    FAIL 75,    FAIL 76,    FAIL 77,    FAIL 78,    FAIL 79,    FAIL 80,    FAIL 81,    FAIL 82,    FAIL 83,    FAIL 84,    FAIL 85,    FAIL 86,    FAIL 87,    FAIL 88,    FAIL 89,    FAIL 90,    FAIL 91,    FAIL 92,    FAIL 93,    FAIL 94,    FAIL 95,    FAIL 96,    FAIL 97,    FAIL 98,    FAIL 99,    FAIL 100,    FAIL 101,    FAIL 102,    FAIL 103,    FAIL 104,    FAIL 105,    FAIL 106,    FAIL 107,    FAIL 108,    FAIL 109,    FAIL 110,    FAIL 111,    FAIL 112,    FAIL 113,    FAIL 114,    FAIL 115,    FAIL 116,    FAIL 117,    FAIL 118,    FAIL 119,    FAIL 120,    FAIL 121,    FAIL 122,    FAIL 123,    FAIL 124,    FAIL 125,    FAIL 126,    FAIL 127,    FAIL 128,    FAIL 129,    FAIL 130,    FAIL 131,    FAIL 132,    FAIL 133,    FAIL 134,    FAIL 135,    FAIL 136,    FAIL 137,    FAIL 138,    FAIL 139,    FAIL 140,    FAIL 141,    FAIL 142,    FAIL 143,    FAIL 144,    FAIL 145,    FAIL 146,    FAIL 147,    FAIL 148,    FAIL 149,    FAIL 150,    FAIL 151,    FAIL 152,    FAIL 153,    FAIL 154,    FAIL 155,    FAIL 156,    FAIL 157,    FAIL 158,    FAIL 159,    FAIL 160,    FAIL 161,    FAIL 162,    FAIL 163,    FAIL 164,    FAIL 165,    FAIL 166,    FAIL 167,    FAIL 168,    FAIL 169,    FAIL 170,    FAIL 171,    FAIL 172,    FAIL 173,    FAIL 174,    FAIL 175,    FAIL 176,    FAIL 177,    FAIL 178,    FAIL 179,    FAIL 180,    FAIL 181,    FAIL 182,    FAIL 183,    FAIL 184,    FAIL 185,    FAIL 186,    FAIL 187,    FAIL 188,    FAIL 189,    FAIL 190,    FAIL 191,    FAIL 192,    FAIL 193,    FAIL 194,    FAIL 195,    FAIL 196,    FAIL 197,    FAIL 198,    FAIL 199,    FAIL 200,    FAIL 201,    FAIL 202,    FAIL 203,    FAIL 204,    FAIL 205,    FAIL 206,    FAIL 207,    FAIL 208,    FAIL 209,    FAIL 210,    FAIL 211,    FAIL 212,    FAIL 213,    FAIL 214,    FAIL 215,    FAIL 216,    FAIL 217,    FAIL 218,    FAIL 219,    FAIL 220,    FAIL 221,    FAIL 222,    FAIL 223,    FAIL 224,    FAIL 225,    FAIL 226,    FAIL 227,    FAIL 228,    FAIL 229,    FAIL 230,    FAIL 231,    FAIL 232,    FAIL 233,    FAIL 234,    FAIL 235,    FAIL 236,    FAIL 237,    FAIL 238,    FAIL 239,    FAIL 240,    FAIL 241,    FAIL 242,    FAIL 243,    FAIL 244,    FAIL 245,    FAIL 246,    FAIL 247,    FAIL 248,    FAIL 249,    FAIL 250,    FAIL 251,    FAIL 252,    FAIL 253,    FAIL 254,    FAIL 255,    PASS       0 us
String    FAIL       0 us
-----------------------------------------------------------------------------------------------------------------------------
To see function runtimes ncomment RUNDIAGNOSTIC in SPIMemory.h.

poppy381

Hello.

I found the problem :

The W25q DO output -> Shift Leveler from 3.3V to +5V -> to MISO

I've putted directly the W25q DO output to Arduino MISO without shift leveler and the test passed was OK :).

Well I have to investigate to find why the shift leveler didn't work.

maybe It could help someone :).

Go Up