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.

MSP430F47177: How to disble ADC Interrupt & Hardware multiplier, which is causing Reset

Part Number: MSP430F47177
Other Parts Discussed in Thread: ADS131M08,

Hi All, 

We are using ADS131M08 AFE to measure voltage, current values, interfaced to MSP430F47177.

Earlier we did the same using in-built ADC of MSP430F47177. While using internal ADC, an ADC interrupt & hardware multiplier was used. (ASM code for hardware multiplier exists in code)

Now as we want to work with external ADC ADS131M08, we do not need ADC interrupt. But, we need calculation what we were doing in ADC interrupt.

So, we disabled ADC interrupt, & called a function (let's say ADC_Read) which has same calculation code that were present in ADC interrupt.

In ADC interrupt code there is an assembly code for hardware multiplication, which calculates square-sum values.

While we run the code by calling ADC_Read function, code executes up to the hardware multiplier part but then enters into NMI interrupt & gets reset.

If I didn't call the function ADC_Read, code works properly & didn't get reset.

Any idea why this is happening.

Is it because ADC interrupt didn't get disabled properly & do I need to change setting in project for hardware multiplier?

Note:-

I changed setting for following

1.

Earlier:- Project-> Properties-> MSP430 Compiler-> Optimization ->Inline Hardware multiply version of RTS mpy routine(--use_hw_mpy) == 32

Changed to :- None

Result:- Still code is getting reset.

2.

Earlier:- Project-> Properties-> MSP430 Compiler-> ULP Advisor -> Hardware Multiplier

Changed to :- Untiked to checkbox of Hardware Multiplier

Result:- Still code is getting reset.

Thanks & Regards

  • After debugging the code, found that it is entering into NMI interrupt.

    Cause for NMI interrupt generation is flash access violation.

    ACCVIFG bit is set ib FCTL3 register.

    How to avoid this?

  • Assembly code for hardware multiplier is given:-

    asm(

    " MOV V32_temp+0,&0144h;  //Signed 32 MPY

    " MOV V32_temp+2, &0146h; //Signed 32 MPY

    MOV #4096,&0138h; //the #4096 is SMCLK_ADC_RATIO

    MOV &0154h,V32_temp;

    " MOV &0156h,V32_temp+2;        

    " ; MOV &0158h,V32_temp+2;     //Add to MSB  

    " ; MOV &015Ah,V32_temp+6;     

    ); 

  • I don't see anything obviously wrong with the assembly code.

    At this point, I would be supposing I had accidentally stuck my elbow into something unrelated, and running through the basics:

    1) Check the map file to make sure V32_temp hadn't suddenly moved someplace inappropriate

    2) Check the assembly code to make sure it looks like the asm() statement (possibly combine with (3))

    3) Step through the assembly code using "Run->Assembly Step Into" (I thought there was a button for this, but I don't see it now) to pin down the exact instruction.

    These may or may not tell you anything, but will probably only take about 15 minutes to do.

    Aside: Those check-boxes in the Settings only control what the compiler does; the compiler doesn't know what's in an asm() statement.

  • Unless there is some reason to keep this general purpose, shifting left by 12 bits is almost always preferable to using a multiply operation.

    I am a little confused by your code. You write a 32 bit operand to OP1 but then write only a single 16 bit operand to OP2. The docs state that after writing a 16 bit value to OP2L you must write the second half to OP2H. There is no way to do a 16X32 multiply. So as near as I can tell you leave the multiplier hanging with an incomplete operation.

**Attention** This is a public forum