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.

Large array initialization in F28027 (Piccolo Controlstick)

Other Parts Discussed in Thread: TMS320F28027

hi,

I need to have atleast 10000 samples through ADC stored in an array at once so that I can process them later.

Is there anyway I can do that? Till now I can not declare an array of size greater than 1728 values

  • Can somebody please reply to my question? 

    If I can't define a big array in F28027, should I go for some other controlstick or controlcard..........

    Please help......

  • You are not going to be able to declare an array of 10000 elements in the TMS320F28027.  If you consult the device datasheet found on the TMS320F28027 Product Folder, you will find that it only contains 12K Bytes of RAM.  The ADC converter on the TMS320F28027 is 12-bits, therefore you would need to hold this value in a 16-bit element.  Therefore, assuming you needed no RAM for your program variables, etc (which is not realistic), you could at most have a 6K (6 * 1024) buffer.

    As I mentioned, this is not going to be possible.  You either need to select a processor with more RAM onboard or restructure your application.

  • Neha Aggarwal said:
    Till now I can not declare an array of size greater than 1728 values

    Why not?

    What haveyou tried?

    What was the result?

    What have you done to resolve any issue(s) that you found?

  • Hello Andy,

    First thing, I have defined a global array and if I declare arr[1400] it is fine but any number larger than that give an error  

    "library "libc.a" run placement fails for object ".ebss", size 0x750 (page 1). Available ranges: DRAML0 size: 0x700 unused: 0x600 max hole: 0x600 .ebss : > DRAML0, PAGE = 1"

    but then I went t RAM linker file and changed the length of DRAM in page 1. After that I could define larger array but when I compiled it and ran the code.

    There were all zeros after 1728 value. (checked it through matlab)

    I can attach my code if that can help.

    Thank you so much.. 

  • Hello Brandon,

    Thanks for your reply but I don't understand one thing. Why I need to have a 16-bit element? 12-bit ADC is enough for me. I want to take say 10000 samples from ADC in a single run so that I can process them later.

    4251.large array.txt
    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    #include "DSP28x_Project.h" // Device Headerfile and Examples Include File
    #include <stdio.h>
    // Prototype statements for functions found within this file.
    interrupt void adc_isr(void);
    void Adc_Config(void);
    // Global variables used in this example:
    Uint16 LoopCount;
    Uint16 ConversionCount;
    int Voltage2[1400];
    main()
    {
    InitSysCtrl();
    DINT;
    InitPieCtrl();
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    I have attached the file in case it can help. I want Voltage2[10000] which is right now Voltage2[1400].

    Thanks

  • Neha Aggarwal said:

    Thanks for your reply but I don't understand one thing. Why I need to have a 16-bit element? 12-bit ADC is enough for me. I want to take say 10000 samples from ADC in a single run so that I can process them later.

    In order to hold all of the bits of the 12-bit ADC values, you need to have a storage element of that size or larger.  There is no 12-bit memory on the C2000 devices.  In reality, the fundamental element size of the C2000 family is 16-bit.  This is described in the TMS320C28x Optimizing C/C++ Compiler v6.0 User's Guide in Section 6.4 in the Data Types section.

  • BrandonAzbell said:

    assuming you needed no RAM for your program variables, etc (which is not realistic), you could at most have a 6K (6 * 1024) buffer.

    According to this, I should be able to define at least an arr[2000]. But I am getting all zeros after 1728 element in the buffer. Can you tell me why? 

  • In a prior post to this thread, you mentioned modifying the linker command file to adjust the DRAML0 memory declaration to be larger.  You mentioned this allowed you to compile the code successfully, but when you ran the application you did not get expected results.

    The error message you received by the linker before modifying the linker command file is indicating that there is not enough room to place the section .ebss which is where your array is likely being assigned to.

    There are a couple of things that are dangerous with what you have done.  While one can modify the linker command file, care needs to be taken to understand the implications of doing this.  Simply modifying the size of the memory declaration, while it may make the C compiler and Linker "happy" it doesn't mean that more memory magically is added to the actual silicon.

    As I mentioned in one of my prior posts, the TMS320F28027 only has 6K of 16-bit memory (or 12K bytes).  That is it.  So, even if you modify the linker command file to "add" more RAM memory, the TMS320F28027 physical silicon is still only going to have 12K bytes.

  • Hello Brandon,

    After what we have discussed here, it will be good for me to buy Piccolo F28069 having 100K (50K of 16-bit) RAM

    Please correct me if I am wrong.

    Thank you so much for the help.

  • Neha Aggarwal said:
    I went t RAM linker file and changed the length of DRAM in page 1. After that I could define larger array but when I compiled it and ran the code.

    There were all zeros after 1728 value. (checked it through matlab)

    So you lied to the Linker about how much RAM your target has.

    The Linker has no way to tell how much RAM your target has other than what you tell it in the Linker file - so, if you tell it that there's 0x750 when, in fact, there's only 0x700 that is obviously going to cause problems!

    It's like telling a blind man to walk 300 metres along a 200-metre pier...!!

  • You are on the right path.