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.

MSP432P401R: DMA controller:

Part Number: MSP432P401R

I am working on implementation of digital filters on MSP432. According to my required specification, I am able to achieve to filter order up to 46. Now, I want to use DMA controller in my project so that I can increase filter order by saving some computational time. I read documents and given questions on forum regarding DMA. As, I have single input for ADC and ''repeat single channel mode for conversion'', how much i have got idea about DMA from reading material that I need only one DMA channel (which I have channel 7 ) but my problem is that I am not able to understand what will be destination folder because before I was feeding that ADC output (MEMO) directly to digital filter.   (following code is a interrupt handler for an interrput of MEM0)

void ADC14_IRQHandler(void)
{
    float AdcInputVoltage;
    float filteredf_output;
    uint16_t Input_filter;
    uint64_t status;

    /* uint16_t AdcInputVoltage;
    uint16_t filtered_output;*/

    status = MAP_ADC14_getEnabledInterruptStatus();
    MAP_ADC14_clearInterruptFlag(status);

    if (status & ADC_INT0)
    {

        Input_filter = MAP_ADC14_getResult(ADC_MEM0);
    }

I have following questions now:

1) what should be destination transfor address ?

2) is it important that DMA channel configuration should be done before triggering the conversion ??

As, I have DAC-DSP_DAC in mr poject , I think the destination should be unit_16t (Input_filter).#

Please refer me to any example with repeat single channel or help me out to understand this confusion. Thanks.

  • 1) The destination should match the width of the transfer. So the ADC is a 14-bit value so 16-bit is the most efficient but you could use 32-bit.
    2) Yes. The ADC will trigger the DMA to move the data from the conversion result register to the data array you have specified.

    e2e.ti.com/.../526735

    e2e.ti.com/.../2023396

    Regards,
    Chris
  • Hi chris,

    What is mean by conversion result register? I had (unit_16 AdcValueDigits ) register for conversion register . I used 32-bit destination folder and it is giving me incompaibility error. What I did, I just initialized DMA and configured it in main code but remaining parameters have defined in interrupt handler of ADC MEM0. For that , I check the data_array(destination register) values and I am getting only single value and remaining all values are zero but I am expecting 512 values according to the sample length which I have defined for data_array(destination register).

    According to my understanding, I just want to move data from ADC MEM0 to DMA and then from DMA to back as my filter input(destination folder).
    Due to my zero background in embedded system ,My biggest confusion is that what is mean by source address and destination address here.
    Please answer my following questions:

    1) As I have repaeat single channel mode of ADC with single Input , what should be the value of arbitration factor ?
    2) how can i assign destination register (data_array) to filter input ??

    ( PLease check the following code and make me correct either it is allowed to do this or not):
    if (status & ADC_INT0)
    {
    /* DMA channel control parameters */
    MAP_DMA_setChannelControl(UDMA_PRI_SELECT | DMA_CH7_ADC14,
    UDMA_SIZE_32 | UDMA_SRC_INC_32 | UDMA_DST_INC_32 | UDMA_ARB_1);
    MAP_DMA_setChannelTransfer(UDMA_PRI_SELECT | DMA_CH7_ADC14,
    UDMA_MODE_AUTO, (void*) &ADC14->MEM[0],
    data_array, 1);

    MAP_DMA_assignInterrupt(DMA_INT1, 7);
    MAP_Interrupt_enableInterrupt(INT_DMA_INT1);
    MAP_DMA_assignChannel(DMA_CH7_ADC14);
    MAP_DMA_clearInterruptFlag(7);
    MAP_Interrupt_enableMaster();


    /* Enable DMA channel*/
    MAP_DMA_enableChannel(7);
    //AdcValueDigits = MAP_ADC14_getResult(ADC_MEM0);
    }
    AdcValueDigits=*((uint16_t*)(&data_array)) ;
    AdcInputVoltage = AdcValueDigits*2.5f/16384.0f;
    filteredf_output = SincFilter(AdcInputVoltage);
  • I would definitely recommend looking at the documentation. The ADC puts the conversion result into the registers ADCMEM0-ADCMEM31 depending upon the configuration. In the API above you specify ADC14->MEM[0] as the source which is the conversion result register.

    The arbitration factor of 1 is ok since there is no other DMA traffic occurring to arbitrate with. The UDMA_MODE_AUTO means that the DMA will transfer information from the source register ADC14->MEM[0] to the destination even if the memory contents of the source have not been updated by the ADC. I would recommend using another mode to ensure that the DMA is triggered with each conversion completion.

    I do not understand the question about filter input. The DMA can only move data from one location to another. Once the data has been moved to an array in memory, then you can perform other computations such as filtering but this would be done with the CPU.

    Finally, in the setChannelTransfer API you set the size to '1' so only one transfer will take place.

    DMA API definitions:
    dev.ti.com/.../group__dma__api.html

    dev.ti.com/.../group__dma__api.html

    ADC+DMA example
    dev.ti.com/.../

    Regards,
    Chris
  • Hi Chris,
    Thank you for your brief explanation. I did in similar way but this approach was not efficient for my project. So, I decided to speed up SPI protocol. For that I have done almost all work but i am not understanding what will be my destination memory location address.

    As, I have MSP432P401 and DAC161S055 working through SPI communication , DMA needs source address and destination address in memory location. I am transferring three bytes data and of 1 byte data in one turn from MSP432 to DAC161S055 and DAC is displaying this data as an output. I have following questions :

    1) I have understaning about my source address memory location but DAC does not have any memory register so what will be destination memory address (correct me, if i am wrong here) ??

    2) And if output data is not being stored in DAC then it should be somewhere in MSP432 memory location but I do not know how to find that memory location address.
  • The destination address would be the SPI transmit register. So similar to the source address you would specify the SPI transmit buffer: &EUSCI_B2_SPI->TXBUF . Please confirm the correct EUSCI instance (A0,A1, B0, B1, etc).

    dev.ti.com/.../

    (1) The SPI communication writes to the DAC. How the DAC operates on the data will be described in the device datasheet. I would assume that there would be some configuration or command bytes and then you would send the data bytes to set the output voltage.

    (2) You would define a variable and store the data there on the MSP432. This would result in the values being stored in SRAM.

    Chris
  • Hi chris,

    Thank you for your reply. I had in my mind that SPI transmit register is my source address but you are right infact it is destination address(read from DAC docs) because after that data will be updated on DAC.

    Now I have fallen into a dig because I am not understanding now then what will be source address .I am transferring 3-bytes data with SPI protocol which is in the form of 1-byte command data (which I have write command beceause this command is needed to update data on DAC) and 2-bytes as processing data. (I described them in my code in a following way):


    SpiTxBuffer[0] = 0x08; // Command to write data on DAC
    SpiTxBuffer[1] = *((uint8_t*)(&DacValueDigits) + 1); // DacValueDigits: it is resulting or processing data(digital values ADC)
    SpiTxBuffer[2] = *((uint8_t*)(&DacValueDigits));

    Please help me to understand following quries:

    1) what will be source memory address??

    2) According to My project requirement and sequence, this SPI protocol is working in the interrupt of ADC(converion completion interrupt for MEM0). Therefore, I am able to send 3-bytes data. As, I know DMA will finish work before SPI will start working (verify me, if I am wrong) . Do you think DMA module should be defined just before SPI in the same interrupt or in the main function ??

    Thank you.

    Note: This is my first project in embedded system. I may ask basic question ,please do not be angry on me. Before posting question here ,I have tried as much as I could.

**Attention** This is a public forum