OTA flash types for MySensors
-
@Gulpman @hek
Hello everybody,
I just added a pullrequest which will support SST25 Series flash for OTA Bootloader:
https://github.com/mysensors/Arduino/pull/445SST25 Series flash mentioned by Gulpman as 1st and 2nd Alternative are currently not supported, because the dont support pagewriting with opcode 0x02. Instead they support Automatic Address Increment Word writing (opcode 0xAD). I updated teh SPIFlash.cpp and .h so they will take care of that if #define MY_SPIFLASH_SST25TYPE is set somewhere.
I tested with this SPI Flash: http://www.reichelt.de/25PF020B80-4C-S/3/index.html?&ACTION=3&LA=446&ARTICLE=137365&artnr=25PF020B80-4C-S&SEARCH=25pf020b80 which is of Type SST25PF020B-80-4C-SAE (2MBit) and working now.I only hat a short look at the ISSI and Winbond flash Datasheets mentioned by Gulpman before. At first look I think they both could work with the current Mysensors / SPIFlash Version becuase they support Pagewriting with opcode 0x02 and seem to implement the other relevant opcodes. However I did not test..!
Best Regards
DirkH / D-H-R :)-edited on 2016-06-01 to take care of changed Name for define (added "MY_")
-
@tbowmo
I tested the complete chain with SST25. I.e. I prepared two sketches and uploaded them via OTA with MYSController and checked that the sketch changed via presentation Message.Dual Optiboot does not need modification because AFAIK it only reads from Flash, which works the same way for SST and other Flash Types.
-
I am new in this thread. But I think it may be worth using spi jedec flash in my latest hardware projects (insertable socket and insertable switch). So it will key to the future :)
What about atmel AT26DF series(4/8mb)? It's compartible with AT25DF series pin to pin. -
I think that DualOptiboot is writing to the external flash, after a successful upgrade of the internal flash, as it tries to delete the image stored there.
But I haven't looked that much into the design of dualoptiboot.. Just forked it, and adjusted bits here and there, to be suitable for the sensebender :) So I don't know what commands it uses to erase the data.
-
@tbowmo
I looked at the defines inside the DualOptibootloader, I truly hope that there is no "hardcoded" opcode hidden somewhere... Assuming this, dualoptiboot does not write to the SPIFlash. It does erase, however thats not writing in this scope ;)#define SPIFLASH_STATUSWRITE 0x01 // write status register #define SPIFLASH_STATUSREAD 0x05 // read status register #define SPIFLASH_WRITEENABLE 0x06 // write enable #define SPIFLASH_ARRAYREADLOWFREQ 0x03 // read array (low frequency) #define SPIFLASH_BLOCKERASE_32K 0x52 // erase one 32K block of flash memory #define SPIFLASH_BLOCKERASE_64K 0xD8 // erase one 32K block of flash memory #define SPIFLASH_JEDECID 0x9F // read JEDEC ID@Koresh please post a link to the datasheet. You can also check on your own: check if your spi-flash supports all commands listed in the SPIFlash.h defines. Of cause obvious things such as pinning and supply voltage range must also be checked.
A caveeat I fell into, was that opcode 0x02 supports byte and pageprogramming for some SPI-Flash types but not for all (e.g. SST25 does not support pageprogramming but therefore has the AAI Wordprogramming feature).
-
interesting..on my side I like the AT25DF512 for its voltage range 1.65v min and its low power mode 0.2uA in deepest mode. better for low power batt nodes I think..too bad there is not something like this in i2c format but I guess these flash types prefer faster spi transfer..
-
Yes the AT25DF512 seems to outperform other memories and is truly a good chip. However unfortunately its hard to get in Germany (and maybe other parts of the world ;) ). The common distributors here do not have it in stock...
-
Yes the AT25DF512 seems to outperform other memories and is truly a good chip. However unfortunately its hard to get in Germany (and maybe other parts of the world ;) ). The common distributors here do not have it in stock...
-
@AWI
The AT25F512 (from Atmel?) is quiet different from the Adesto AT25DF512. As far as I can see the Atmel one seems not to have a Block erase command (32k/64k), which is used in MySensor AND in Bootloader code.If I'm not wrong with that assumption (and I dont think I am), I would NOT recommend to use the Atmel AT25F512.To all: please provide links to the Datasheet if you expect help... Its tedious to search them every time. Gulpman did great preparation work in his post above.
Edit: Never mind what I said in this Post. I got confused with sectors pages and blocks :eyes: ... I'll write some more later.
-
Hi I just wonder if this Spansion, S25FL208K0RMFI040 could be used?
-
About the AT25F512N wich was proposed by @AWI: tbowmo was right, I got confused by Sector, Page and Block erase. Like tbowmo said atmel does call blocks sectors... The AT25F512 does not support Block Erase 64k, which is defined but AFAIK not used in SPIFlash.cpp BUT it is used in the Bootloader if the "Imagesize" is > 32k. But I dont know how Image size is retrieved. Also I think for an ATMega 328p the image size should never be >32k. So this Flashtype could probably work as long as the image size is below 32k. I'd expect the Bootloader to crash or fail when program size is >32k.
About the S25FL... @bjacobse proposed I see the problem that it does not support the Bock Erase 32k opcode which is used in SPIFlash.cpp and Bootloader. Both must be changed when S25FL... should be used. (I would emulate the 32k Block erase by 8 times 4k Block erase.) However remember that Dualoptiboot must also be altered which requires "non-arduino" programming and some work / knowlegde about makefiles / compiler/linker settings in IDE.
-
About the AT25F512N wich was proposed by @AWI: tbowmo was right, I got confused by Sector, Page and Block erase. Like tbowmo said atmel does call blocks sectors... The AT25F512 does not support Block Erase 64k, which is defined but AFAIK not used in SPIFlash.cpp BUT it is used in the Bootloader if the "Imagesize" is > 32k. But I dont know how Image size is retrieved. Also I think for an ATMega 328p the image size should never be >32k. So this Flashtype could probably work as long as the image size is below 32k. I'd expect the Bootloader to crash or fail when program size is >32k.
About the S25FL... @bjacobse proposed I see the problem that it does not support the Bock Erase 32k opcode which is used in SPIFlash.cpp and Bootloader. Both must be changed when S25FL... should be used. (I would emulate the 32k Block erase by 8 times 4k Block erase.) However remember that Dualoptiboot must also be altered which requires "non-arduino" programming and some work / knowlegde about makefiles / compiler/linker settings in IDE.
-
Hey, guys I am currently looking for a (cheap) solution for OTA available in germany. I wanted to use the AT25DF512C-SSHN-B but the only source I could find was aliexpress which only sells 150 pcs at a time (a little too much, although future proof for me I guess ;) ).
I did not really understand this thread so far: is there another model that works with my sensors?Or do you by chance know a place where I can get some of the AT25DF512C-SSHN-B ones here in europe? Thanks!
-
Hey, guys I am currently looking for a (cheap) solution for OTA available in germany. I wanted to use the AT25DF512C-SSHN-B but the only source I could find was aliexpress which only sells 150 pcs at a time (a little too much, although future proof for me I guess ;) ).
I did not really understand this thread so far: is there another model that works with my sensors?Or do you by chance know a place where I can get some of the AT25DF512C-SSHN-B ones here in europe? Thanks!
@LastSamurai said:
AT25DF512C
Well not in EU, but you can order from DigiKey or Mouser if everything else fails - thats where I order my parts.
EDIT: And I live in DK - maybe worth mentioning.
BR Jonas
-
@LastSamurai said:
AT25DF512C
Well not in EU, but you can order from DigiKey or Mouser if everything else fails - thats where I order my parts.
EDIT: And I live in DK - maybe worth mentioning.
BR Jonas
@LastSamurai said:
AT25DF512C-SSHN-B
Thanks, but both have shipping costs of abount 20€ (if you pay <50€ overall). Or is there a way around it?
I also found SST25VF020B‑80‑4I‑SAE and 25VF512A33-4C-SA flash modules in german stores though. Would they work too?
-
@LastSamurai said:
AT25DF512C-SSHN-B
Thanks, but both have shipping costs of abount 20€ (if you pay <50€ overall). Or is there a way around it?
I also found SST25VF020B‑80‑4I‑SAE and 25VF512A33-4C-SA flash modules in german stores though. Would they work too?
@LastSamurai Yes, thats true. My order is always above the "free shipping" limit :-)
I'll give the datasheets a look, of the devices you mentioned.BR Jonas
-
@LastSamurai The SST25VF020B... should work fine with the 2.0 developversion and #define MY_SPIFLASH_SST25TYPE set. It seems to be very close to the SST25PF020B I used. However keep an eye on the even more limited voltage range of the SST25VF Type which needs at least 2,7V which would be a problem if you want to power your circuit directly by 2xNiMH Batteries.
The SST25VF512 needs also 2,7V but additionally does not support the 64k erase command (see my comments on that issue some posts above where I wrote something about the AT25F512).