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.

clearing off RAM memory in IAR

Other Parts Discussed in Thread: MSP430F5438

hello,

i am using IAR embeddeb workbench. I am working on DMA controller and want to transfer data from one RAM location to other.

I am struck with a silly problem. My RAM memory displays some garbage values which is not getting cleared.

please help,

thank you in advance.

 

  • Hi Gaurav,

    When posting on these forums it is helpful to include what MSP430 you are using, your code if possible, and any other details. More details make it easier to help you through your problems.

    -Mike

  • Mr. Michael Stein,

    I apologize for i have not mentioned microcontroller. I am working on  MSP430F5438 and using MSP430FETUIF emulator.

    my program is:-

    function:- to transfer 16 word block from one RAM location to other using DMA.

    #include "msp430x54x.h"

            RSEG  CSTACK
            RSEG  CODE
             
    RESET   MOV.W #SFE(CSTACK),SP
            MOV.W #WDTPW+WDTHOLD, &WDTCTL
            bis.B #0x01,&P1DIR
            MOVX.A #0x1C00,&DMA0SA
            MOVX.A #0x1C20,&DMA0DA
            MOV.W #0x0010,&DMA0SZ
            MOV.W #DMADT_0+DMADSTINCR_3 +DMASRCINCR_3,&DMA0CTL
            BIS.W #DMAEN,&DMA0CTL
                        
    MAINLOOP  bis.B #0x01,&P1OUT
              BIS.W #DMAREQ,&DMA0CTL
              BIC.B #0x01,P1OUT
              JMP MAINLOOP
                                             
                      COMMON INTVEC
                       
           ORG RESET_VECTOR
           DW  RESET
           END 

     

    I am not able to clear RAM memory; it is showing some garbage values. Please help

    thank you in advance.

     

     

  • hello,

    I got the solution for my query. Just need to right click on selected memory part and use memory fill option.

    regards.

  • gaurav mohta said:
    I am not able to clear RAM memory

    You do not try.
    Your code appears to try to copy 16 words from 0x1c00 to 0x1c20.

    However, you never write anything to 0x1c00, so the ram there (is there ram?) contains whatever garbage was there after power-up.

    try the following (in initialized data segment):

    source DW 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
    destination DW 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0

    and use MOVX.A #source,&DMA0SA etc.

    It is not necessary to use the MOVX.A instruction. Both, operand (address) and destination (DAM register asddress) are 16 bit, so a simple MOV is shorter and faster and does the same.

     

  • thank you sir,

    now i am able to transfer data successfully.

    1 question, MOVX instruction is used in microcontroller 8051 to address external memory. Is it of same use in MSP430F5438?

     

  • gaurav mohta said:
    MOVX instruction is used in microcontroller 8051 to address external memory. Is it of same use in MSP430F5438

    No. The X instrucitons  (and the A isntruciton) are add-ons to the original instruction set dealing with the new 20 bit address and data range.

    Normal MOV takes only 16 bit addresses and 16 bit data. MOVA allows 20 bit data transfers from 20 bit addresses, CALLA calls a 20 bit address rather a 16 bit address, putting 32 bit return address on stack, and RETA returns to a 32 bit return asddress. All other A instructions can only work register to register, but with 20 bit data. They all fit into a 16 bit isntruciton word.
    The X instructions require an additional extension word that keeps the additional 4 bits for source or destination addresses or 20 bit immediate values. They offer any combination of 20 bit addresses and 8/16/20 bit data sizes (.B, .W and .A dat amodifier). At the expense of 2 more bytes size and one more clock cycle (at least).

    All instrucitons, however, address the very same internal memory area.

**Attention** This is a public forum