Skip to main content
Visitor II
November 11, 2025
Question

STM32H7 DMA1

  • November 11, 2025
  • 7 replies
  • 354 views
 

Good day!

I use TIM15 and DMA1, channel 5 in STM32H743. If DMA and data have a size of 32-bit, then everything works fine. If you configure DMA on 16-bit data, then 32-bit data is still written to the TIM5 registers.

In order to save memory, I want to write 16-bit values ​​to the timer. In the documentation I read that DMA1 works only in 32-bit data mode.

Is there any way to force DMA1 to transfer data to the timer in 16-bit mode, or even better in 8-bit?


Andrey.

    This topic has been closed for replies.

    7 replies

    Super User
    November 11, 2025

    Hi,

    so you want write 16b to a timer register ? 

    And you set data and destination to 16b ?

    AScha3_0-1762892521881.png

    then..?

    Super User
    November 11, 2025

    This won't work and you cannot save memory, the data for TIM5 have to be 32-bit.

    DMA1 is a dual-port DMA (i.e. the same as in'F2/'F4/'F7), and does not zero-extend the data. It means, that if you set it to 16-bit at the memory side and 32-bit at peripheral side, it will assemble (concatenate) two halfwords from memory to a word tp output to the timer. If you set 16-bit at both memory and peripheral side, it will indeed write only 16 bits onto the AHB bus towards TIM5, but the AHB/APB bridge will copy the lower 16 bits to the upper 16 bits and both halves will be written to the timer.

    At least this is what happens in 'F4; I don't use the'H7. Try.

    JW

    Super User
    November 11, 2025

    @waclawek.jan  , 

    but Tim15 is 16b timer, so register with 16b write should work - or not ?

    AScha3_0-1762897816961.png

     

    Super User
    November 11, 2025

    For TIM15 yes, but OP mentioned both TIM15 and TIM5.

    JW

    Super User
    November 13, 2025

    > When I write a 16-bit value to TIM15 using DMA1 in HalfWord mode, a 32-bit value consisting of two 16-bit values ​​is written to the register.

    So, do you work with TIM5 or TIM15?

    If TIM15, then question is, which register are you trying to write to, as TIM15 is a 16-bit timer. 

     

    > While studying the manual, I found a note that says the AHB bus only works in 32-bit format.

    waclawekjan_0-1763044980641.png

    This is not related to your problem. This says, that DMA's registers can't be accessed in other than 32-bit way, i.e. the processor has to write DMA's registers only using instructions with 32 bit data; this does not say, how DMA accesses other peripherals.

     

    > I'd like to know if it's possible to preserve memory and send 16-bit values ​​(ideally 8-bit) to the timer instead of 32-bit values?

    No, it is not possible.

    JW

    marseneyAuthor
    Visitor II
    November 13, 2025

    Thanks for the reply. I'm working with TIM15. I'm writing three register values ​​(ARR, RCR, CCR1) to the DMAR register.

    Super User
    November 13, 2025

    And what effect do you observe due to the "lower halfword duplicated to upper halfword"?

    Can you please post the read-out content of those registers after such write occured?

    JW

    marseneyAuthor
    Visitor II
    November 14, 2025

    Thanks for your help. I figured out the problem. The peripheral register size was incorrectly specified (32 bits instead of 16 bits) and the RCR register value for timer 15 was incorrect.

    Andrey.