Adding Flash support for AT45DB041D

Technical questions regarding the XTC tools and programming with XMOS.
User avatar
XenoPhoenix
Member
Posts: 13
Joined: Tue Mar 29, 2011 5:13 pm

Adding Flash support for AT45DB041D

Post by XenoPhoenix »

I'm currently attempting to add support for the Atmel (Now Adesto) AT45DB041D (datasheet http://www.adestotech.com/sites/default ... oc3595.pdf) flash chip to the XMOS tools.

I currently have the the following file:

Code: Select all

100,                             /* 1.  libflash device ID */
256,                             /* 2.  Page size */
2048,                            /* 3.  Number of pages */
3,                               /* 4.  Address size */
5,                               /* 5.  Clock divider */
0x9f,                            /* 6.  RDID cmd */
0,                               /* 7.  RDID dummy bytes */
3,                               /* 8.  RDID data size in bytes */
0x1f2400,                        /* 9.  RDID manufacturer ID */
0x50,                            /* 10. SE cmd */
2048,                            /* 11. SE full sector erase */
0x00,                            /* 12. WREN cmd */
0x00,                            /* 13. WRDI cmd */
PROT_TYPE_NONE,                  /* 14. Protection type */
{{0,0},{0,0}},                   /* 15. SECS protect and unprotect cmds */
0x82,                            /* 16. PP cmd */
0x0b,                            /* 17. READ cmd */
1,                               /* 18. READ dummy bytes */
SECTOR_LAYOUT_REGULAR,           /* 19. Sector layout */
{8,{0,{0}}},                     /* 20. Sector sizes */
0xd7,                            /* 21. RDSR cmd*/
0x00,                            /* 22. WRSR cmd */
0x80,                            /* 23. WIP bit mask */
This all appears to be fine and correct when dumping a logic analyzer on the SPI pins, that is except for the WIP (Write in progress) bit mask. From looking at the datasheets of the other flash devices in SpecFlash.h the other supported flash devices appear to have inverted meaning for the WIP bit (Device ready on 1 as opposed to 0 on the other flash devices)

Is there anyway to express this in the configuration file or through some other means? It is not immediately apparent from the https://www.xmos.com/en/add-support-new ... e?secure=1 page.

Thanks in advance.


richard
Respected Member
Posts: 318
Joined: Tue Dec 15, 2009 12:46 am

Post by richard »

With the current version of libflash there is no way to invert the meaning of the WIP bit. For now I'd suggest that you use the xflash's -o option to write the binary to a file and then write a program to writes this file to the flash. You can use the source code of the flash libary as a starting point (see https://github.com/xcore/sc_flash). The code you'll need to change is inside fl_int_getBusyStatus().
User avatar
XenoPhoenix
Member
Posts: 13
Joined: Tue Mar 29, 2011 5:13 pm

Post by XenoPhoenix »

Thanks Richard,

I'd pretty much come to that conclusion after some research and talking with segher on IRC. I'll have a new board revision soon were I can use a better supported flash chip instead as I'm not particularly tied to the current one.