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.

Maximum size of cache array

Hi, I am trying to write a data logging program with LM4F232.

I want to maximize the logging speed by pulling data from ADC by using uDMA Ping Pong Mode.

I have two cache array "test" and "test1"

If i set it as "test[250]" and "test1[250]", my program will run perfectly.

Once I set it to "test[300]" and "test1[300]", all the data in the cache array are wrong..

How can I overcome this problem?

Is my code have any error?

Thanks.

  • Hi,

    Local variables like test[] or test1[] are generated/placed on stack - so your problem is stack related. Either increase the stack either change the scope of these variables.One mention: shouldn't uDMATable[1024] aligned at 8 bytes address? (instead on stack).

    Petrei 

  • Hi Petrei, thanks for your reply. 

    I tried to increase the stack size in CCS:

    but when I further increase the stack size to 8192 and change test[] to test[300], my program will just hang when I start debugging...


    Sorry Petrei, I just started working with this micro-controller, I still have a lot of things do not know.. The uDMA part of code I was just copied it from the sample code..

    Thanks again!


  • Hi,

    Try to declare these variable outside the main. Look in StellarisWare/bords/ek-lm4f232/qs-logger example and udma-demo example. In udma-demo.c you will find out how to declare a table aligned to 1024 (not 8...) for use with uDMA. And the most important thing: do not rush to terminal to write code - try first to run, breakpoint and understand the examples. 

    Petrei 

  • Hi Petrei,

    I changed my code to aligned to 1024, and I declared the variable outside the main.

    My program now able to run when I set test[] to test[300]

    however, I looked at the memory browser, all the data in this array became zero..

    when I set the test[] as test[250]:

    Thanks.

  • Hi,

    Did you have some code related to size of test  which are not modified? Check also this thread - seems succeeded on similar problem (although has a small bug, easy to identify and correct).

    Petrei

  • Hi Petrei,

    Thanks for your reply, I found that thread too. I got the idea on how to use ping pong mode from there actually. 

    I read the uDMA sample code again, and I found that the caches in the sample are only size of 256.

    I tried to play around with the size, the maximum size it can go was exactly 256. Any number larger than that will result in the cache filled with all zero again.

    I am wondering is 256 the maximum I can use? Or is there anyway to make it go beyond that?

    Thanks.