Skip to main content
Guillaume FERLIN
Associate II
October 9, 2017
Question

Change SPI baud rate on the fly: issue with DMA

  • October 9, 2017
  • 1 reply
  • 3508 views
Posted on October 09, 2017 at 11:04

Hi,

I am using SPI1 peripheral as master at 16 MHz on STM32L443, I can send and receive data correctly using DMA.

My application requires to speed down SPI to 1MHz during a moment so I changed SPI baud rate on the fly (by writing SPI_CR1 register). Using SPI polling API this is working fine but using DMA I noticed that SPI speed is still 16MHz.

I tried to:

- DeInit()/Init() DMA configuration

- Relink DMA to SPI

- DeInit()/Init() SPI with new baud rate

but result is the same.

For some reason it looks like first SPI configuration is permanent for DMA.

Did I miss something to reconfigure?

Thanks,

#dma #spi #baud-rate
This topic has been closed for replies.

1 reply

waclawek.jan
Super User
October 9, 2017
Posted on October 09, 2017 at 11:16

Read out the SPI  registers before and after the change and compare (or post them).

JW

Guillaume FERLIN
Associate II
October 9, 2017
Posted on October 09, 2017 at 11:36

Only BR field from CR1 has changed, the register value changed from 0x0000034C to 0x0000036C. It looks consistent to change from prescaler 4 to 64.

waclawek.jan
Super User
October 9, 2017
Posted on October 09, 2017 at 11:47

And after this change, you see increase on the SPI clock  from 16MHz to 20MHz?

How exactly do you observe the respective SPIx_SCK pin? Which pin is it?

JW