This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TM4C1294NCZAD: Running code from SDRAM / Flash

Part Number: TM4C1294NCZAD
Other Parts Discussed in Thread: TMS570LC4357

Tiva-C (at least some models) have support for using external SDRAM and/or Flash. It's possible to run code from SDRAM and Flash. Fine, that much is clear. 

Now the devil is in the details, being able to run code and reasonably doing so are two different things. As far as I can tell, Tiva does not have any kind of caching going on. If instructions are fetched one-by-one from the SDRAM, it's not exactly efficient process. Is the memory controller smart enough to at least combine two word reads for a single long instruction into one transaction? If we use typical 16-bit SDRAM as an example, at 60MHz clock it'd work out like so:

Alliance AS4C4M16SA 143MHz part would work out with 60MHz clock to tRCD = 2 clk, CAS = 2clk, tRAS = 3clk, tRP=2clk

  • So if we do this in the most un-optimal way possible, it'd be tRAS + tRP 3+2 = 5 cycles for each word.. Hardly optimal at 83ns / pop. To make things even worse, you need two words so it'd be 10 clocks or 167ns for two accesses or 6MHz instruction clock! 
  • It's possible to do multiple reads at one time so grabbing two words for one instruction back to back, it'd be slightly less painful at 6 clocks or 10MHz instruction clock. .
  • Ideally the SDRAM controller "knows" about rows and doesn't deselect the device in-between accesses, you'd be looking at 3 clocks per long or 20MHz instruction clock. 

So which option are you dealing with when using SDRAM for running code?

  • Hi Olli,
    Is there any reason why you would not run code from the internal memory? There is 1MB of flash and 256k of SRAM where you can run code in single cycle. There is no cache in this device. Running code from SDRAM memory will be slow as you have already pointed out. You will also need to deal with the refreshing that will take quite some time. I may image that you use the uDMA to transfer some code from the external SDRAM to the internal SRAM and run code from the SRAM instead of running code from the SDRAM directly. Even if this is possible, in my opinion is not an optimal solution. What is your application that requires such usage with code fetching from SDRAM?
  • I'm doing a feasibility study here. Our software people do not consider 1MB for code/constant data as a vast reservoir as they should but are asking for more.. Programmers these days. I made a table of options and duly jotted down Tiva having support for external SDRAM so it'd be a viable option. However, looking closer into it now, while you could do so, it doesn't seem like you should do so. 

    The whole thing goes away if we use Sitara MPU instead which has an actual cache and a memory controller designed for using external DDR3. 

  • Hi Olli,
    Thank you for your information. The Sitara would be a better option for your application in this case. Another device that I'm familiar is the TMS570LC4357 Hercules device. This device has 4MB on chip flash and 512k SRAM with 32k of both Instruction and Data cache. This device also supports external memory interface. This device runs at 300MHz. Just another option for you to evaluate.