Shop OBEX P1 Docs P2 Docs Learn Events
MX25L6406E Flash chip — Parallax Forums

MX25L6406E Flash chip

Has anyone ever used this flash chip with the propeller before? I have an ~8mb file I need to write to this chip and thought the propeller would be up for the task. I just figured there was no sense reinventing the wheel if someone had already written something to deal with this chip.

Here's a link to the datasheet.

Thanks!

Comments

  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2016-11-06 23:02
    I have interfaced to chips of this sort before although I have yet to integrate them (trivial I would think) into my FAT16 file system so that I can FTP via my WIZnet modules. But all this is written in Tachyon Forth that runs in the Tachyon O/S on the Prop.

    The problem with serial Flash are the large block sizes and that you have to deal with wear leveling and read/erase/modify in at least 4kB chunks.

    BTW, that particular chip sounds like one of the very early ones I did, there are much better chips available now.
  • Cluso99Cluso99 Posts: 18,069
    There is an I2C driver in OBEX that you can modify to write to I2C devices. I haven't looked at the data sheet, just presumed it is I2C.
    Otherwise there are SPI drivers too

  • I just need it for a one-time-use sort of thing. I obtained a Playstation 3d display and they have an issue with corrupting the data in this chip. I have a file that is an image of a good chip, I just have to get it written to this one. I was thinking of sticking it on an SD card and having the prop write it out to this chip.
  • Sounds like a very easy thing to do as you only need to program pages of the Flash from a file on SD card. Probably just by loading Tachyon with EASYFILE for the FAT32 SD part of it I could add just a few more lines of code which you could just copy and paste from the serial terminal to perform the image copy to Flash part. I should put up a binary image of Tachyon with the EASYFILE anyway to save anyone from having to load the extra modules.
  • If you wouldn't mind I would be extremely grateful. :-)
  • I have a Propeller Professional Development Board to work with, and I'm pulling the flash chip out of the tv now. From what I've read some of these displays have a habit of repeatedly corrupting the data. If that's a problem with this one I was thinking of making the propeller emulate that flash chip from the image file on the SD card, that way it'd be easy to replace it with a good copy. That's a ways off though. First things first, I just want to see if rewriting the flash chip fixes it.
  • Sounds like a very easy thing to do as you only need to program pages of the Flash from a file on SD card. Probably just by loading Tachyon with EASYFILE for the FAT32 SD part of it I could add just a few more lines of code which you could just copy and paste from the serial terminal to perform the image copy to Flash part. I should put up a binary image of Tachyon with the EASYFILE anyway to save anyone from having to load the extra modules.

    Alright I have the flash chip out, have the file I need to flash into the chip on an SD card, and I'm ready to go. I did download the Tachyon files from your Dropbox, but I don't know enough about Forth to finish it off on my own. Let me know which of these files I need to load, and what the 3 extra lines to give it over the serial console are.

    Again, thank you so much for your help with this!
  • Orladin wrote: »
    Sounds like a very easy thing to do as you only need to program pages of the Flash from a file on SD card. Probably just by loading Tachyon with EASYFILE for the FAT32 SD part of it I could add just a few more lines of code which you could just copy and paste from the serial terminal to perform the image copy to Flash part. I should put up a binary image of Tachyon with the EASYFILE anyway to save anyone from having to load the extra modules.

    Alright I have the flash chip out, have the file I need to flash into the chip on an SD card, and I'm ready to go. I did download the Tachyon files from your Dropbox, but I don't know enough about Forth to finish it off on my own. Let me know which of these files I need to load, and what the 3 extra lines to give it over the serial console are.

    Again, thank you so much for your help with this!

    I am just getting around to making a compatible binary for you to save having to load in the modules yourself so I will post the file and dropbox it as well as soon as I'm done.
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2016-11-07 03:59
    Ok, here's the binary for the Tachyon kernel + EXTEND + EASYFILE which will work directly with any 5MHz or 10MHz Prop with a minimum of 32kB EEPROM. You can specify your own SD card pins by typing in your pin configuration, perhaps checking it with "ls" to list the files, and then BACKUP to lock it into EEPROM.

    Dropbox

    For instance my test board has this pin configuration:
    P25 = CLK
    P26 = MOSI (SD DATA IN)
    P27 = MISO (SD DATA OUT)
    P24 = CS (no pullup)

    Enter in this format with an ampersand prefix with the pin numbers separated by a decimal point and don't forget that you need at least one space between Forth words, that is the number and SDPINS.
    &24.27.26.25 SDPINS
    
    Check that it works for your board with "ls" and then BACKUP.
    ls
    Mounted 7948.06B0-06F3.624B MSDOS5.0 NO NAME     FAT32   3,955MB (4,096/cluster)
    NO NAME    
    LOGON          LOGON   .TXT   HTTP404 .HTM   HOME1   .HTM   CE1372  .FTH   
    HOME3   .HTM   HOME    .HTM   W5200   .FTH   NETWORK .FTH   SDCARD  .FTH   
    MULTIFAT.FTH   ROM     .BIN   EXTEND  .FTH   POPCORN .WAV   ACCESS  .TXT   
    LOG     .TXT   LOG0003 .TXT   LOG0004 .TXT   LOG0005 .TXT   LOG0006 .TXT   
    LOG0007 .TXT   LOG0008 .TXT   TACHYON .LST   SYSLOG  .TXT     ok
    

    The binary only about 1k free which doesn't seem much but a lot gets done in that space although if you have a 64kB EEPROM or more you should run COMPACT, wait for that to finish, then BACKUP which gives you around 9k free (stacks of room for Tachyon!).
    COMPACT  erasing eeprom sectors.. compacting..-
    VER:    Propeller .:.:--TACHYON--:.:. Forth V3.0 JUNO 300160922.1245
    PCB:    UNKNOWN (0)
    FREQ:   80MHZ (PLLEN OSCEN XTAL1  PLL8X )
    NAMES:  $71B0...74DC for 812 bytes (4,294,961,363)
    CODE:   $0930...4E21 for 17,649 bytes (+5,444)
    RAM:    9,103 bytes free
    BUILD:  FIRMWARE BUILD DATE 160804:180055   BOOTS:  3   runtime 352,946
    BOOT:    ok
    

    Default Tachyon session is 115200/8N1 and I prefer minicom for Linux or TeraTerm for WIndows.
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2016-11-07 05:06
    Copy and paste this code through the terminal with "line" delay set to 20ms. Then choose your pins for the serial Flash in the same manner as the SD card, that is:
    &<cs>.<miso>.<mosi>.<clk> TO sfpins
    
    then BACKUP which will also backup the code.

    If you want to have a look inside the Flash chip you can use the DUMP command (or its variants DUMPW DUMPL DUMPA) with a preceding SF to select serial Flash memory.
    0 $100 SF DUMP
    

    To program the Flash for 1MB from a file just open the file first then program:
    FOPEN MYROM.BIN
    PROGRAM
    
    I could make that one action but I thought I'd keep it simple for the moment.

    BTW, I instruction codes for your chip were the same as the Winbond chip I work with, the only real differences are normally in sector sizes etc but we are just dealing with the whole chip here.

    Untested code- also via Dropbox for the very latest file.
    TACHYON [~
    
    FORGET FLASH.fth
    
    pub FLASH.fth			PRINT" Serial Flash driver 161107-1500 " ;
    
    --- ADAPT FOR MX25L6406
    --- W25Q80 style serial Flash ---
    {
    
    Change pins with: &xx.xx.xx.xx TO sfpins
    Init with: SFIO (although this driver will automatically decide to if it hasn't been)
    Dump first 1k of Flash: 0 $400 SF DUMP
    
    
    To open a file: FOPEN <name>
    To program Flash with open file: PROGRAM
    
    }
    &27.26.25.24	== sfpins		--- user may assign new pins to this default
    
    LONG sfboot
    pub SFIO			@SPISCK COGREG@ sfpins MASK <> IF sfpins SPIPINS THEN ;
    pub ?SFIO			sfboot @ boot @ <> IF SFIO boot @ sfboot ! THEN ;
    pub SFINS			?SFIO SPICE SFIO SPIWRB DROP ;
    pub SFWE			6 SFINS ;
    pub SFWD			4 SFINS ;
    pub SFADR ( sfaddr24 -- )	8<< SPIWR SPIWR SPIWR DROP ;
    pub SFRDBLK ( sfaddr dst cnt -- ) 3 SFINS ROT SFADR ADO 0 SPIRD I C! LOOP SPICE ;
    pub SFERSEC ( addr -- )		SFWE $20 SFINS SFADR SPICE ;
    pub SFER32K ( addr -- )		SFWE $52 SFINS SFADR SPICE ;
    pub SFER64K ( addr -- )		SFWE $D8 SFINS SFADR SPICE ;
    pub SFERCHIP			SFWE $C7 SFINS SPICE ;
    pub SFWRPAGE ( src dst -- )	SFWE $02 SFINS SFADR #256 ADO I C@ SPIWRB DROP LOOP SPICE ;
    pub SFWRBLK ( src dst cnt -- )  ROT SWAP ADO I OVER SFWRPAGE 3 ms #256 + #256 +LOOP DROP ;
    pub SFC@			3 SFINS SFADR 0 SPIRD SPICE ;
    pub SFW@			3 SFINS SFADR 0 SPIRD SPIRD SPICE ;
    pub SF@				3 SFINS SFADR 0 SPIRD SPIRD SPIRD SPIRD SPICE ;
    pub SF				' SFC@ dmm W! ' SFW@ dmm 2+ W! ' SF@ dmm 4 + W! ;
    
    
    \ pub FBACKUP			0 SFER64K 1,000 ms 0 0 $1.0000 SFWRBLK ;
    
    --- Load 1MB of serial Flash from the currently open file
    pub PROGRAM
    	FILE@
    	IF
    	  PRINT"  Programming Flash with " FILE$ PRINT$ SPACE
    	  0 ( start of Flash )
    	  FSECT@ 2048 ADO I SECTOR SDBUF OVER BLKSIZ SFWRBLK BLKSIZ + SPINNER LOOP DROP
    	  PRINT"  - Flash programmed! "
    	ELSE
    	  PRINT" No file open! "
    	THEN
    	;
    
    
    ]~ END
    
  • Ok I got it loaded into the board, I connected my SD card (its actually a Micro SD card connected using the Propeller Memory Card from Parallax). When I set the SD pins and type LS it says it mounts it but it doesn't list any files. My development board has the standard 5mhz crystal, but I did replace its 32kb eeprom with a 64kb one. Here's the output from Tachyon.

    Propeller .:.:--TACHYON--:.:. Forth V3.0 JUNO 300160922.1245

    VER: Propeller .:.:--TACHYON--:.:. Forth V3.0 JUNO 300160922.1245
    PCB: UNKNOWN (0)
    FREQ: 80MHZ (PLLEN OSCEN XTAL1 PLL16X)
    NAMES: $51EC...74DC for 8,944 bytes (+2,199)
    CODE: $0930...4E21 for 17,649 bytes (+5,444)
    RAM: 971 bytes free
    BUILD: FIRMWARE BUILD DATE 967295:967295 BOOTS: 7 runtime 110
    BOOT: EXTEND.boot
    MODULES LOADED:
    38DD: EASYFILE.fth SD card + FAT32 Virtual Memory Access File System Layer V1.2 16080711-2300
    1840: EXTEND.fth Primary extensions to TACHYON kernel - 160828-1400
    NO ROMS
    &24.27.26.25 SDPINS ok
    ls
    Mounted CDC0.0962-0000.0000 0MB (0/cluster)
    ok


    Oh, also, the MicroSD card I'm using is a 2gb RiDATA, it's one I also purchased from Parallax so I think it should work.
  • 2GB cards and FAT16 are obsolete so I don't try to support them. Higher capacity cards are dirt cheap as I pay around $5 for 8GB and these cards are SDHC rather than just SD. So pop into your local store (any office/grocery/newsagent etc) and pick up an SDHC card.
  • It sees my SD card now. I had an 8gb, but for some reason I didn't think the SDHC cards would work. I'm going to tack some wires to this EEPROM since its an SMD chip and see if I can read it.

    Is there anything I need to change to get it to flash the whole 8mb file?
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2016-11-07 07:11
    You can tack the smd chip to 0.1" matrix board if you lift the corner legs up a bit so that the center pins can be soldered directly to the pads (two on each side). Then connect the corner legs to pads using what I call spider wire, that is, just a single strand from an IDC cable wire, it's fine enough to solder directly as even bare wirewrap wire is sometimes too bulky! Then you can use a pin header to connect to the chip etc. Do you need to see a photo?

    btw, serial chips may state their memory capacity in "bits" but they are all byte memories so I just think of it as 1MB. The software is setup to do a chip erase and then program 1MB albeit blindly. When I get to test this on a similar chip I may make some changes and enhancements.
  • I added in status register checks to make sure the device was done erasing and programming blocks plus a few extras. Here's a dump of a session (using a different Flash chip).
    FOPEN WARPEACE.TXT...opened at 0003.3600   ok
    PROGRAM  Programming Flash with WARPEACE.TXT
    Man, type, size code EF 40 14
    Device Security = none
    Chip erase - up to 80 seconds -
    Programming Flash sectors
    000F.FE00  - Flash programmed!  ok
    0 $100 SF DUMPA
    0000.0000: The Project Gutenberg EBook of War and Peace, by Leo Tolstoy..Th
    0000.0040: is eBook is for the use of anyone anywhere at no cost and with a
    0000.0080: lmost.no restrictions whatsoever.  You may copy it, give it away
    0000.00C0:  or re-use it.under the terms of the Project Gutenberg License i ok
    
    The SF DUMPA is where I check the start of the Flash chips memory which seems to be programmed correctly with the text of the file.
  • Nice work Peter. I've got some flash chips I've been meeting to use in a project.
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2016-11-08 03:33
    D.P wrote: »
    Nice work Peter. I've got some flash chips I've been meeting to use in a project.

    Let me know how it goes, I have quite a few different types of chips here right up to 128Mb devices that i will try. I'm aiming to make this "just work". Some enhancements may be to automatically limit the memory range programmed to the lesser of the file or the device and also allow offsets.

    Latest session dump
    FOPEN WARPEACE.TXT...opened at 0003.3600   ok
    PROGRAM  Programming Flash with WARPEACE.TXT
    JEDEC ID: 0014.40EF
    MFG ID:   EF00.0000
    Security: none
    Chip erase (up to 80 seconds) -
    Programming Flash sectors 000F.FE00 1,048,576 bytes
    Flash programmed!  ok
    0 $100 SF DUMPA
    0000.0000: The Project Gutenberg EBook of War and Peace, by Leo Tolstoy..Th
    0000.0040: is eBook is for the use of anyone anywhere at no cost and with a
    0000.0080: lmost.no restrictions whatsoever.  You may copy it, give it away
    0000.00C0:  or re-use it.under the terms of the Project Gutenberg License i ok
    
    
  • OrladinOrladin Posts: 17
    edited 2016-11-08 05:11
    I got it connected, after figuring out I needed to pull the hold pin high I'm pretty sure I got it to write. Unfortunately after reflashing the chip and putting it back in the TV it worked less than it did before. I might have to just order a replacement chip for it. They're only like 15 bucks, I just figured if I could revive it without having to order anything that would be the way to go.

    Just looking back over the conversation from last night I noticed something. The file I was flashing to the chip was 8 megabytes (8,388,672 bytes). Did that script flash the whole file, or just 1 megabyte?

    Thank you again for all your help with this!
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2016-11-08 06:39
    The PROGRAM function is always transferring 1MB regardless of file or device size. I could put in a verify operation in there too. You might find that you can use another compatible memory device especially if the unit only ever reads the chip. If I put a verify function in there you can FOPEN the file, plug in the chip, type VERIFY and it should tell you if there are any differences.

    EDIT: added a VERIFY function which is automatically called when you PROGRAM a chip.
    FOPEN WARPEACE.TXT...opened at 0003.3600   ok
    PROGRAM  Programming Flash with WARPEACE.TXT
    JEDEC ID: 0014.40EF
    MFG ID:   EF00.0000
    Security: none 
    Chip erase (up to 80 seconds) \
    Programming Flash sectors 000F.FE00 1,048,576 bytes 
    Flash programmed! 
    Verifing Flash sectors 000F.FE00 Errors = 0 ok
    

    You may need to COMPACT EASYFILE.binary to free up some more memory before loading this extended FLASH.FTH
  • MJBMJB Posts: 1,235
    edited 2016-11-08 10:32
    Orladin wrote: »
    I got it connected, after figuring out I needed to pull the hold pin high I'm pretty sure I got it to write. Unfortunately after reflashing the chip and putting it back in the TV it worked less than it did before. I might have to just order a replacement chip for it. They're only like 15 bucks, I just figured if I could revive it without having to order anything that would be the way to go.

    Just looking back over the conversation from last night I noticed something. The file I was flashing to the chip was 8 megabytes (8,388,672 bytes). Did that script flash the whole file, or just 1 megabyte?

    Thank you again for all your help with this!

    should you get a new one maybe make a copy of the real image first

    Addit: to extend from 1 MB to 8 MB put in a ' 8 * ' see below
    --- Load 1MB of serial Flash from the currently open file
    pub PROGRAM
    	FILE@
    	IF
    	  PRINT"  Programming Flash with " FILE$ PRINT$ SPACE
    	  0 ( start of Flash )
    	  FSECT@ 2048     
              8 *       \  for 8 MB instead of 1
              ADO I SECTOR SDBUF OVER BLKSIZ SFWRBLK BLKSIZ + SPINNER LOOP DROP
    	  PRINT"  - Flash programmed! "
    	ELSE
    	  PRINT" No file open! "
    	THEN
    	;
    
    


  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2016-11-08 12:18
    How about this syntax instead, if nothing is specified it will be 1MB but you can precede it with say 8 MB PROGRAM and it will program 8 MB or you could even say 128 KB PROGRAM and it will do just that. Or 0 KB or MB to make it program whatever the file size is. Then what about the offset? How about we say $20.0000 FLASH 1 MB PROGRAM to program the 3rd megabyte of the Flash. Default is once again from 0. Since these are modifiers there is no strict syntax, we could just as easily say 128 4 * KB 1048756 2* FLASH PROGRAM to program 512KB into the 2nd megabyte of Flash.

    The Dropbox code reflects this change of course. (I just need to adjust the chip erase to sector erase)

    EDIT: latest with 4KB sector erase (minimum)
    FOPEN WARPEACE.TXT...opened at 0003.3600   ok
    64 KB $2.0000 FLASH PROGRAM
    Programming Flash with WARPEACE.TXT for 65,536 bytes
    JEDEC ID: 0014.40EF
    MFG ID:   EF00.0000
    Security: none /
    Erasing sectors /
    Programming Flash sectors 0002.FE00 65,536 bytes
    Flash programmed!
    Verifing Flash sectors 0002.FE00 Errors = 0 ok
    

Sign In or Register to comment.