5 Replies Latest reply on Nov 10, 2012 1:55 PM by user_78878863

    Regarding DMA transfer

    akash.gupta

       In a project , I have configured DMAs TD to transfer 3 bytes of data.

         

      The source is uint8 Temp_Data[0], basically an array of "2" bytes and i am icrementing source address on transfer.

         

      Now is there any problem if mysource is an array less than the no, of bytes to be transferred. 

        • 1. Re: Regarding DMA transfer
          user_1377889

          As long as the DMA reads from source there will be no error when reading behind a defined variable, althoug the result might be unpredictable.

             

           

             

          Bob 

          • 2. Re: Regarding DMA transfer
            kishore.kumar
            AkashGupta
               

            Why do configure your TD to transfer 3 bytes of data when the size of array declared is just 2? For DMA, just the starting address pointer is important. It will just keep of incrementing the source pointer and transfer the content in it as configured.

            • 3. Re: Regarding DMA transfer
              akash.gupta

               The question was I have configured an array of 2 bytes and trying to transfer 3 bytes from this array. So wil there be any problem for the DMA . I know it doesn't as the array address will just represent some location in SRAM and as the address increments DMA will take data from that location and transfers until it is done with the transfer.

                 

              I am not finding any problem but just the received byte is junk

              • 4. Re: Regarding DMA transfer
                akash.gupta

                 The question was I have configured an array of 2 bytes and trying to transfer 3 bytes from this array. So wil there be any problem for the DMA . I know it doesn't as the array address will just represent some location in SRAM and as the address increments DMA will take data from that location and transfers until it is done with the transfer.

                   

                I am not finding any problem but just the received byte is junk

                • 5. Re: Regarding DMA transfer
                  user_78878863

                  The DMA unit doesn't care, and doesn't even know, about your array definition. It just does know about RAM (or flash, or other types of where it can read and write stuff from and to), and just does what you tell it to do.

                     

                  So when you array is only 2 elements large, and you tell the DMA to transfer 3 bytes, it will happily do what you say, and transfer the byte directly behind your array from memory. It most likely will be garbage, since the compiler normally aligns all variables on a 4 or 8 byte addresses.