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.

MSP430F5659: How to transfer data to a 20-bit address using DMA

Part Number: MSP430F5659


Hi experts,

Could you tell me how to transfer data to a 20-bit address using DMA on MSP430F5x?

I was able to write 0x14000 and 0x14020 to DMAxSA and DMAxDA, but the data is not being transferred properly.

[Check details]
I did some experiments in the following environment referring to the original thread.

Pattern 1 2 3
.c __data20_write_long((uintptr_t) &DMA0SA,(uintptr_t) 0x14000);
__data20_write_long((uintptr_t) &DMA0DA,(uintptr_t) 0x14020);
__data20_write_long((unsigned long) &DMA0SA,(unsigned long) 0x14000);
__data20_write_long((unsigned long) &DMA0DA,(unsigned long) 0x14020);
__data16_write_addr((uintptr_t) &DMA0SA,(uintptr_t) 0x14000);
__data16_write_addr((uintptr_t) &DMA0DA,(uintptr_t) 0x14020);
.asm MOVX.A #DMA0SA+0,r15
MOV.W #7168,0(r15)
MOV.W #0,2(r15)

MOVX.A #DMA0DA+0,r15
MOV.W #7200,0(r15)
MOV.W #0,2(r15)
MOVX.A #DMA0SA+0,r15
MOV.W #16384,0(r15)
MOV.W #1,2(r15)

MOVX.A #DMA0DA+0,r15
MOV.W #16416,0(r15)
MOV.W #1,2(r15)
MOV.W #DMA0SA+0,r15
MOVX.A #0x14000,0(r15)

MOV.W #DMA0DA+0,r15
MOVX.A #0x14020,0(r15)
Result

DMA0SA=0x04000
DMA0DA=0x04020

DMA0SA=0x04000
DMA0DA=0x04020
DMA0SA=0x14000
DMA0DA=0x14020

The only correct register setting is pattern3. However, the data at 0x14000 will not be transferred to 0x14020. Also, what is puzzling is that patterns1 and 2 output "MOVX.A" when checked in the .asm file, but when checked in Disassembly, the output changes to "MOVA".

I would appreciate it if you could point out any mistakes in the settings or descriptions.

Best regards,
O.H

  • For some addressing modes including the one you show, the MOVA encoding is shorter than MOVX.A. The assembler naturally chose MOVA when presented with a MOVX.A opcode with suitable operands.

    As for your constant addresses such as 0x14000, try writing them as 0x14000L so they don't get truncated to 16 bit ints.

  • Hi David Schultz,

    Sorry for the late reply. I tried your suggestion on the above program, but the result was the same.

    Best regards,
    O.H

  • I didn't notice before but it appears that you are attempting to write to flash using DMA. That will never work well.

  • Hi David Schultz,

    My apologies. You're right.

    I prepared the F5659 and tested the transfer to RAM with DMA. It worked fine using the following code.

    #include <msp430.h>
    #include <stdint.h>
    
    int main(void)
    {
      WDTCTL = WDTPW|WDTHOLD;                   // Stop WDT
      P1DIR |= 0x01;                            // P1.0 output
    
      //20bit
      __data16_write_addr((uintptr_t) &DMA0SA,(uintptr_t) 0xF0000L);
                                                // Source block address
      __data16_write_addr((uintptr_t) &DMA0DA,(uintptr_t) 0xF0020L);
                                                // Destination single address
    
      DMA0SZ = 16;                              // Block size
      DMA0CTL = DMADT_5|DMASRCINCR_3|DMADSTINCR_3; // Rpt, inc
      DMA0CTL |= DMAEN;                         // Enable DMA0
    
      while(1)
      {
        P1OUT |= 0x01;                          // P1.0 = 1, LED on
        DMA0CTL |= DMAREQ;                      // Trigger block transfer
        P1OUT &= ~0x01;                         // P1.0 = 0, LED off
      }
    }

    Please let me know if there is any fatal problem in the way it is written.

    Thanks for your support.

    Best regards,
    O.H

  • Hi O.H

    I t seems that your question have been resolved?

    Thanks!

    Best Regards

    Johnson

**Attention** This is a public forum