cancel
Showing results for 
Search instead for 
Did you mean: 

Trigger I2C DMA RX transfer with LPTIM1 at each (1/200)s

YB.1
Associate

Hi,

What I want is mostly in the title, but I'm confused on how to configure LPTIM1.

This is the STM32CubeIDE config of LPTIM1 :

0693W00000D0vwJQAR.png1) I'm not sure I understand why I can't set the autoreload value (which the reference manual states is a 16-bit register) in STM32CubeIDE? Why is the option "period" not present? Is there even an option to have an autoreload on LPTIM1 so that we can further divide the clock? Or is it only with the prescaler field? Is it a limitation of STM32CubeIDE (basically can we set the autoreload register manually with HAL_* functions)? I would ideally like to generate 200Hz from the 32kHz clock source I use for LPTIM1 (option "Count internal clock events"?)?

For example, in my case, I use for LPTIM1 the LSI clock which runs at 32kHz.

If I prescale at 32, I would (I guess) get a 1kHz clock from LPTIM1?

Suppose I use I2C1_TX to generate a DMA request, configure it to synchronize on LPTIM1 (rising edge), and set the "Request Number" field to 5 (to divide 1kHz -> 200Hz). Is it all, do I need to set something special on LPTIM1? Like do I need to set it to "waveform generation" in STM32CubeIDE?

Basically, what I don't understand here is how do I get LPTIM1 to sort of generate a "square wave signal" (sort of) that will be fed to the DMAMUX so that the DMA transfers indeed happen each (1/200) sec.

2) At each (1/200) sec. I need to first generate a I2C1_TX DMA request, and then generate a I2C1_RX DMA request right after the I2C1_TX DMA request. Can I chain the DMA requests (without ever using the CPU) in order for the I2C1_RX request to be generated right after the I2C1_TX request?

Thanks! :)

0 REPLIES 0