Shop OBEX P1 Docs P2 Docs Learn Events
Help with memory mode and AT45DB161D — Parallax Forums

Help with memory mode and AT45DB161D

sebastian1989sebastian1989 Posts: 14
edited 2013-03-23 11:30 in Propeller 1
Hi, I'm new in GCC and I have one question, is It possible use a AT45DB161D (spi flash memory) to run the code?, maybe in XMMC. If its possible, what should I do?.


Datasheet: http://www.ibr.cs.tu-bs.de/trac/inga/chrome/site/datasheets/Atmel_AT45DB161D.pdf


Sorry for my bad english.

Comments

  • David BetzDavid Betz Posts: 14,516
    edited 2013-03-20 07:01
    Hi, I'm new in GCC and I have one question, is It possible use a AT45DB161D (spi flash memory) to run the code?, maybe in XMMC. If its possible, what should I do?.


    Datasheet: http://www.ibr.cs.tu-bs.de/trac/inga/chrome/site/datasheets/Atmel_AT45DB161D.pdf


    Sorry for my bad english.
    It should be possible to use that chip. Tell me what pins you have it hooked up to and I'll tell you how to configure the standard SPI flash cache driver to let you run code from flash using xmmc mode.
  • sebastian1989sebastian1989 Posts: 14
    edited 2013-03-20 13:52
    I am still designing the PCB, probably I will use these pins: CS=P24 MISO=P27 MOSI=P26 SCLK=P25, if you have a recommendation please tell me. Thanks for the help.
  • David BetzDavid Betz Posts: 14,516
    edited 2013-03-20 14:52
    I am still designing the PCB, probably I will use these pins: CS=P24 MISO=P27 MOSI=P26 SCLK=P25, if you have a recommendation please tell me. Thanks for the help.
    Something like this should work:
        clkfreq: 80000000
        clkmode: XTAL1+PLL16X
        baudrate: 115200
        rxpin: 31
        txpin: 30
        cache-driver: spi_flash_cache.dat
        cache-size: 8K
        cache-param1: 0x1a1b1901 # 0xooiiccpp - oo=mosi ii=miso cc=sck pp=cs-protocol
        cache-param2: 0x18000000
    
  • sebastian1989sebastian1989 Posts: 14
    edited 2013-03-20 18:51
    Thanks, now I can load my code to a flash memory, but for some reason not run. This is my test program.
    #include <stdio.h>
    #include <propeller.h>
    int main(void)
    {   
        int mask;
        mask=1<<2;
        DIRA=mask;
        
        while(1){
            OUTA^=mask;        
            waitcnt(CNT+CLKFREQ/2);    
        }    
        return 0;
    }
    

    Build Status from SimpleIde
    Project Directory: C:/Users/seba/Documents/asd/propeller-elf-gcc.exe -o a.out -O1 -mxmmc -I . -fno-exceptions -Dprintf=__simple_printf asd.c
    propeller-elf-objdump -h a.out
    Done. Build Succeeded!
    propeller-load.exe -I C:/propgcc/propeller-load/ -b MIO -p COM4 a.out -e -rLoading the serial helper to hub memory
    9528 bytes sent
    Verifying RAM ... Loading cache driver 'spi_flash_cache.dat'
    1464 bytes sent             
    Loading program image to flash
    528 bytes remaining             528 bytes sent             
    Loading the flash loader to EEPROM via hub memory
    4628 bytes sent
    Verifying RAM ... 
    OK
    Programming EEPROM ... 
    OK
    Verifying EEPROM ... 
    OK
    

    All ok, but my code not running but If I put the memory type in COG, works perfectly.

    Any suggestions?
  • David BetzDavid Betz Posts: 14,516
    edited 2013-03-20 19:03
    Thanks, now I can load my code to a flash memory, but for some reason not run. This is my test program.
    #include <stdio.h>
    #include <propeller.h>
    int main(void)
    {   
        int mask;
        mask=1<<2;
        DIRA=mask;
        
        while(1){
            OUTA^=mask;        
            waitcnt(CNT+CLKFREQ/2);    
        }    
        return 0;
    }
    

    Build Status from SimpleIde
    Project Directory: C:/Users/seba/Documents/asd/propeller-elf-gcc.exe -o a.out -O1 -mxmmc -I . -fno-exceptions -Dprintf=__simple_printf asd.c
    propeller-elf-objdump -h a.out
    Done. Build Succeeded!
    propeller-load.exe -I C:/propgcc/propeller-load/ -b MIO -p COM4 a.out -e -rLoading the serial helper to hub memory
    9528 bytes sent
    Verifying RAM ... Loading cache driver 'spi_flash_cache.dat'
    1464 bytes sent             
    Loading program image to flash
    528 bytes remaining             528 bytes sent             
    Loading the flash loader to EEPROM via hub memory
    4628 bytes sent
    Verifying RAM ... 
    OK
    Programming EEPROM ... 
    OK
    Verifying EEPROM ... 
    OK
    

    All ok, but my code not running but If I put the memory type in COG, works perfectly.

    Any suggestions?
    I'm not sure why it wouldn't work. I guess maybe I need to read over the data sheet to make sure it's actually compatible with Winbond chips.
  • David BetzDavid Betz Posts: 14,516
    edited 2013-03-20 19:09
    David Betz wrote: »
    I'm not sure why it wouldn't work. I guess maybe I need to read over the data sheet to make sure it's actually compatible with Winbond chips.
    Darn! It looks like this chip is not compatible with either the SST or the Winbond SPI flash chips. A different driver will have to be written for it. Actually, it's only the programming code that will be different. The read code seems like it will work from the existing driver. Is there any particular reason you're using this chip?
  • sebastian1989sebastian1989 Posts: 14
    edited 2013-03-20 19:41
    The only reason is because I have ten of these chips, also, if I request new memories would have to wait a little over a month to arrive.
    What memory do you recommend?
  • David BetzDavid Betz Posts: 14,516
    edited 2013-03-21 04:41
    The only reason is because I have ten of these chips, also, if I request new memories would have to wait a little over a month to arrive.
    What memory do you recommend?
    I'm sure there is nothing wrong with your choice. I just wondered if you found some advantage to those particular chips. We have drivers for Winbond and SST flash chips but not the Atmel chips at the moment. However, it wouldn't be difficult to add support for your chip. I'll just have to find one or a board that uses one for development of the driver.
  • sebastian1989sebastian1989 Posts: 14
    edited 2013-03-21 06:24
    OK, If I can help in anyway, please let me know.
  • David BetzDavid Betz Posts: 14,516
    edited 2013-03-21 06:36
    David Betz wrote: »
    I'm sure there is nothing wrong with your choice. I just wondered if you found some advantage to those particular chips. We have drivers for Winbond and SST flash chips but not the Atmel chips at the moment. However, it wouldn't be difficult to add support for your chip. I'll just have to find one or a board that uses one for development of the driver.
    Are you comfortable with PASM? Why don't you try this yourself? After all, you have 10 chips already. :-)

    Just make a copy of spi_flash_cache.spin and modify it for the Atmel chip. I'll attach a copy of the current source to this message. Let me know if you have any questions about the code. You'll need to modify erase_4k_block_handler and write_data_handler to match the way the Atmel chip handles writing to the flash.
  • David BetzDavid Betz Posts: 14,516
    edited 2013-03-21 13:30
    I just remembered that the C3 uses an Atmel flash chip. I'll take a look later this evening to see if it is programmed the same way as the chip you're trying to use. My C3 uses the AT26DF081A chip although I can't find that on the Atmel site.
  • David BetzDavid Betz Posts: 14,516
    edited 2013-03-21 14:09
    David Betz wrote: »
    I just remembered that the C3 uses an Atmel flash chip. I'll take a look later this evening to see if it is programmed the same way as the chip you're trying to use. My C3 uses the AT26DF081A chip although I can't find that on the Atmel site.
    It looks to me as though Atmel no longer makes either the chip that is on my C3 board or the one you are trying to use. You might want to verify that if you're designing a board and will need more of these chips.
  • sebastian1989sebastian1989 Posts: 14
    edited 2013-03-23 10:53
    I'm sorry for the delay, I was very busy in the university.
    Thanks for the tip, I didn't know that Atmel no longer makes this chips.
    Can I load my code from a SD memory in FAT?
  • David BetzDavid Betz Posts: 14,516
    edited 2013-03-23 10:56
    I'm sorry for the delay, I was very busy in the university.
    Thanks for the tip, I didn't know that Atmel no longer makes this chips.
    Can I load my code from a SD memory in FAT?
    Yes, there is an SD card cache driver but the code runs very slowly from SD card since the driver is forced to use 512 byte cache lines. It normally uses 64 byte cache lines. You're better off using a SPI flash chip.
  • sebastian1989sebastian1989 Posts: 14
    edited 2013-03-23 11:29
    OK, so I back to use the AT45DB161, on digikey still have a few thousands. I have a few years using the propeller but always in spin, so I really don't know how to modify the code in "spi_flash_cache.spin"‎, is it possible use the info for the memory AT26DF081A on C3 board for my chip?
  • David BetzDavid Betz Posts: 14,516
    edited 2013-03-23 11:30
    OK, so I back to use the AT45DB161, on digikey still have a few thousands. I have a few years using the propeller but always in spin, so I really don't know how to modify the code in "spi_flash_cache.spin"‎, is it possible use the info for the memory AT26DF081A on C3 board for my chip?
    Unfortunately, I don't think so. It seems to be compatible with an SST chip that is now used on the C3 but not with that other Atmel chip. Sorry.
Sign In or Register to comment.