Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
21 years ago

Still having strange problems with SRAM and FLASH

I am still dealing with problems of unknown nature on my custom board.

Maybe somebody will have a bright idea how to move forward a little:

My custom board based on Cyclone C6 consist of internal 4k ram (int_ram), external CFI flash, external SRAM (both on the same Avalon tri-state bus).

I have prepared a small hosted C-code to run SRAM memory test and flash some LEDs to show progress and the test results... Code is tested and works ok.

When I build NIOS II to boot from an EPCS controler or an external CFI Flash but execute from int_ram everything is fine. My code works great, goes throug the SRAM memory test routine and test ends with a success. From this experiment I would find:

1. CFI flash is configured correctly because:

- I can erase it, program it and verify it with no errors

- I can store the my code and copiero code there

- I can run copier program from CFI Flash fine

- I can copy code from CFI Flash to int_ram and it works ok

2. My SRAM is configured correctly because:

- my C-code goes through all SRAM addresses and reads 32-bits patterns of aaa.../555... previously written

- my C-code goes through "walking 1s" routine for each SRAM address and it checks out ok.

but...

When I build NIOS II to boot from external CFI Flash and execute from there, my code does not work. It does not matter if I link .rodata and .rwdata partitions to go into int_ram or SRAM - it does not work.

When I build NIOS II to boot from external CFI Flash and execute from external SRAM, my code does not work.

I am confused here: CFI Flash tested ok, SRAM tested ok but when I am trying to run my code hosted in these devices everything falls apart. When am I missing here?

BTW - My code skips first 10k of 1Mb SRAM when operates from the same memory to not overwrite itself but tests whole SRAM memory when operates from int_ram. I have also tried slowing down the cpu clock to avoid SRAM timing issues. Nothing helps.

14 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    originally posted by kerri@Jul 23 2004, 01:35 PM

    yeah!

    --- Quote End ---

    Wait Kerri - I made mistake when I was re-checking Avalon document today, not setting up my design files...

    I had correctly configured this memory for dynamic alignment from the beginning.

    I have referred my mistake to the A0 question posted by Fischer and my not-too-bright response about native alignment I wrote too quickly.

    Problem still persists, unfortunatelly.

    Dividing clk by 8 eliminated timing issues in my opinion. It proves SRAM and flash work ok separately, my code works with several test with except to booting from CFI and running from SRAM, as in the table bellow:

    TEST# clk div .reset .exc .text .rodata.rwdata PASSED?

    1 8 EPCS int_ram int_ram int_ram Y

    2 8 EPCS SRAM0 SRAM0 SRAM0 Y

    3 8 CFI int_ram int_ram int_ram Y

    4 8 CFI SRAM0 SRAM0 SRAM0 N

    5 8 CFI CFI CFI Int_ram N

    As you can see, the code works when I boot from EPCS and link my program to run from SRAM, works also when I boot from CFI and link my program to run from int_ram, but IT DOES not work when I boot from flash and link to run from SRAM.

    Any idea what (beside timings) might be causing such strange behaviour?
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Let me correct the table to make it more clear:

    TEST# clkdiv .reset... .except .... .text .............rodata+.rwdata T.PASSED?

    1...........8........EPCS.. int_ram ... int_ram ........int_ram ........................Y

    2...........8........EPCS.. SRAM0 .... SRAM0.......... SRAM0 .........................Y

    3...........8........CFI..... int_ram ....int_ram ........int_ram........................ Y

    4...........8........CFI..... SRAM0..... SRAM0........... SRAM0........................ N

    5...........8........CFI..... CFI.......... CFI................ Int_ram........................ N

    Interesting is combination of tests 2 and 4 or 3 and 4.

    If# 2 AND# 3 works, why# 4 or# 5 does not work??
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    I would like to interest some new people with my problem which does not seem to have a simple solution so I will let myself to bump this thread up a little...

    If you have any suggestion what can I try, what to test or what to change - please let me know.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    When your sram test program runs in external sram and you only skip

    the first 10k to not overwrite the code,

    are you shure that you do not overwrite values on the stack, which is

    located at the end of the memory (I think so) ???

    Can you run a testprogram only blinking some led`s without writing into

    memory regions ?