cancel
Showing results for 
Search instead for 
Did you mean: 

STM32 DMA behaviour on copying from 8bit peripherial to 16bit memory

kuldeepdhaka9
Associate II
Posted on July 10, 2014 at 16:32

The original post was too long to process during our migration. Please click on the attachment to read the original post.
6 REPLIES 6
Posted on July 11, 2014 at 15:55

I don't use the 'F0 but reading RM0091 I'd say this is the expected behaviour of DMA in the 'F0, when MSIZE is different from PSIZE, regardless of PINC/MINC. In other words, this is the simplest possible DMA model - no FIFO and the transfers are 1:1 - padding the missing bits with 0 (or throwing away unneeded bits, depending on the ratio of sizes and transfer direction).

However, are you sure you can't access the packet memory as 8-bit? IMO the RM is not very clear in this respect. I personally would try MSIZE=PSIZE=8-bit first. If that fails, as plan B, you might perhaps try to transfer data from ADC to the ''regular'' RAM as 8-bit, and in a second step, using a timer-triggered memory-to-packet-memory 16-bit transfer...

JW

Posted on July 11, 2014 at 16:42

Why couldn't you use 16-bit and halve the transfer size? Aren't the bytes just packed in contiguous memory cells?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on July 11, 2014 at 17:09

> Why couldn't you use 16-bit and halve the transfer size? Aren't the bytes just packed in contiguous memory cells?

Well, the RM says something about the packet memory being 16-bit wide (RM0091 rev6, Table 113 on p.844, also on p.848 ''structured as 512 half-wordsby 16 bits'').

However, further reading revealed the comment on p.872, ''The packet memory should be accessed only by byte (8-bit) or half-word (16-bit) accesses.''

Ergo, IMO, MSIZE=PSIZE=8-bit should work.

JW

kuldeepdhaka9
Associate II
Posted on July 11, 2014 at 18:55

The original post was too long to process during our migration. Please click on the provided URL to read the original post. https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I6ff&d=%2Fa%2F0X0000000bss%2FQ8tLUYP8LJbIa4463Nd2SpXN.Iz642HxvbyCJ2nZoS4&asPdf=false
Posted on July 11, 2014 at 19:13

Try to DMA into the ''normal'' RAM first.

JW
kuldeepdhaka9
Associate II
Posted on July 13, 2014 at 06:18

Sorry for the delay. :)

PSIZE = 8, MSIZE = 8, ADC = 8bit,

Channel1 = GND, Channel2 = VDDA

using SRAM (not USB PMA)

(gdb) x /100hx ain0_buffer

0x200001d0 <ain0_buffer>:    0xff00    0xff00    0xff00    0xff00    0xff00    0xff00    0xff00    0xff00

0x200001e0 <ain0_buffer+16>:    0xff00    0xff00    0xff00    0xff00    0xff00    0xff00    0xff00    0xff00

0x200001f0 <ain0_buffer+32>:    0xff00    0xff00    0xff00    0xff00    0xff00    0xff00    0xff00    0xff00

.............................

/**********************************************************************/

PSIZE = 8, MSIZE = 8, ADC = 8bit

Channel1 = VDDA, Channel2 = GND

using SRAM (not USB PMA)

0x200001d0 <ain0_buffer>:    0x00ff    0x00ff    0x00ff    0x00ff    0x00ff    0x00ff    0x00ff    0x00ff

0x200001e0 <ain0_buffer+16>:    0x00ff    0x00ff    0x00ff    0x00ff    0x00ff    0x00ff    0x00ff    0x00ff

0x200001f0 <ain0_buffer+32>:    0x00ff    0x00ff    0x00ff    0x00ff    0x00ff    0x00ff    0x00ff    0x00ff

.............................

/**********************************************************************/

PSIZE = 8, MSIZE = 16, ADC = 8bit

Channel1 = GND, Channel2 = VDDA

using SRAM (not USB PMA)

0x200001d0 <ain0_buffer>:    0x0000    0x00ff    0x0000    0x00ff    0x0000    0x00ff    0x0000    0x00ff

0x200001e0 <ain0_buffer+16>:    0x0000    0x00ff    0x0000    0x00ff    0x0000    0x00ff    0x0000    0x00ff

0x200001f0 <ain0_buffer+32>:    0x0000    0x00ff    0x0000    0x00ff    0x0000    0x00ff    0x0000    0x00ff

0x20000200 <ain0_buffer+48>:    0x0000    0x00ff    0x0000    0x00ff    0x0000    0x00ff    0x0000    0x00ff

.............................

/**********************************************************************/

PSIZE = 8, MSIZE = 16, ADC = 8bit

Channel1 = VDDA, Channel2 = GND

using SRAM (not USB PMA)

(gdb) x /100hx ain0_buffer

0x200001d0 <ain0_buffer>:    0x00ff    0x0000    0x00ff    0x0000    0x00ff    0x0000    0x00ff    0x0000

0x200001e0 <ain0_buffer+16>:    0x00ff    0x0000    0x00ff    0x0000    0x00ff    0x0000    0x00ff    0x0000

0x200001f0 <ain0_buffer+32>:    0x00ff    0x0000    0x00ff    0x0000    0x00ff    0x0000    0x00ff    0x0000

0x20000200 <ain0_buffer+48>:    0x00ff    0x0000    0x00ff    0x0000    0x00ff    0x0000    0x00ff    0x0000

.............................

(gdb) x /100wx ain0_buffer

0x200001d0 <ain0_buffer>:    0x000000ff    0x000000ff    0x000000ff    0x000000ff

0x200001e0 <ain0_buffer+16>:    0x000000ff    0x000000ff    0x000000ff    0x000000ff

0x200001f0 <ain0_buffer+32>:    0x000000ff    0x000000ff    0x000000ff    0x000000ff

0x20000200 <ain0_buffer+48>:    0x000000ff    0x000000ff    0x000000ff    0x000000ff

.............................