TIM1+DMA Driven GPIO transmit speed limit
I am using STM32F407ZGT6 and configured the TIM1_CH1 to trigger DMA2 to transmit data through GPIO. Since the protocol is using both raising and failing edges, I need to control both data pins and the clock pin. So the TIM1 is just generating PWM signals without output. I have put all pins in GPIOC so I can use a half-word data width on both MSIZE and PSIZE to directly control both data pins and the clock pin.
The target clock frequency is about 5 MHz, so I need to transmit data from SRAM to the GPIO peripheral every 50ns like:
GPIOC->ODR = tmpodr[0];
GPIOC->ODR = tmpodr[0]|CLK_Pin;
GPIOC->ODR = tmpodr[1]|CLK_Pin;
GPIOC->ODR = tmpdor[1];
GPIOC->ODR = tmpodr[2];
GPIOC->ODR = tmpodr[2]|CLK_Pin;
GPIOC->ODR = tmpodr[3]|CLK_Pin;
GPIOC->ODR = tmpdor[3];it is one cycle.
But what I have got is just about 3.70 MHz from the oscilloscope. After I enabled the FIFO, the maximum is about 4 MHz. And memory burst mode has no effect. I thought it is caused by the bus race since if I do this by CPU, the maximum frequency may up to 7 MHz with for loop unroll. But it is hard to slow down since I cannot exceed the limitation of 5 MHz or the peripheral would not work correctly. And 3.7 Mhz is a bit slow since I hope it works at least 4.5+ MHz. So do you have any suggestion?
