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.

MSP430FR5969: best resource for adc->dma->fram

Part Number: MSP430FR5969
Other Parts Discussed in Thread: ENERGIA

I'm wondering if there is example code for an acquisition with a controllable number of samples from the adc12 then storing the data into FRAM memory via DMA. I've been piecing it together from multiple other examples but half the syntax doesn't work with my energia project and importing the required headers isn't working for some reason.

I'd prefer a project I can pull directly from the resource explorer if one exists for a different msp430. Does this adc->dma->fram example exist anywhere?

Thank you.

  • This program started life as TI example MSP430F55xx_dma_04.c, and required relatively few changes. It writes to SRAM, not FRAM. Writing to FRAM instead is a small program change, but requires understanding the Memory Protection Unit (MPU). I suggest you try this first.

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    ///
    // FR5969 ADC12->DMA demo
    // Started life as TI example MSP430F55xx_dma_04.c
    //
    #include <msp430.h>
    #include <stdint.h>
    #define DEMO_5969 1 // Specifics for FR5969 and/or Launchpad
    unsigned int DMA_DST; // ADC conversion result is stored in this variable
    int main(void)
    {
    WDTCTL = WDTPW+WDTHOLD; // Hold WDT
    P1OUT &= ~BIT0; // P1.0 clear
    P1DIR |= BIT0; // P1.0 output
    #if DEMO_5969 // FR5969 Launchpad
    P1SEL0 |= BIT2; // P1.2 as A2 per
    P1SEL1 |= BIT2; // SLAS704F Table 6-49
    PM5CTL0 &= ~LOCKLPM5; // Needed for FR5969, not for F5529
    #else // Original for F5529
    P5SEL |= BIT7; // P5.7/TB1 option select
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    [Edit: For reference, the original is here:

    https://dev.ti.com/tirex/explore/node?node=ALkqBIa6R80LFOC7XAng.Q__IOGqZri__LATEST

    ]

  • Hi,

    There are ADC and DMA academies which can help you on the coding. You can refer to the following link. 

    https://dev.ti.com/tirex/explore/node?node=AKzqA0IGyLAD2nwRN2jyTA__IOGqZri__LATEST

    https://dev.ti.com/tirex/explore/node?node=AJAJEjm2KsURl3nLMsYpVw__IOGqZri__LATEST

    Best regards,

    Cash Hao

  • Thank you for that clue. I ended up needing to disable the MPU to get anything read back out of the FRAM. This probably isn't the right way to do this, which is why I was hoping there was a provided example.

  • Did you succeed with the SRAM version (above)?

    CCS has a fairly handy MPU configurator in the Build-Settings->General->MPU tab. You'll probably want to declare your FRAM buffers as PERSISTENT so they're put in a predictable area of FRAM (down at the bottom).

  • I didn't try the SRAM version as I need FRAM since eventually the data needs to survive a power cycle.

    The MPU tab is where I disabled the MPU. The 'Let compiler handle memory...' checkbox is on and the data can't be read from FRAM at the locations I've tried. I plan to manually specify the memory after working out the rest of the program details.

    Unless that 'Let compiler handle memory...' checkbox needs the PERSISTENT flag and some associated code to work that isn't included in the Ti examples I've been working from?

  • I don't know if the MPU tab takes into account the size of the TI.persistent section, since I always came at it from the opposite direction. Try it. The .map file is usually a big help.

    More generally: I think you're beyond the scope of the TI examples (I had to work over that example to provide something), so you may need to do some experiments.

**Attention** This is a public forum