- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Labels:
-
PSoC 5LP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.