2024-07-07 10:43 PM
Hi there,
Iam using STM32F407ZGT6 controller, and we're interfacing DAC (MCP4902) with SPI2 and SPI2 is connected to DMA1.
I need to transfer data in a circular mode using DMA1 to DAC using SPI, i have gone through the reference manual only TIM1 and TIM8 are the advance timers and having PWM mode and it is connected to DMA2.
Here iam toggling cs pin and need to transfer data with this function TIM_DMACmd(TIM8, TIM_DMA_Update, ENABLE); without enabling this SPI_I2S_DMACmd(SPI2, SPI_I2S_DMAReq_Tx, ENABLE);
Can you please suggest me how Timer Trigger DMA for SPI 2 can be configured.
2024-07-08 03:31 AM - edited 2024-07-08 03:32 AM
You don't need TIM1/TIM8 for that. DMA1 Streams (possibly triggered by timers on APB1) can write on their Peripheral port to peripherals at APB1, such as SPI2.
The usual limitation what you may have in mind is, that DMA1 cannot write to GPIO.
JW
2024-07-08 05:24 AM - edited 2024-07-08 05:26 AM
Could you please help me on this.
Do you have any specific example on spi tx transfer with DMA timer request transfer for stm32f407 standard peripheral library.
iam using SPI-2 here i dont know which timer can support timer request transfer.
2024-07-08 06:48 AM
> Do you have any specific example
No. It is not any different from any DMA example, if you set properly the DMA pointer registers.
I don't use SPL. It's been deprecated by ST for around 10 years now...
JW
2024-07-08 09:17 PM
please find the code can i know where exactly going wrong ?
2024-07-08 09:18 PM
i have to transfer buffer without enabling SPI_I2S_DMACmd(SPI2, SPI_I2S_DMAReq_Tx, ENABLE);
but in my case spi is working when this function " SPI_I2S_DMACmd(SPI2, SPI_I2S_DMAReq_Tx, ENABLE);"
is calling .
2024-07-09 12:06 AM
> (DMA1_Stream4 for SPI2 TX)
No.
It's the trigger source - here, TIM3_UP - which determines the selection of DMA Stream (and Channel), so you have to use DMA1_Stream2 with Channel5.
JW
2024-07-09 02:01 AM
modified as per your comment but still not working
2024-07-09 03:03 AM - edited 2024-07-09 03:03 AM
> still not working
What does that mean? No output on SPI pins whatsoever?
I don't use SPL so don't quite understand your code (nor am I willing to study it in depth).
Read out and check/post relevant TIM, DMA and SPI registers content.
JW
2024-07-09 03:20 AM
Yes SPI is not working no signals on SPI..
or please check who can have knowledge on SPL in your team.
Thanks for the help..