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.

[参考译文] MSP430FR5994:"在地址"0x5c5be&quot 处断开;没有可用的调试信息,或程序代码之外。"-使用进行循环计数时

Guru**** 1828310 points
Other Parts Discussed in Thread: ENERGYTRACE
请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/microcontrollers/msp-low-power-microcontrollers-group/msp430/f/msp-low-power-microcontroller-forum/1070068/msp430fr5994-break-at-address-0x5c5be-with-no-debug-information-available-or-outside-of-program-code---when-using-a-for-loop-counting-down

部件号:MSP430FR5994
“线程”中讨论的其它部件:ENERGY-TRACEABS

我正在尝试使用 EnergyTrace 技术优化代码以降低功耗。 我使用以下函数:

static void amplify_data(void)
{
    volatile uint16_t cnt = 0;
    volatile uint16_t newval = 0;
    for(cnt = 0; cnt < SAMPLES_LENGTH; cnt++)
    {
        newval = __data20_read_short(&dataRecorded1[cnt]);
        newval = newval << 2;
        __data20_write_short(&dataRecorded1[cnt], newval);
    }
}

我用倒计时配置替换 for 循环,因为我发现它可以节省一些能量。 但是,当我使用此配置运行代码时,我会收到上面标题中提到的消息。 我看了不同 MSP 设备出现的类似问题,但这些解决方案都没有奏效——我尝试更改代码的优化级别,确保堆栈有足够的空间,并且没有溢出,但问题仍然存在。 我不确定到底是什么原因会引发此问题-我想特别删除它,因为我的后一个代码的执行因该点后代码停止而受到阻碍。 我使用上述函数的代码如下所示:

#define VECTOR_SIZE (512)

#pragma DATA_SECTION(signal_fft, ".leaRAM")
DSPLIB_DATA(signal_fft,MSP_ALIGN_FFT_Q15(VECTOR_SIZE))
_q15 signal_fft[VECTOR_SIZE] = {0};

DSPLIB_DATA(fft_res,MSP_ALIGN_FFT_Q15(VECTOR_SIZE))
_q15 fft_res[VECTOR_SIZE] = {0};
_q15 FFT_data[VECTOR_SIZE] = {0};

msp_fft_q15_params realFftParams;
msp_add_q15_params addParams;

int16_t window_number = 0;
int16_t imag, real;
uint16_t real_abs, imag_abs, mag, max, min;
uint16_t clock_count = 0;

static void fft_init(void)
{
    realFftParams.length = 512;
    realFftParams.twiddleTable = msp_cmplx_twiddle_table_256_q15; // Table not needed when using LEA
    realFftParams.bitReverse = 1; // Since input is not already in bit reversed order
    addParams.length = 512;
}

static void fft_cal(void)
{
    volatile msp_status status;
    volatile uint16_t i;
    for(i = 0; i < VECTOR_SIZE; i++)
    {
        // Last window is short by 1
        // Array is of 32767 and not 32768
        if (window_number == 63)
        {
            if (i == (VECTOR_SIZE - 1))
            {
                signal_fft[i] = 0;
            }
            else
            {
                signal_fft[i] = (_q15)__data20_read_short(&dataRecorded1[(VECTOR_SIZE*window_number)+i]);
            }
        }
        else
        {
            signal_fft[i] = (_q15)__data20_read_short(&dataRecorded1[(VECTOR_SIZE*window_number)+i]);
        }
    }
    status = msp_fft_fixed_q15(&realFftParams,signal_fft);
    if (status != MSP_SUCCESS)
    {
        __no_operation();
    }
    status = msp_add_q15(&addParams, signal_fft, fft_res, fft_res);
    if (status != MSP_SUCCESS)
    {
        __no_operation();
    }
    memset(signal_fft, 0, sizeof(signal_fft));
    window_number++;
}
}
/* Since internal reference voltage is not being used, mic o/p through ADC is low. Multiply by 4. */
static void amplify_data(void)
{
    unsigned int cnt;
    uint16_t newval=0;
    for(cnt = 0; cnt < SAMPLES_LENGTH; cnt++)
    {
        newval = __data20_read_short(&dataRecorded1[cnt]);
        newval = newval << 2;
        __data20_write_short(&dataRecorded1[cnt], newval);
}
}
void runApplication(void)
{
    while(1)
    {
        P5IE &= ~BIT7;      // Disable interrupt on P5.7 // vm1010
        P5IE &= ~BIT6;      // Disable interrupt on P5.6
        P5IE &= ~BIT5;      // Disable interrupt on P5.5

		// Disable button interrupt
		GPIO_disableInterrupt(PUSHBUTTON1_PORT, PUSHBUTTON1_PIN);

    	switch(applicationMode)
        {
    	    volatile uint16_t j;
            case RECORD:
                runRecord();
                amplify_data();
                fft_init();
                while(window_number < 64)
                {
                    fft_cal();
                }
                window_number=0;
                
                /*  Code continues  */

如果我能得到关于我可能需要实施哪些更改或缺少的任何设置的任何建议,这将非常有帮助。 谢谢你。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    失败的代码在哪里?

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    下面是代码的完整部分。

    for(j = 1; j < (VECTOR_SIZE / 2); j++)  // vm1010
                    {
                        // vm1010
                        real = fft_res[2 * j] << 2;
                        imag = fft_res[2 * j + 1] << 2;
                        if(real < 0)
                        {
                            real_abs = ~real + 1;
                        }
                        else
                        {
                            real_abs = real;
                        }
                        if(imag < 0)
                        {
                            imag_abs = ~imag + 1;
                        }
                        else
                        {
                            imag_abs = imag;
                        }
                        if(real_abs >= imag_abs)
                        {
                            max = real_abs;
                            min = imag_abs;
                        }
                        else
                        {
                            max = imag_abs;
                            min = real_abs;
                        }
                        mag = max + 3 * (min >> 3);
                        FFT_data[j] = mag << 1;
                    }
                    break;
                default: break;
            }
    
            // Toggle app mode
    		applicationMode = DEFAULT;
    
    		P6OUT &= ~BIT1;                 // vm1010
    
    		// Set a Switch debounce to 500ms
            __delay_cycles(0.01 * __SYSTEM_FREQUENCY_MHZ__);
    
            P5IFG &= ~BIT6;                 // Clear interrupt on P5.6
            P5IE |= BIT6;                   // Enable interrupt on P5.6
            P5IFG &= ~BIT5;                 // Clear interrupt on P5.5
            P5IE |= BIT5;                   // Enable interrupt on P5.5
            P5IFG &= ~BIT7;                 // Clear interrupt on P5.7 // vm1010
            P5IE |= BIT7;                   // Enable interrupt on P5.7 // vm1010
            // vm1010 mode pin, o/p, high for WoS mode
            P6OUT |= BIT1;  // vm1010
    
            GPIO_clearInterrupt(PUSHBUTTON1_PORT, PUSHBUTTON1_PIN);        // Clear the interrupt flag
            GPIO_enableInterrupt(PUSHBUTTON1_PORT, PUSHBUTTON1_PIN);       // Re-enable the interrupt
    
            // Enter low power mode
    		__bis_SR_register(LPM4_bits + GIE);
    
    		float spectrum[256];
    		float mfcc_result;
    		float mfcc_value[13];
    		float mfcc_features_f[12];
    		/* Once I enter this condition, code fails here - the code interval is from this line to line 100 */
    		
            if(FFT_data[1] != 0)
            {
                // MFCC Calculations can be included here
                unsigned int i;
                for(i=256;i>0;i--)
                {
                    spectrum[i] = (float)FFT_data[i];
                }
                
                spectrum[0] = 0;
                unsigned int coeff;
                for(coeff = 0; coeff < 13; coeff++)
                {
                        mfcc_result = GetCoefficient(spectrum, 22050, 20, 16, coeff);
                        mfcc_value[coeff] = mfcc_result;
                }
    
                /* The 1st MFCC at index 0 is removed as it only conveys constant offset and no relevant information */
                unsigned int m;
                for(m=0; m<12; m++)
                {
                    mfcc_features_f[m] = mfcc_value[m+1];
                }
                unsigned int a,b;
                for(a=0; a<1; a++)
                {
                    for(b=0; b<12; b++)
                    {
                        feat1[a][b] = mfcc_features_f[b];
                    }
                }
    
                matrix_multiply(1, 12, 12, 12, feat1, weights1, pdt1);

    下面是代码失败时的分解:

    如果需要更多信息,请告诉我。  

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    一个一个。

    由于质谱[]是尺寸256,最大指数为255,但循环以256开始。 这将每次都造成麻烦。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    嗨,大卫,谢谢你在另一个地方的回应——指数确实是一个问题。 我完全错过了这一点。