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.

MSP430F6779: ADC interrupt issue

Part Number: MSP430F6779

Hi team,

For MPY32 hardware multiplier:

1. The code generated by EnergyMeasurementDesignCenter-1.40.00.03 is used.

2. MSP DSP Lib: DSPLib_1_30_00_02 is used.

3. Capture interrupts in ADC SD24 with 4K sampling frequency, call algorithm functions in emSwLib library in interrupts, and use MPY32 for analysis.

4. Takes 256 data from the data collected by the ADC for fft, using the function msp_fft_iq31, which executes outside of the interrupt.

Issue:

Using a set of test data for fft, it was found that the results were different after each conversion. The result of fft after an interrupt is turned off with __disable_interrupt before fft is performed is the same every time, as is the case with other fft algorithms. It should be that the msp_fft_iq31 was interrupted by the ADC and MPY32 was used during the MPY32 process, causing the MPY32 original data to be corrupted, resulting in different results each time the fft came out. The customer has tried to back up the MPY32-related registers when entering the interrupt calculation, and restore the the MPY32-related registers when exiting the interrupt, but the problem remains.

The customer would like to know is it possible to resolve this issue by restoring the MPY32 registers, or is there a way to solve this problem? NOTE: The interrupt cannot be turned off because some of the more important actions are taken in the ADC interrupt.

Could you help check this case? Thanks.

Best Regards,

Cherry

  • Details matter here so you should really look at the example in the user guide at 25.2.7.1

  • Hello Cherry,

    Using MPY32 and interrupts can be tricky. There are instances where you have to temporarily disable interrupts, then reenable after an action. There are also instances where you would want to save off the MPT32 registers and then restore them. Check out Sections 25.2.7 and Section 25.2.7.1 for more information and guidance. 

  • Hi dear all,

    This issue has been resolved. The customer has followed your step.

    But here comes an additional question:

    The customer also has tried the assembly routine in 25.2.7.1, but it failed, as shown below:

    1. Just copy the routine and compile, but the compilation failed, and there were several symbols that could not be found, but they did were exist.

    2. By referring to the register, the macro definition can be compiled by replacing it with the actual value:

    3. But when the program runs into the mpy32Backup, it dose not work,

    Could you help check this?

    Thanks and Best Regards,

    Cherry

  • The example at 25.2.7.1 is for assembly, not to be used as you have done it. Think about what you did. You pushed a bunch of data to the stack and then your C function tries to return. Instead of a return address on the stack, it finds your saved data. This will blow up every time.

    You could drop those asm() statements into your ISR but only if you think about the stack.

  • Cherry,

    As David pointed out, the best way to move forward to to implement the examples given in C to better integrate into the project. 

**Attention** This is a public forum