Shop OBEX P1 Docs P2 Docs Learn Events
SD / SPI flash memory / EEPROM Questions about the solutions — Parallax Forums

SD / SPI flash memory / EEPROM Questions about the solutions

In the SD card I can have various programs to launch, is useful for example a workshop or in a demonstration I can change the program only pressing a button, and see in a LCD what is running or to change a mode, if I have big programs is better change the program. ok!

For example if I want to change 3 programs from the SD card, each program need have the possibility to change for other program! Other solutions?

With a ".spin" program I can launch a "C" (http://learn.parallax.com/node/370) but how can I launch from "C"?

(https://github.com/parallaxinc/PropWare/tree/develop/Examples/Spin2Cpp)
I can make a ".cpp" file from a spin!! I will test it soon! :thumb:

Other Questions:
When I use a SPI flash memory I can have programs largest than 64kb of the EEPROM? ok! just to have sure!

With the SPI flash memory I really need the EEPROM? Sorry my ignorance!

I can manage files in a SPI flash memory like in a SD card? Or SPI flash memory is only to help the EEPROM?

Thanks!

Comments

  • If you have a SPI flash chip you can have a program as large as the SPI flash capacity.

    You still need an EEPROM if you want to boot up automatically on reset. Otherwise, you have to download code over a serial connection every time you reset the Propeller.
  • ASAS Posts: 149
    Ofcourse EEPROM is to save the program to boot up automatically on reset.
    But if the program is bigger than the EEPROM? some program is in the SPI flash chip?

    The flash chip can save files? or is just to suport EEPROM?
    At this moment I don´t need but I think need in the future the SPI flash chip.
    And is interesting understand how I can manage the programs through the "memories"

    ok! I need have one, test it and make questions after :)

    Thanks!
  • ErNaErNa Posts: 1,752
    Isn't it, that the main difference is the SPI vs. I2C interface? Could it be possible to have a large I2C eeprom used to boot from the lower 32 k and run the higher memory as a disk?
  • ErNa wrote: »
    Isn't it, that the main difference is the SPI vs. I2C interface? Could it be possible to have a large I2C eeprom used to boot from the lower 32 k and run the higher memory as a disk?
    Yes, you could have a bigger EEPROM although the i2c is slower than the SPI interface as I recall. Also, there may be some tweaks needed to the EEPROM cache driver to support larger than 64K EEPROMs since I think the addressing is inconsistent between different vendors.

  • I think you life would be made much simpler if you do everything with a single program, instead of splitting it up into three different programs. Then your button-monitoring code simply stops all your cogs and launches a new main() function rather than stopping all cogs and loading a new program.
  • ASAS Posts: 149
    DavidZemon wrote: »
    I think you life would be made much simpler if you do everything with a single program, instead of splitting it up into three different programs. Then your button-monitoring code simply stops all your cogs and launches a new main() function rather than stopping all cogs and loading a new program.

    I agree with you ofcourse!
    Is more easy have everything in only 1 program, but in that case the program is larger. If the 64kb aren´t enough, ok, I can use a SPI flash memory, but when I turn off the Propeller, the SPI memory can save information like the EEPROM? where is saved the excess of the program that is not in the EEPROM?
  • AS wrote: »
    DavidZemon wrote: »
    I think you life would be made much simpler if you do everything with a single program, instead of splitting it up into three different programs. Then your button-monitoring code simply stops all your cogs and launches a new main() function rather than stopping all cogs and loading a new program.

    I agree with you ofcourse!
    Is more easy have everything in only 1 program, but in that case the program is larger. If the 64kb aren´t enough, ok, I can use a SPI flash memory, but when I turn off the Propeller, the SPI memory can save information like the EEPROM? where is saved the excess of the program that is not in the EEPROM?
    Yes, the SPI flash will remember your program ever over a power cycle. It's flash memory so it will retain its data until you reprogram it. However, the Propeller can't boot from flash. You'll need to write a second-stage loader into the EEPROM to boot up a program stored in SPI flash. That is what the -e option does when used with the SPI flash cache driver.
  • ASAS Posts: 149
    But in this case the SPI memory is only to help the EEPROM? I can´t save there any kind of a file? (only for curiosity)

    I see this great tutorial about it (http://www.instructables.com/id/How-to-Design-with-Discrete-SPI-Flash-Memory/)

    Thanks a lot!
  • AS wrote: »
    But in this case the SPI memory is only to help the EEPROM? I can´t save there any kind of a file? (only for curiosity)

    I see this great tutorial about it (http://www.instructables.com/id/How-to-Design-with-Discrete-SPI-Flash-Memory/)

    Thanks a lot!
    The SPI flash cache driver only uses space in the flash starting at address zero up to the size of the .text section of the program. You could, I guess, use the rest of the SPI flash as a filesystem. There is currently no code in the PropGCC libraries to do that though.

  • ASAS Posts: 149
    I already understand how is the better way to manage the "memories" system.

    I think is not a good idea use the same SPI flash to the program and other files! We can have memory conflicts? with my knowledge, for sure!!

    The SPI flash cache driver is dedicated to the program. 1mb is a lot! I can have everything in the same program like David Zemon said. great! I don´t think I need manage files of programs with 1mb.

    And I can have a SD or other SPI memory to save files, at this moment I don´t see a reason to prefer the SPI memory to save other files, I think the SD is good for that!

    Understand these details is important for me, know before start doing anything more complex.

    Really thanks!
  • AS wrote: »
    I already understand how is the better way to manage the "memories" system.

    I think is not a good idea use the same SPI flash to the program and other files! We can have memory conflicts? with my knowledge, for sure!!

    The SPI flash cache driver is dedicated to the program. 1mb is a lot! I can have everything in the same program like David Zemon said. great! I don´t think I need manage files of programs with 1mb.

    And I can have a SD or other SPI memory to save files, at this moment I don´t see a reason to prefer the SPI memory to save other files, I think the SD is good for that!

    Understand these details is important for me, know before start doing anything more complex.

    Really thanks!
    Yes, using an SD card for the filesystem will be better than using SPI flash. However, it should be possible to use part of a SPI flash for program code and part for a filesystem. In fact, it someone has a flash filesystem that will work on a SPI flash chip, the SD cache driver could be modified to use that filesystem instead of the SD card filesystem so that your code could be stored in a filesystem file rather than on the raw flash.

  • ASAS Posts: 149
    edited 2016-02-21 19:10
    Very interesting understand these details!

    At the moment I don´t have here any SPI flash memory to test :(

    If I have here the board C3, the SPI flash memory is connected like this (ftp://ftp.propeller-chip.com/PropC3/Designs/Schematics/prop_c3_rev_a_flash.png)

    Table 2.11 — FLASH SPI signals. (https://www.parallax.com/sites/default/files/downloads/32209-Unleashing-Propeller-C3v1.0.pdf)
    Signal Name, Propeller IO(Pin), Description | Notes
    SPI_MOSI, P9 (10), SPI master out slave in
    SPI_MISO, P10 (11), SPI master in slave out
    SPI_SCK, P11 (12), SPI clock
    SPI_SS3n, NA (internal), Selects 1MB FLASH memory

    To upload the program I need write something like:
    propeller-load -b c3.cfg elf_file.elf -e 
    

    The memory model can be <lmm> or <cmm>? only to understand!

    Where I can set the PIN´s of SPI flash memory of the board? I was looking to the file c3.cfg.
    # c3.cfg
    # IDE:SDLOAD
    # IDE:SDXMMC
        clkfreq: 80000000
        clkmode: XTAL1+PLL16X
        baudrate: 115200
        rxpin: 31
        txpin: 30
        tvpin: 12   # only used if TV_DEBUG is defined
        cache-driver: c3_cache.dat
        cache-size: 8K
        cache-param1: 0
        cache-param2: 0
        sd-driver: sd_driver.dat
        sdspi-do: 10
        sdspi-clk: 11
        sdspi-di: 9
        sdspi-clr: 25
        sdspi-inc: 8
        sdspi-addr: 5
    

    Thanks!
  • Compile your code with "-m xmmc" and load it using "-b c3" and it should work fine.
  • ASAS Posts: 149
    OK!

    I will try.

    Thanks a lot
  • David Betz wrote: »
    Compile your code with "-m xmmc" and load it using "-b c3" and it should work fine.

    this would equate to the following if you're still using PropWare
    set(BOARD c3)
    set(MODEL xmmc)
    
  • ASAS Posts: 149
    I still using PropWare for sure!
    I like the way cmake works, and I can use your code or not in the same program (this is great), and for Fuzzy this is working 100%. And I´m learning a lot with the links you sent me!

    thank you!
Sign In or Register to comment.