Welcome to the Stellaris® ARM® Cortex™-M Microcontroller Section of the TI E2E Support Community. Ask questions, share knowledge, explore ideas, and help solve problems with fellow engineers. To post a question, click on the forum tab then "New Post".
Hi,I am using the EKI-LM3S6965 dev kit (rev D22) and have troubles with generating(fast) output pulses on the GPIO output. The software I am using is the IAR workbench(and the LM Flash programmer).The below test code works ok but the output pulses have a frequency of only 2.5 MHzwhich seems to be very slow. Tried to use the faster AHB bus (commented code) but thisdid not run at all.Some help would be appreciated,Hans Gerritsen// // clock @ 50 MHzSysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_8MHZ);//// // GPIO_PORT_D Pin 2 output// SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD); // switch on D GPIOPinTypeGPIOOutput(GPIO_PORTD_BASE, GPIO_PIN_2); // normal bus // SysCtlGPIOAHBEnable(SYSCTL_PERIPH_GPIOD); // switch on D AHB// GPIOPinTypeGPIOOutput(GPIO_PORTD_AHB_BASE, GPIO_PIN_2); for (i=0; i<100000000; i++) { GPIOPinWrite(GPIO_PORTD_BASE,GPIO_PIN_2,GPIO_PIN_2); GPIOPinWrite(GPIO_PORTD_BASE,GPIO_PIN_2,0x00); // GPIOPinWrite(GPIO_PORTD_AHB_BASE,GPIO_PIN_2,GPIO_PIN_2); // AHB bus// GPIOPinWrite(GPIO_PORTD_AHB_BASE,GPIO_PIN_2,0x00); // AHB bus }
Hi Hans,
There are several forum threads on this topic. See:
Thanks for your suggestions Sue,
Using:
HWREG(GPIO_PORTD_BASE + GPIO_O_DATA + (GPIO_PIN_2 << 2)) = GPIO_PIN_2; HWREG(GPIO_PORTD_BASE + GPIO_O_DATA + (GPIO_PIN_2 << 2)) = 0;
+ compiler optimization resulted in ~70ns output pulses on my (slow) scope.
I still wander what the AHB bus can do to speed up the code. There is very little reference to the AHB bus in the manuals.
Regards,
Hans
I'm glad you made progress. The AHB runs at the same speed as the APB, it just can perform back-to-back accesses more efficiently.
To use the AHB, you have to first assign the port to the AHB using the SysCtlGPIOAHBEnable(SYSCTL_PERIPH_GPIOD) function. After you have done that, you can use the instructions above and substitute GPIO_PORTD_AHB_BASE.
Sue