Skip to main content
PHolt.1
Senior
June 11, 2026
Question

Bytewide DMA to a port: RAM to PD8-PD15, with a timer PWM used to generate /WR signal

  • June 11, 2026
  • 6 replies
  • 125 views

Bytewide DMA to a port: RAM to PD8-PD15, with a timer PWM used to generate /WR signal.

I wonder if this will work. Some of it is a grey area. This is for loading a buffer into a ST7789 LCD controller, 66ns shortest cycle time.

TIM1 and DMA1 are already used in my project.

Digging around, it looks like TIM8 -> DMA2 should work, and a byte write to ODR+1 should land in ODR[15:8] and drive PD8-PD15.

It also looks like PC6-8 can be used for the PWM output to produce the /WR. The timer overflow loads the next byte, so you have to load the 1st byte manually.

There are some gotchas with spurious TIM behaviour. People found that with TIM8_UP, when you enable the timer, if the UGEN (update generation) bit or the initial configuration causes an immediate update event, you can get a spurious first trigger. You may have to set the UDIS bit or clear the update flag carefully, or use the ARPE/preload setup so the first genuine overflow is the first DMA trigger. One methid is after configuring TIM8 but before enabling the DMA request, set the UG bit (EGR.UG) to force a known update that loads the preload registers, then clear the update flag (SR.UIF), then enable the DMA request (DIER.UDE), then enable the counter.

The biggest question mark is the ODR+1 and byte write aspect. I also don't want to write stuff to PD0-PD7 since some of those are outputs.

DMA to BSRR would need a specially loaded source buffer, not just the data bytes.

Is the above feasible?

6 replies

PHolt.1
PHolt.1Author
Senior
June 16, 2026

Any comments on this question?

 

Richard Li
Senior
June 17, 2026

Yes, this is grey area, in datasheet, ST only noticed, “Addressing AHB peripherals not supporting byte/half-word write transfers”

The GPIO is use AHB, it noticed, will send to address 0.

You can try first/

PHolt.1
PHolt.1Author
Senior
June 17, 2026

Where is this data sheet and what does it say?

The English is not possible to understand :)

I did a google on the exact phrase and it appears in many places, e.g.

but that is for 32Lxxx not 32Fxxx.

Also the phrase does not appear in RM0090 (32F4xx).

Richard Li
Senior
June 17, 2026

I used G474, it in: RM0440 12.4.6.

(I don’t know which chip you used, if you use F4 series, both Cortex-m4)

I guess, it meaning, if you use byte write, only allow write to PD0-7.

You can write code try first.

MasterT
Lead II
June 17, 2026

Likely you are updating LCD in a burst mode, anyway there is a video-buffer somewhere in your code. Use union to have access to buffer in int8_t [ 2x N ] or int16_t  [ N ] mode.

Than read current state PD0-PD7 byte wide, right before burst transaction happened, or before you are updating video-buffer and and prefill  each second elements with current PD0-PD7 . After that, DMA stream as always, 16 -bits HALFWORD.

Overwriting GPIO to the same state should not generate any glitches.

 

PHolt.1
PHolt.1Author
Senior
June 18, 2026

It does work, even though it was quite fiddly. With Claude I managed to get it done in 1/10 of the time it would have taken otherwise; it seems to know the 1000 page RM pretty well :) Details posted here:

https://www.eevblog.com/forum/microcontrollers/32f4xx-any-way-to-output-with-dma-to-non-fsmc-ports-and-get-a-wr-strobe/msg6289524/#msg6289524