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.
Part Number: LAUNCHXL-F28377S
Tool/software: Code Composer Studio
Hy all,
i am a little problem wiith 28377S_FLASH_lnk.cmd file.
Why these warnings?
Compiler version: TI v16.9.1.LTS
Thank you very much,
Paolo
I tryed compile my application in RAM how suggested in the wiki.
The program build successful, but in debug only one iteration of main loop go.
At second iteration the program loops in ISR void routine and i don't know why.
However, even if only one iteration, the FIR compute it's ok, while if i compile the same project into Flash the FIR compute it's bad!!
I am sure that the problem is linker, what do yo think?
Used linker: v191\F2837xS_common\cmd\2837xS_Generic_RAM_lnk.cmd
Compiler: 16.9.1, 16.9.2
Best regards,
Paolo
Hy Chris,
i waited new release of Controlsuite to continue my development so i have installed 3.4.5 version and i am using v210 support how suggest by you.
Now the problem is even stranger!
Build is ok in Flash and in Ram but in RAM the FIR algorithm does not work, instead in Flash the entire program doesn' t work and i don't understand why.
This is my code:
//########################################################################### // FILE: Voltmeter.c // TITLE: ADC triggering via epwm for F2837xS. // //! \addtogroup cpu01_example_list //! <h1> ADC ePWM Triggering (adc_soc_epwm)</h1> //! //! This example sets up the ePWM to periodically trigger the ADC. //! //! After the program runs, the memory will contain:\n //! - \b AdcaResults \b: A sequence of analog-to-digital conversion samples from //! pin A0. The time between samples is determined based on the period //! of the ePWM timer. // //########################################################################### // $TI Release: F2837xS Support Library v191 $ // $Release Date: Fri Mar 11 15:58:35 CST 2016 $ // $Copyright: Copyright (C) 2014-2016 Texas Instruments Incorporated - // http://www.ti.com/ ALL RIGHTS RESERVED $ //########################################################################### // FILE: Voltmetro_FFT.c // TITLE: ADC triggering via epwm for F2837xS. // //! \addtogroup cpu01_example_list //! <h1> ADC ePWM Triggering (adc_soc_epwm)</h1> //! //! This example sets up the ePWM to periodically trigger the ADC. //! //! After the program runs, the memory will contain:\n //! - \b AdcaResults \b: A sequence of analog-to-digital conversion samples from //! pin A0. The time between samples is determined based on the period //! of the ePWM timer. // //########################################################################### // $TI Release: F2837xS Support Library v191 $ // $Release Date: Fri Mar 11 15:58:35 CST 2016 $ // $Copyright: Copyright (C) 2014-2016 Texas Instruments Incorporated - // http://www.ti.com/ ALL RIGHTS RESERVED $ //########################################################################### #include "F28x_Project.h"// Device Headerfile and Examples Include File #include <fpu_math.h> #include <fpu_vector.h> #include <fpu_filter.h> #include <stdlib.h> #include <stdio.h> #include <string.h> #include "LCD_44780.h" #include <math.h> #include <ctype.h> #include "fpu_rfft.h" #include "fpu_fft_hann.h" #include "fpu_fft_hamming.h" #include "fpu_fft_flattop.h" #include "fpu_fft_blackman.h" #include "fpu_fft_blackmanharris.h" #include "fpu_fft_rect.h" #define RFFT_STAGES 11 #define RFFT_SIZE (1 << RFFT_STAGES) #define NPPP 16 #define UART0_BASE 0x7200 #define SizeCharDisplay 20 //.........FIR FILTER SETTINGS.............. #define FIR_ORDER 255 #pragma DATA_SECTION(firFP, "firfilt") FIR_FP firFP = FIR_FP_DEFAULTS; #pragma DATA_SECTION(dbuffer, "firldb") float32 dbuffer[FIR_ORDER+1]; #pragma DATA_SECTION(sigIn, "sigIn"); #pragma DATA_SECTION(sigOut, "sigOut"); float32 sigIn[RFFT_SIZE]; float32 sigOut[RFFT_SIZE]; #pragma DATA_SECTION(coeff, "coefffilt"); //float32 const coeff[FIR_ORDER+1] = FIR_1kHz_LOW; float32 const coeff[FIR_ORDER+1] = FIR_LP_1kHz; FIR_FP_Handle hnd_firFP = &firFP; //........................................... //RFFT_ADC_F32_STRUCT rfft_adc; //RFFT_ADC_F32_STRUCT_Handle hnd_rfft_adc = &rfft_adc; RFFT_F32_STRUCT rfft; RFFT_F32_STRUCT_Handle hnd_rfft = &rfft; #pragma DATA_SECTION(RFFTin1Buff,"RFFTdata1"); float32 RFFTin1Buff[RFFT_SIZE]; #pragma DATA_SECTION(RFFToutBuff,"RFFTdata2"); float32 RFFToutBuff[RFFT_SIZE]; #pragma DATA_SECTION(RFFTmagBuff,"RFFTdata3"); float32 RFFTmagBuff[RFFT_SIZE/2]; #pragma DATA_SECTION(RFFTF32Coef,"RFFTdata4"); float32 RFFTF32Coef[RFFT_SIZE]; #pragma DATA_SECTION(Power,"RFFTdata5"); float32 Power[RFFT_SIZE/2]; //#pragma DATA_SECTION(PeakValueFFT,"RFFTdata6"); //float32 PeakValueFFT[RFFT_SIZE/2]; #pragma DATA_SECTION(ADCin1Buff,"RFFTdata7"); uint16_t ADCin1Buff[RFFT_SIZE]; #pragma DATA_SECTION(Buffer_Signal_Scaled,"RFFTdata8"); float32 Buffer_Signal_Scaled[RFFT_SIZE]; //const float RFFTwindow[RFFT_SIZE/2] = RECT2048; void ConfigureADC(void); //ADC,PWM void ConfigureEPWM(void); void SetupADCEpwm(Uint16 channel); //void RFFT_f32_win(float *pBuffer, float *pWindow, uint16_t size); //FFT //void RFFT_f32_mag(RFFT_F32_STRUCT*); void PowerSpectrumCompute(void); void FFT(void); void FIR_Compute(void); void FloatToString(char *str, float f, char size); //Display void PrintFloatOnString(const char *Token1, float measure, char SizeMeasure, const char *Token2); void PrintIntegerOnString(const char *Token1, long measure, const char *Token2); void Print_Freq(float freq); //void useuart(void); //UART interrupt void adca1_isr(void); //ADC Isr interrupt void xint3_isr(void); //GPIO60 Isr static int max(const float a[], const int dim, const int index); void Set_Sample_Frequency(float FS); //ACQUIRE AND ELABORATE static float True_Rms(float Signal[], const int dim, float Freq, float FS); void PeakValueCompute(void); static float Frequency_Compute(const float Power_Spectrum[], const float FS, const int FFT_SIZE, const unsigned int Max_Index); void AcquireSignal(void); void Scale_input_buffer(void); void SetFreqUP(void); void SetFreqDWN(void); void SetPinLCD(void);// GPIO PIN Uint16 resultsIndex; volatile Uint16 bufferFull; float RMS_Value = 0; float Freq; float FSample, FSample_default; unsigned int Max_Index = 0; volatile char state = 0; size_t p; size_t q; //unsigned int msg1len;// = strlen(msg1); // Initialize the UART. Set the baud rate, number of data bits, turn off parity, number of stop bits, and stick mode. //uint32_t param1 = (uint32_t)&SciaRegs;// 0x00007210; //uint32_t param2 = (UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_EVEN); //uint32_t param3 = 50000000; //UARTConfigSetExpClk(param1, param3 ,10000, param2); // Enable the UART. void main(void) { // Step 1. Initialize System Control: // PLL, WatchDog, enable Peripheral Clocks // This example function is found in the F2837xS_SysCtrl.c file. InitSysCtrl(); // Step 2. Initialize GPIO: // This example function is found in the F2837xS_Gpio.c file and // illustrates how to set the GPIO to it's default state. InitGpio(); // Skipped for this example // Step 3. Clear all interrupts and initialize PIE vector table: // Disable CPU interrupts DINT; // Initialize the PIE control registers to their default state. // The default state is all PIE interrupts disabled and flags // are cleared. // This function is found in the F2837xS_PieCtrl.c file. InitPieCtrl(); SetPinLCD(); //setta i pin per il display initialize_LCD(); home_LCD(); // Disable CPU interrupts and clear all CPU interrupt flags: IER = 0x0000; IFR = 0x0000; // Initialize the PIE vector table with pointers to the shell Interrupt // Service Routines (ISR). // This will populate the entire table, even if the interrupt // is not used in this example. This is useful for debug purposes. // The shell ISR routines are found in F2837xS_DefaultIsr.c. // This function is found in F2837xS_PieVect.c. InitPieVectTable(); //Map ISR functions EALLOW; PieVectTable.ADCA1_INT = &adca1_isr; //function for ADCA interrupt 1 PieVectTable.XINT3_INT = &xint3_isr; EDIS; //Configure the ADC and power it up ConfigureADC(); //Configure the ePWM ConfigureEPWM(); //Setup the ADC for ePWM triggered conversions on channel 0 SetupADCEpwm(1); //Enable global Interrupts and higher priority real-time debug events: IER |= M_INT1; //Enable group 1 interrupts EINT; // Enable Global interrupt INTM ERTM; // Enable Global realtime interrupt DBGM resultsIndex = 0; bufferFull = 0; /* FIR Generic Filter Initialisation */ hnd_firFP->order = FIR_ORDER; hnd_firFP->dbuffer_ptr = dbuffer; hnd_firFP->coeff_ptr = (float *)coeff; hnd_firFP->init(hnd_firFP); //hnd_rfft_adc->Tail = &(hnd_rfft->OutBuf); hnd_rfft->FFTSize = RFFT_SIZE; //FFT size hnd_rfft->FFTStages = RFFT_STAGES; //FFT stages hnd_rfft->InBuf = &RFFTin1Buff[0]; //Input buffer (12-bit ADC) input hnd_rfft->OutBuf = &RFFToutBuff[0]; //Output buffer hnd_rfft->CosSinBuf = &RFFTF32Coef[0]; //Twiddle factor hnd_rfft->MagBuf = &RFFTmagBuff[0]; //Magnitude output buffer RFFT_f32_sincostable(hnd_rfft); //Calculate twiddle factor // Enable Xint3 in the PIE: Group 12 interrupt 1 PieCtrlRegs.PIECTRL.bit.ENPIE = 1; // Enable the PIE block PieCtrlRegs.PIEIER12.bit.INTx1= 1; // Enable PIE Group 12 INTx1 IER |= M_INT12; // Enable CPU int12 EINT; // Enable Global Interrupts XintRegs.XINT3CR.bit.POLARITY = 2; //Falling edge XintRegs.XINT3CR.bit.ENABLE = 1; //XINT3 interrpt enable GPIO_SetupXINT3Gpio(60); //GPIO60 SU XINT3 //enable PIE interrupt PieCtrlRegs.PIEIER1.bit.INTx1 = 1; //sync ePWM EALLOW; CpuSysRegs.PCLKCR0.bit.TBCLKSYNC = 1; //take conversions indefinitely in loop do { switch (state) { case 1: do{ if(GPIO_ReadPin(4) == 0){ DELAY_US(10000); SetFreqUP(); } if(GPIO_ReadPin(19) == 0){ DELAY_US(10000); SetFreqDWN(); } PrintIntegerOnString("Rate: ", (long)FSample, " Hz"); home_LCD(); }while(GPIO_ReadPin(61)!= 0); Set_Sample_Frequency(FSample); DELAY_US(10000); state = 3; break; case 2: Set_Sample_Frequency(FSample); DELAY_US(10000); state = 3; break; case 3: AcquireSignal(); //acquire signal Scale_input_buffer(); for(q = 0; q < RFFT_SIZE; q++) { sigIn[q] = Buffer_Signal_Scaled[q] = RFFTin1Buff[q]; } FIR_Compute(); FFT(); //FFT Computing PowerSpectrumCompute();//Power spectrum Max_Index = max(Power, RFFT_SIZE>>1, 1); //search index max value start to 1 element (no DC component) Freq = Frequency_Compute (Power, FSample, RFFT_SIZE, Max_Index); RMS_Value = True_Rms(Buffer_Signal_Scaled, RFFT_SIZE, Freq, FSample); PrintFloatOnString("Vrms: ", RMS_Value, 3, " V"); goto_line_LCD (2); Print_Freq(Freq); goto_line_LCD (3); PrintIntegerOnString("Rate: ", (long)FSample, " Hz"); home_LCD(); break; default: FSample = 50000.0;//10 KHz default state = 2; break; } asm(" ESTOP0"); }while(1); } //Write ADC configurations and power up the ADC for both ADC A and ADC B void ConfigureADC(void) { EALLOW; //write configurations AdcaRegs.ADCCTL2.bit.PRESCALE = 0b0110; //set ADCCLK divider to /4 AdcSetMode(ADC_ADCA, ADC_RESOLUTION_12BIT, ADC_SIGNALMODE_SINGLE); //Set pulse positions to late AdcaRegs.ADCCTL1.bit.INTPULSEPOS = 1; //power up the ADC AdcaRegs.ADCCTL1.bit.ADCPWDNZ = 1; //delay for 1ms to allow ADC time to power up DELAY_US(1000); EDIS; } void ConfigureEPWM(void) { EALLOW; // Assumes ePWM clock is already enabled EPwm1Regs.ETSEL.bit.SOCAEN = 0; // Disable SOC on A group EPwm1Regs.ETSEL.bit.SOCASEL = 4; // Select SOC on up-count EPwm1Regs.ETPS.bit.SOCAPRD = 1; // Generate pulse on 1st event EPwm1Regs.CMPA.bit.CMPA = 311; EPwm1Regs.TBPRD = 624; EPwm1Regs.TBCTL.bit.CTRMODE = 3; // freeze counter EDIS; } void SetupADCEpwm(Uint16 channel) { Uint16 acqps; //determine minimum acquisition window (in SYSCLKS) based on resolution if((ADC_RESOLUTION_12BIT == AdcaRegs.ADCCTL2.bit.RESOLUTION)){ acqps = 14; //75ns } else { //resolution is 16-bit acqps = 63; //320ns } //Select the channels to convert and end of conversion flag EALLOW; AdcaRegs.ADCSOC0CTL.bit.CHSEL = channel; //SOC0 will convert pin A0 AdcaRegs.ADCSOC0CTL.bit.ACQPS = acqps; //sample window is 100 SYSCLK cycles AdcaRegs.ADCSOC0CTL.bit.TRIGSEL = 5; //trigger on ePWM1 SOCA/C AdcaRegs.ADCINTSEL1N2.bit.INT1SEL = 0; //end of SOC0 will set INT1 flag AdcaRegs.ADCINTSEL1N2.bit.INT1E = 1; //enable INT1 flag AdcaRegs.ADCINTFLGCLR.bit.ADCINT1 = 1; //make sure INT1 flag is cleared } interrupt void adca1_isr(void) { ADCin1Buff[resultsIndex++] = (AdcaResultRegs.ADCRESULT0); if(RFFT_SIZE<=resultsIndex ) { resultsIndex = 0; bufferFull = 1; } AdcaRegs.ADCINTFLGCLR.bit.ADCINT1 = 1; //clear INT1 flag PieCtrlRegs.PIEACK.all = PIEACK_GROUP1; } interrupt void xint3_isr(void) { state = 1; PieCtrlRegs.PIEACK.all = PIEACK_GROUP12; } static int max(const float a[], const int dim, const int index) //cerca l'indice a cui corrisponde il valore massimo { //escludendo gli elementi a partire dall'indice index float max = 0.0; size_t iq = 0; size_t pq = 0; for (iq = index; iq <(dim-index); iq++) { if (max < a[iq]) { max = a[iq]; pq = iq; } } return pq; } float min(float a[], int dim) { int min = NULL; int ii; for (ii = 0; ii < dim; ii++) { if (min>a[ii]) { min=a[ii]; } } return min; } void SetPinLCD(void) { GPIO_SetupPinMux(41, GPIO_MUX_CPU1, 0); GPIO_SetupPinOptions(41, GPIO_OUTPUT, GPIO_PUSHPULL); GPIO_SetupPinMux(71, GPIO_MUX_CPU1, 0); GPIO_SetupPinOptions(71, GPIO_OUTPUT, GPIO_PUSHPULL); GPIO_SetupPinMux(89, GPIO_MUX_CPU1, 0); GPIO_SetupPinOptions(89, GPIO_OUTPUT, GPIO_PUSHPULL); GPIO_SetupPinMux(90, GPIO_MUX_CPU1, 0); GPIO_SetupPinOptions(90, GPIO_OUTPUT, GPIO_PUSHPULL); GPIO_SetupPinMux(72, GPIO_MUX_CPU1, 0); GPIO_SetupPinOptions(72, GPIO_OUTPUT, GPIO_PUSHPULL); GPIO_SetupPinMux(78, GPIO_MUX_CPU1, 0); GPIO_SetupPinOptions(78, GPIO_OUTPUT, GPIO_PUSHPULL); GPIO_SetupPinMux(65, GPIO_MUX_CPU1, 0); GPIO_SetupPinOptions(65, GPIO_OUTPUT, GPIO_PUSHPULL); GPIO_SetupPinMux(43, GPIO_MUX_CPU1, 0); GPIO_SetupPinOptions(43, GPIO_OUTPUT, GPIO_PUSHPULL); GPIO_SetupPinMux(60, GPIO_MUX_CPU1, 0); //usato per cambiare la freq di campionamento GPIO_SetupPinOptions(60, GPIO_INPUT, GPIO_PUSHPULL); GPIO_SetupPinMux(61, GPIO_MUX_CPU1, 0); //confermo la freq di campionamento GPIO_SetupPinOptions(61, GPIO_INPUT, GPIO_PUSHPULL); GPIO_SetupPinMux(4, GPIO_MUX_CPU1, 0); // incremento la freq di campionamento GPIO_SetupPinOptions(4, GPIO_INPUT, GPIO_PUSHPULL); GPIO_SetupPinMux(19, GPIO_MUX_CPU1, 0);//decremento la freq di campionamento GPIO_SetupPinOptions(19, GPIO_INPUT, GPIO_PUSHPULL); } // convert float to string one decimal digit at a time // assumes float is < 65536 and ARRAYSIZE is big enough // problem: it truncates numbers at size without rounding // str is a char array to hold the result, float is the number to convert // size is the number of decimal digits you wan void FloatToString(char *str, float f, char size) { char pos; // position in string char len; // length of decimal part of result char* curr; // temp holder for next digit long value; // decimal digit(s) to convert pos = 0; // initialize pos, just to be sure value = (int)f; // truncate the floating point number ltoa(value,str); // this is kinda dangerous depending on the length of str // now str array has the digits before the decimal if (f < 0 ) // handle negative numbers { f *= -1; value *= -1; } len = strlen(str); // find out how big the integer part was pos = len; // position the pointer to the end of the integer part str[pos++] = ','; // add decimal point to string while(pos < (size + len + 1) ) // process remaining digits { f = f - (float)value; // hack off the whole part of the number f *= 10; // move next digit over value = (int)f; // get next digit ltoa(value, curr); // convert digit to string str[pos++] = *curr; // add digit to result string and increment pointer } } /* void PeakValueCompute(void) { size_t i; for(i=0;i<=(RFFT_SIZE/2);i++) {PeakValueFFT[i]=RFFTmagBuff[i]/RFFT_SIZE;} //calcola lo spettro di potenza che utilizziamo //per la stima della frequenza fondamentale del segnale } */ static float Frequency_Compute (const float Power_Spectrum[], const float FS, const int FFT_SIZE, const unsigned int Max_Index) { float a = 0; float b = 0; size_t jk= 0; for(jk = Max_Index-3; jk <= Max_Index+3; jk++) { a += Power_Spectrum[jk]*(FS/FFT_SIZE)*jk; b += Power_Spectrum[jk]; } return a/b; } void AcquireSignal(void) { //start ePWM EPwm1Regs.ETSEL.bit.SOCAEN = 1; //enable SOCA EPwm1Regs.TBCTL.bit.CTRMODE = 0; //unfreeze, and enter up count mode //wait while ePWM causes ADC conversions, which then cause interrupts, //which fill the results buffer, eventually setting the bufferFull //flag while(!bufferFull); bufferFull = 0; //clear the buffer full flag //stop ePWM EPwm1Regs.ETSEL.bit.SOCAEN = 0; //disable SOCA EPwm1Regs.TBCTL.bit.CTRMODE = 3; //freeze counter } void PowerSpectrumCompute(void) { size_t j; for(j = 0; j <=(RFFT_SIZE/2); j++) Power[j]=(RFFTmagBuff[j]*RFFTmagBuff[j])/(pow(RFFT_SIZE,2)); //calcola lo spettro di potenza che utilizziamo //per la stima della frequenza fondamentale del segnale } void FFT(void) { RFFT_f32u(hnd_rfft); RFFT_f32_mag_TMU0(hnd_rfft); } void Set_Sample_Frequency(float FS) { unsigned int TBPRD = 0; unsigned int CMPA = 0; TBPRD = (unsigned int)((rnd_SP_RS(200000000.0/(4*FS)-1))); CMPA = (unsigned int)((rnd_SP_RS((TBPRD/2.0)-1))); EPwm1Regs.CMPA.bit.CMPA = CMPA; EPwm1Regs.TBPRD = TBPRD; } void PrintFloatOnString(const char *Token1, float measure, char SizeMeasure, const char *Token2) { size_t ij; char String_Empty_Spaces[SizeCharDisplay+1] = ""; char measure_float[SizeCharDisplay+1]= ""; char StrToken1[SizeCharDisplay+1] = ""; char StrToken2[SizeCharDisplay+1] = ""; char TempString[SizeCharDisplay+1] = ""; char EndString[SizeCharDisplay+1] = ""; strcpy(StrToken1,Token1); strcpy(StrToken2,Token2); strcpy(TempString, StrToken1); FloatToString(measure_float, measure, SizeMeasure); strcat(TempString, measure_float); strcat(TempString, StrToken2); for(ij = 0; ij < SizeCharDisplay-strlen(TempString); ij++) { String_Empty_Spaces[ij] = ' '; } String_Empty_Spaces[++ij] = '\0'; strcat(TempString, String_Empty_Spaces); strcpy(EndString, TempString); write_string_LCD((unsigned char*)EndString); } void PrintIntegerOnString(const char *Token1, long measure, const char *Token2) { size_t iq; char String_Empty_Spaces[SizeCharDisplay+1] = ""; char measure_long[SizeCharDisplay+1]= ""; char StrToken1[SizeCharDisplay+1] = ""; char StrToken2[SizeCharDisplay+1] = ""; char TempString[SizeCharDisplay+1] = ""; char EndString[SizeCharDisplay+1] = ""; strcpy(StrToken1,Token1); strcpy(StrToken2,Token2); strcpy(TempString, StrToken1); ltoa(measure, measure_long); strcat(TempString, measure_long); strcat(TempString, StrToken2); for(iq = 0; iq < SizeCharDisplay-strlen(TempString); iq++) { String_Empty_Spaces[iq] = ' '; } String_Empty_Spaces[++iq] = '\0'; strcat(TempString, String_Empty_Spaces); strcpy(EndString, TempString); write_string_LCD((unsigned char*)EndString); } void SetFreqUP (void) { if((FSample >= 800.0) && (FSample < 1000.0)) FSample += 10; else if((FSample >= 1000.0) && (FSample < 10000.0)) FSample += 100; else if((FSample >= 10000.0) && (FSample < 100000.0)) FSample += 1000; else if((FSample >= 100000.0) && (FSample < 1200000.0)) FSample += 10000; else FSample = 800; } void SetFreqDWN (void) { if((FSample > 800.0) && (FSample <= 1000.0)) FSample -= 10; else if((FSample > 1000.0) && (FSample <= 10000.0)) FSample -= 100; else if((FSample > 10000.0) && (FSample <= 100000.0)) FSample -= 1000 ; else if((FSample > 100000.0) && (FSample <= 1200000.0)) FSample -= 10000; else FSample = 1200000; } static float True_Rms( float Signal[], const int dim, float Freq, float FS) { size_t z = 0; float somma_dei_quadrati = 0.0; float media; //unsigned int nsample =(unsigned int)((floor(dim*(Freq/FS))-1)*(FS/Freq)); media = 0.0; for(z = 0; z < dim; z++) { media += Signal[z]; } media = media/dim; //calcolo la media del segnale for(z = 0; z < dim; z++) { Signal[z] = Signal[z] - media; //sottraggo la media dai valori del segnale acquisito } for(z = 0; z < dim; z++) // adesso ho un subarray che contiene un n intero di periodi del mio segnale { somma_dei_quadrati += Signal[z]*Signal[z]; } return sqrt(somma_dei_quadrati/dim); //valore efficace } void Print_Freq(float freq) { float Freq = freq; if((Freq >= 0.0)&&(Freq < 1000.0)) //Hz { if((Freq >= 0.0)&&(Freq <= 9.999)) // 0.001--9.999 3 cifre decimali, 1 cifra intera PrintFloatOnString("Fo: ", Freq, 3, " Hz"); else if((Freq >= 10.0)&&(Freq <= 99.99)) //10.00--99.99 2 cifre decimali, 2 cifre intere PrintFloatOnString("Fo: ", Freq, 2, " Hz"); else if((Freq >= 100.0)&&(Freq <= 999.9)) //100.0--999.9 1 cifra decimale, 3 cifre intere PrintFloatOnString("Fo: ", Freq, 1, " Hz"); } else if((Freq >= 1000.0)&&(Freq < 1000000.0)) //KHz { Freq = Freq/1000.0; if((Freq >= 0.0)&&(Freq <= 9.999)) // 0.001--9.999 3 cifre decimali, 1 cifra intera PrintFloatOnString("Fo: ", Freq, 3, " kHz"); else if((Freq >= 10.0)&&(Freq <= 99.99)) //10.00--99.99 2 cifre decimali, 2 cifre intere PrintFloatOnString("Fo: ", Freq, 2, " kHz"); else if((Freq >= 100.0)&&(Freq <= 999.9)) //100.0--999.9 1 cifra decimale, 3 cifre intere PrintFloatOnString("Fo: ", Freq, 1, " kHz"); } else if((Freq >= 1000000.0)&&(Freq <= 5000000.0)) //MHz { Freq = Freq/1000000.0; if((Freq >= 0.0)&&(Freq <= 9.999)) // 0.001--9.999 3 cifre decimali, 1 cifra intera PrintFloatOnString("Fo: ", Freq, 3, " MHz"); else if((Freq >= 10.0)&&(Freq <= 99.99)) //10.00--99.99 2 cifre decimali, 2 cifre intere PrintFloatOnString("Fo: ", Freq, 2, " MHz"); else if((Freq >= 100.0)&&(Freq <= 999.9)) //100.0--999.9 1 cifra decimale, 3 cifre intere PrintFloatOnString("Fo: ", Freq, 1, " MHz"); } } void Scale_input_buffer(void) { size_t k; for(k = 0; k < (RFFT_SIZE); k = k+2) { RFFTin1Buff[k] = 0.000732421875*(0b0000111111111111&ADCin1Buff[k]); RFFTin1Buff[k+1] = 0.000732421875*(0b0000111111111111&ADCin1Buff[k+1]); } // 0.000732421875 = 3/4096 (3v ADC reference) } void FIR_Compute(void) { size_t fir; for(fir = 0; fir < RFFT_SIZE; fir++) { hnd_firFP->input = sigIn[fir]; hnd_firFP->calc(&firFP); sigOut[fir] = hnd_firFP->output; } }
At reset:
First iteration:
The settings in ccs seems ok, the same for flash and ram version, only the command linker changes.
What others informations can i give you to help understanding?
Thank you very much
Paolo.
Hy Chris, i solved ;)
In flash program doesn't go because DELAY_US function, so i used _FLASH directive in predefinited symbols in CCS configurations. All ok.
The warning did go away too, i use command in linker cmd file for create section:
RFFTdata1 : > RAMGS0, PAGE = 1, fill=0x1000 RFFTdata2 : > RAMGS1, PAGE = 1, fill=0x1000 RFFTdata3 : > RAMGS2, PAGE = 1, fill=0x0800 RFFTdata4 : > RAMGS3, PAGE = 1, fill=0x1000 RFFTdata5 : > RAMGS4, PAGE = 1, fill=0x0800 RFFTdata5 : > RAMGS5, PAGE = 1, fill=0x1000 RFFTdata8 : > RAMGS6, PAGE = 1, fill=0x1000 sigIn : > RAMGS7, PAGE = 1, fill=0x1000 sigOut : > RAMGS8, PAGE = 1, fill=0x1000 RFFTdata7 : > RAMGS9, PAGE = 1, fill=0x0800 firldb : > RAMGS10,PAGE = 1, fill=0x0400 coefffilt : > RAMGS11,PAGE = 1, fill=0x0400 firfilt : > RAMLS5 ,PAGE = 1, fill=0x0100 firldb ALIGN(4096) > RAMGS0 PAGE = 1 coefffilt ALIGN(4096) > RAMGS1 PAGE = 1 RFFTdata1 :> RAMGS0, PAGE = 1, ALIGN(4096)
Now is all ok and code works fine both in FLASH and RAM memory.
Thank you very much of all,
Paolo.
Great to hear Paolo!
Yes for flash build configurations, that pre-defined symbol always has to defined.
Happy developing!
Best Regards
Chris