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.

TMS320F28379D: Problem with POP AR5:AR4 assembly instruction

Part Number: TMS320F28379D

Hi,

I have weird issue with instruction POP AR5:AR4.

My sample code:

        MOVW        DP, #_EPwm4Regs.CMPA.bit.CMPA
        PUSH        @_EPwm4Regs.CMPA.bit.CMPA
        MOVW        DP, #_EPwm8Regs.CMPA.bit.CMPA
        PUSH        @_EPwm8Regs.CMPA.bit.CMPA
        MOVW        DP, #_EPwm3Regs.CMPA.bit.CMPA
        PUSH        @_EPwm3Regs.CMPA.bit.CMPA
        MOVW        DP, #_EPwm7Regs.CMPA.bit.CMPA
        PUSH        @_EPwm7Regs.CMPA.bit.CMPA
        MOVW        DP, #_EPwm6Regs.CMPB.bit.CMPB
        PUSH        @_EPwm6Regs.CMPB.bit.CMPB
        MOVW        DP, #_EPwm6Regs.CMPA.bit.CMPA
        PUSH        @_EPwm6Regs.CMPA.bit.CMPA

        POP         AR5:AR4

From instruction set description POP AR5:AR4 should work like:

SP -= 2;
AR4 = [SP];
AR5 = [SP+1];

but after debugging in system it works like:

SP = -2;
AR4 = [SP-1];
AR5 = [SP];

so after more digging I found that problem lies in not aligned stack pointer. For example if we push odd 16-bit values into stack and thet try to POP ARn:ARm it results in errored values.

I thinks this issue is very problematic so it should be mentioned in POP/PUSH instructions.

  • I agree with you.  Thank you for reporting it.  I will submit a literature request.  

    BTW, this is something you can always do yourself by clicking on the "Submit Documentation Feedback" link at the foot of each page in the User's Guide.

    Regards,

    Richard