madias 0 Posted June 15, 2014 Share Posted June 15, 2014 Hello, after fooling around a little bit, I recognize following driverlib behavior: While I get with this sketch about 450kHz on my oscilloscope #include <stdint.h> #include <stdbool.h> #define PART_TM4C123GH6PM #include "inc/tm4c123gh6pm.h" #include "driverlib/gpio.h" byte running=1; void setup() { GPIOPadConfigSet(GPIO_PORTA_BASE, 0xff, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD); GPIODirModeSet (GPIO_PORTA_BASE, 255, GPIO_DIR_MODE_OUT); } void loop() { while(1) { running=!running; GPIOPinWrite(GPIO_PORTA_BASE,128,running<<7); }} ...I'll get only 176kHz with the ROM_ equivalent: #include <stdint.h> #include <stdbool.h> #define PART_TM4C123GH6PM #include "inc/tm4c123gh6pm.h" #include "driverlib/gpio.h" byte running=1; void setup() { ROM_GPIOPadConfigSet(GPIO_PORTA_BASE, 0xff, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD); ROM_GPIODirModeSet (GPIO_PORTA_BASE, 255, GPIO_DIR_MODE_OUT); } void loop() { while(1) { running=!running; ROM_GPIOPinWrite(GPIO_PORTA_BASE,128,running<<7); } } Does anyone have any idea why is that? Remember, that all energia stuff is related to the ROM_* commands (like wiring_digital.c) Quote Link to post Share on other sites
madias 0 Posted June 15, 2014 Author Share Posted June 15, 2014 Ok, it seems, that my DS201 is out of range for this measure, can someone check this two codes out with "real equipment"? Meanwhile I've stripped the code down to complete low level: (Measuring pin is PA7) #include <stdint.h> #include <stdbool.h> #include "inc/hw_gpio.h" #define PART_TM4C123GH6PM #include "inc/tm4c123gh6pm.h" #include "driverlib/gpio.h" byte running=1; void setup() { GPIOPadConfigSet(GPIO_PORTA_BASE, 0xff, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD); GPIODirModeSet (GPIO_PORTA_BASE, 255, GPIO_DIR_MODE_OUT); } void loop() { while(1) { running=!running; HWREG(0x40004200)=running<<7; } } Quote Link to post Share on other sites
pabigot 355 Posted June 16, 2014 Share Posted June 16, 2014 This thread shows how to measure the duration of a code sequence using the cycle timer. That's probably the best solution for comparisons like this: read the cycle counter, run the loop for N iterations, then read it again and figure out the speed. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.