AnsweredAssumed Answered

DMA normal buffer

Question asked by das.sanjib on Mar 13, 2015
Latest reply on Mar 24, 2015 by Clive One
Hi

I have attached a piece of code in which DMA is configures as circular buffer. I have configured a total buffer complete interrupt. when I get into the interrupt I want to change the BUFF_SIZE In data shet it is mentioned that before doing we have to disable the stream. I am doing exactly the same  but when I give a break point  in case 1 value it always posses the value in the BUFF_SIZE which is initialized before for e.g if BUFF_SIZE while prior initialization  is initialized to 240(value = 204)  anf the total buffer complete interrupt occurs in case 0 I initialized the BUFF_SIZE to 120(value = 103)  again but when I give a break point at value = DAC->DHR12R1. it always have the 204 ehich was initialized before what is the problem. One more thing is I want to configure as normal buffer not a circular one I mean I want to update the MOAR register too how to do that Please help

for your reference I have paste the code below

void DMA1_Stream5_IRQHandler(void)
{

  if(DMA_GetITStatus(DMA1_Stream5, DMA_IT_TCIF5))
    {
        DMA_ClearITPendingBit(DMA1_Stream5, DMA_IT_TCIF5);
    

          switch(index)
          {
          case 0:
              DMA1_Stream5->CR &= ~0x00000001;  // disabling the stream          
        
              DMA1_Stream5->M0AR = (uint32_t)& aSine12bit;

        
              DMA1_Stream5->NDTR = 160;           
             DMA1_Stream5->CR |= 0x00000001; //enabling the stream    

              index ++;
              break;
          case 1:
                       value = DAC->DHR12R1;
                       DMA1_Stream5->CR &= ~0x00000001;            // disabling the stream
              

                     DMA1_Stream5->M0AR = (uint32_t)& aSine12bit;
                     DMA1_Stream5->NDTR = 120;           
                      DMA1_Stream5->CR |= 0x00000001;     //enabling the stream
               



                   index ++;
                      break;
          case 2:
            
                 if ( flag_onetime == 1)

              {

               DMA1_Stream5->CR &= ~0x00000001;            // disabling the stream

               DMA1_Stream5->M0AR = (uint32_t)& aSine12bit;

               DMA1_Stream5->NDTR = 240;            /
               DMA1_Stream5->CR |= 0x00000001;     //enabling the stream
               flag_onetime = 0;
              }
          break;

          }

    }


  }




Outcomes