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.

CCS/MSP430FR5994: Load the 20 bit DMS register with right (not wrong) value

Part Number: MSP430FR5994

Tool/software: Code Composer Studio

Hello,

I use for load the 20 bit DMA address register with this command: __data20_write_long.

The view shows the worng values in the DMA0SA and DMS0DA registers. The highest 4 bits are not loaded. Could you send my an sample with a working command without a warning?

Best regards
Hardy

  • Hi Hardy,

    See if this example helps.

    From: TI resource explorer FR5994 example code

    #include <msp430.h>
    #include <stdint.h>

    int main(void)
    {
        WDTCTL = WDTPW | WDTHOLD;               // Stop WDT

        // Configure GPIO
        P1OUT = 0;
        P1DIR = BIT0;                           // For LED

        // Disable the GPIO power-on default high-impedance mode to activate
        // previously configured port settings
        PM5CTL0 &= ~LOCKLPM5;

        // Configure DMA channel 0
        __data20_write_long((uintptr_t) &DMA0SA,(uintptr_t) 0x1C20);
                                                // Source block address
        __data20_write_long((uintptr_t) &DMA0DA,(uintptr_t) 0x1C40);
                                                // 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
        }
    }

  • Hello,

    the line"#include <stdint.h>" was importand.
    I copied the lines for loading the DMASA and DMADA into my program. The compile prozess ends without error messages. In runtime I saw in the debugger that the higest part of the registers was not loadet.
    Have I to do some changes in project properties for use this code?

    Regards
    Hardy

  • Hello Hardy,

    Try substituting  __data16_write_addr for __data20_write_long.

        __data16_write_addr(&DMA0SA, source);

        __data16_write_addr(&DMA0DA, destination);

  • Hello,

    thank you for this answer.
    The problem was to load the 20 bit destination and source address register with a value. The value can by only a long value if I work with the memory part above &FFFF.

    Could you write what have I to import for using this functions? I tried with intrinsics.h and stdint.h. Both not inluded this functions.

    intrinsics.h I found in www.ti.com/.../slau132r.pdf

    Regards
    Hardy

  • Hi Hardy,

    I'm using CCS 10 with compiler version TI v20.2.1.LTS.  These should be defined in your instrinsics.h.  They are in the version I have.

    Check the latest version of the compiler guide.

    #if defined(__MSP430X__)
    /*---------------------------------------------------------------------------*/
    /* MSP430X Intrinsics                                                        */
    /*---------------------------------------------------------------------------*/
    void           __data16_write_addr(unsigned short, unsigned long);
    unsigned long  __data16_read_addr(unsigned short);
    void           __data20_write_char(unsigned long, unsigned char);
    void           __data20_write_short(unsigned long, unsigned short);
    void           __data20_write_long(unsigned long, unsigned long);
    unsigned char  __data20_read_char(unsigned long);
    unsigned short __data20_read_short(unsigned long);
    unsigned long  __data20_read_long(unsigned long);

    #endif

  • Hello,

    thank you for the commands.

    I think the best choice is to use the "__data20_write_long(unsigned long, unsigned long);" for loading the 20 bit DMA registers with a limited long value.

    The picture shows the situation. The values are 0x4200A and 0x420C6. But after the load command the "4" in the higest 4 bits is missing.

    What can I do to load the complete address into the registers without a warning of the compiler?

    Regards
    Hardy

  • Hi Hardy,

    Our software team is saying you have to use, else if won't work.

    void           __data20_write_short(unsigned long, unsigned short);
    void           __data20_write_long(unsigned long, unsigned long);

  • Hardy Zissel said:
    he values are 0x4200A and 0x420C6. But after the load command the "4" in the higest 4 bits is missing.

    For the disassembly shown in the screen capture I can't see any errors with the generated instructions - they look to be writing 20 bits to the DMA0SA and DMA0DA registers.

    It you look in the Memory Browser at address 0x0510 (the base address for the DMA channel 0 registers) what is shown?

  • Is it important to do some settings or other imports as intrinsics?

    Unfortunately, the sample from your post before (with the 2 commands) doesn't work for me. Can you send me a sample code so I can see the values in the registers?

    Best Regards
    Hardy

  • Hi Hardy,

    Are still stuck or have you been able to get everything working?

  • Unfortunately the examples shown do not work. It runs with other notations with warnings from the compiler. I'm not comfortable with that. I'm not sure if the compiler generates a stable code with every new compilation.

    Regards
    Hardy

  • Hi Hardy,

    It's been a few days since I have heard from you so I’m assuming you were able to resolve your issue.
    If this isn’t the case, please click the "This did NOT resolve my issue" button and reply to this thread with more information.
    If this thread locks, please click the "Ask a related question" button and in the new thread describe the current status of your issue and any additional details you may have to assist us in helping to solve your issues.