This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

C166; RAM slower than ROM

Hi all,

This problem has been on hold for a while but a collegue of mine is looking at it again:
Our app is running from flash but we want to run it from RAM (in case we would have performance issues). RAM has less wait states. What we see on the scope is that the code is -slower- when running from RAM.

We copy all code to RAM in the startup file and then change the ADDRSEL registers to have RAM in the bottom memory -> jump to main. It's running fine...only slower.

I'm not even sure what to ask but does anybody have a clue what could cause this? I suspect something with the PEC transfer we use to update our display...or something with DPP access.

The strange thing is that when we use -2- BUSCON registers/chipselects to access the RAM (1 for the DATA part, 1 for the CONST/CODE part) it does work faster than ROM. How is that possible?

Kind regards,
Joost Leeuwesteijn

Parents Reply Children
  • You did not specify the actual device and the type of memory that you are using.

    The device is an Infineon C167CR-L33 (33MHz). The code is stored in flash (Chip Select 0, 1MB, 1 waitstate) but copied to RAM (Chip Select 1, 4 * 512KB, 0 waitstates) in the startup file. There's a CPLD between the CS signals from the uC and the 4 RAM chips; it uses some address lines to select the correct RAM chip.

    We're using an I/O pin to measure the length of an ISR. The strange thing is that the ISR takes -longer- when running from RAM. When -2- chip selects are used for the RAM (CS1 and CS2, one for the CONST/CODE, one for DATA), the ISR does run faster (than when running from flash). We can't explain this. What is influencing this? DPP's? Instruction pipeline? PEC? The only difference is the storage chip and the (number of) chip selects...

    The previous hardware was using 20MHz, running code from external flash and data in external RAM so it also used 2 chip selects and it was running faster the 33MHz and everything in external RAM. We expected to have better performance when running everything from external RAM.

    Do you execute code from on-chip Flash for example?

    No on-chip flash is used. After the copy-step in startup.a66 everything is running using BUSCON1 which points to the external RAM. This simple improvement turned out to be quite a challenge/mind-breaker :-)

    --
    Joost Leeuwesteijn