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.
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.
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.
#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(); IER = 0x0000; IFR = 0x0000; InitPieVectTable(); EALLOW; // This is needed to write to EALLOW protected register PieVectTable.ADCINT1 = &adc_isr; EDIS; // This is needed to disable write to EALLOW protected registers InitAdc(); // For this example, init the ADC // Enable ADCINT1 in PIE PieCtrlRegs.PIEIER1.bit.INTx1 = 1; // Enable INT 1.1 in the PIE IER |= M_INT1; // Enable CPU Interrupt 1 EINT; // Enable Global interrupt INTM ERTM; // Enable Global realtime interrupt DBGM LoopCount = 0; ConversionCount = 0; // Configure ADC EALLOW; AdcRegs.ADCCTL1.bit.INTPULSEPOS = 1; //ADCINT1 trips after AdcResults latch AdcRegs.INTSEL1N2.bit.INT1E = 1; //Enabled ADCINT1 AdcRegs.INTSEL1N2.bit.INT1CONT = 1; //Disable ADCINT1 Continuous mode AdcRegs.INTSEL1N2.bit.INT1SEL = 2; //setup EOC2 to trigger ADCINT1 to fire AdcRegs.ADCSOC2CTL.bit.CHSEL = 4; //set SOC2 channel select to ADCINA2 AdcRegs.ADCSOC2CTL.bit.TRIGSEL = 5; //set SOC2 start trigger on EPWM1A, due to round-robin SOC0 converts first then SOC1, then SOC2 AdcRegs.ADCSOC2CTL.bit.ACQPS = 6; //set SOC2 S/H Window to 7 ADC Clock Cycles, (6 ACQPS plus 1) AdcRegs.ADCINTSOCSEL1.bit.SOC2 = 0; // No ADCINT triggers SOC2. TRIGSEL field determines trigger. AdcRegs.ADCCTL1.bit.ADCENABLE = 1; // Enable the ADC EDIS; // Assumes ePWM1 clock is already enabled in InitSysCtrl(); EPwm2Regs.TBCTL.bit.CTRMODE = 0x3; // Disable the timer EPwm2Regs.TBCTL.all = 0xC033; // Configure timer control register EPwm2Regs.TBCTR = 0x0000; // Clear timer counter EPwm1Regs.ETSEL.bit.SOCAEN = 1; // Enable SOC on A group EPwm1Regs.ETSEL.bit.SOCASEL = 2; // Select SOC from from CPMA on upcount EPwm1Regs.ETPS.bit.SOCAPRD = 1; // Generate pulse on 1st event EPwm1Regs.TBPRD = 600; // Set period for ePWM1 EPwm1Regs.TBCTL.bit.CTRMODE = 0; // count up and start // Wait for ADC interrupt for(;;) { LoopCount++; } } interrupt void adc_isr(void) { Voltage2[ConversionCount] = AdcResult.ADCRESULT2; if(ConversionCount == 1400) { ConversionCount = 0; } else { ConversionCount++; AdcRegs.ADCINTFLGCLR.bit.ADCINT1 = 1; //Clear ADCINT1 flag reinitialize for next SOC PieCtrlRegs.PIEACK.all = PIEACK_GROUP1; // Acknowledge interrupt to PIE } return; }
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...!!