w25q128 SPI memory
Posted: Sun Oct 25, 2020 8:45 pm
So not a component yet - but a request for comments..
I recently started playing with a w25q128 memory chip which packs a lot of memory 128Mbits into a 8 pin package... Data read/write is via SPI so should be quicker than i2c.
Initial experiments failed - so I thought to write my own component. Here, however, is a FC component / program hybrid.
So - the problem - the FC component doesn't check for the chip being available - so writing multiple bytes failed for some - also the user needs to track page numbers and addresses and also enable write before every write command... (So I tried WriteDataByte(0,0,123), WriteDataByte(0,1,124)... - and only the first byte was written )
Working from my i2c eeprom code - I went for a different interface - user sets a write (and/or read) address then writes (or reads) as required - the program (component) handles the page and address details.
I added a read/write block, int, long int, float and string (actually ReadString isn't here - but see below)
The test program simply writes 0..9999 as long ints (32 bit) to address 0 onwards then reads and displays to UART (Successfully!)
So - anyone thoughts on interface etc (I cheat slightly - in that I get the address of a variable using C and use this as the argument to a write / read block macro - lots of compiler warnings - and so everything is handled by one write/read macro (note I didn't actually do a Write/ReadByte - but they are on the list.)
Strings - Reading or Writing - I'm inclined to include the terminating 0 (write does here) - but what do people think (this means ReadString doesn't need to know the length of the string - but maybe needs a maximum length?) An alternative is to store a length at the start of the string (8 or 16bit,?) - which makes for quicker reads
Important - the chip is 3v so use a level shifter or 3.3v MCU. It also supports dual/quad SPI - but I don't think FC does on any platform??
Martin
I recently started playing with a w25q128 memory chip which packs a lot of memory 128Mbits into a 8 pin package... Data read/write is via SPI so should be quicker than i2c.
Initial experiments failed - so I thought to write my own component. Here, however, is a FC component / program hybrid.
So - the problem - the FC component doesn't check for the chip being available - so writing multiple bytes failed for some - also the user needs to track page numbers and addresses and also enable write before every write command... (So I tried WriteDataByte(0,0,123), WriteDataByte(0,1,124)... - and only the first byte was written )
Working from my i2c eeprom code - I went for a different interface - user sets a write (and/or read) address then writes (or reads) as required - the program (component) handles the page and address details.
I added a read/write block, int, long int, float and string (actually ReadString isn't here - but see below)
The test program simply writes 0..9999 as long ints (32 bit) to address 0 onwards then reads and displays to UART (Successfully!)
So - anyone thoughts on interface etc (I cheat slightly - in that I get the address of a variable using C and use this as the argument to a write / read block macro - lots of compiler warnings - and so everything is handled by one write/read macro (note I didn't actually do a Write/ReadByte - but they are on the list.)
Strings - Reading or Writing - I'm inclined to include the terminating 0 (write does here) - but what do people think (this means ReadString doesn't need to know the length of the string - but maybe needs a maximum length?) An alternative is to store a length at the start of the string (8 or 16bit,?) - which makes for quicker reads
Important - the chip is 3v so use a level shifter or 3.3v MCU. It also supports dual/quad SPI - but I don't think FC does on any platform??
Martin