2013-06-02 12:41 PM
I am using the STM32f4 series. My goal to drive an external parallel loaded DAC using data from the internal SRAM. So, I need to update the data on a GPIO port and then toggle a pin connected to the load control signal on the DAC to load the new data for each update.
So, my code looks something like this: GPIOE->BSRRH
= 0x8000;
GPIOE->BSRRL
= 0x8000;
GPIOE->ODR
= DAC0[i]; Everything works and the update speed is roughly 19 MHz. I am using a 12 bit DAC, so I tried combining the ODR and BSRRL commands by making bit 15 the load signal and always high regardless of the rest of the data to save one step. This increased the speed to 21 MHz. I have the core clocked at 168 MHz and the GPIO at 100 MHz speed. Anyone know a way to do this faster? thanks2013-06-02 01:36 PM
You are at 8 clocks per data write cycle, which is at least one read from memory and two writes to IO. There's not much room left then for optimisation.
If you want to squeeze out the last nanosecond, you need to pay attention to all the detail - and you did not provide us enough of that. Also, C is not quite the way to go. Describe what you want to achieve in more detail and post the disassembly of the critical routine. You could also consider using hardware - e.g. DMA transfers to FSMC. JW2013-06-02 05:55 PM
2013-06-03 06:27 AM
This all seems a rather ill conceived solution, for high and consistent rates an FPGA would be the way to go.
If you're willing to play a little with the profile in RAM, I would suspect 42 MHz might be achievable, but still this would likely have a hideous amount of jitter. Some logic externally to convert a toggling signal to a pulse would also mitigate some of the interfacing issues. You might be able to get 56 MHz via a timer in PWM mode generating an output pulse, and also triggering a DMA copy to the GPIO bank's ODRAlso, some people have warned me not to use assembly because it is really tricky to keep track of all the registers that might cause of lock up once you return to C. Like many things, you need a good grasp of what needs to be done, you should perhaps look to some team members with actual and specific knowledge rather than ones without it for technical advice.2013-06-03 08:06 AM
Forgot about jitter. Thanks, I'm trashing the idea for high speeds.