Part Number: BEAGLEBK
Hi;
I would like to use the AM335x for some hard real time applications where I need to do some speedy number crunching. Before going to RTOS I wanted to check the processing speed to make sure I can achieve the performance I need. I'm using a Beagle Bone Black with an TMS320-XDS100v3 JTAG emulator/debugger in CCS8.2.0.00007
I started with the boot loader program from the StarterWare _02_00_01_01 software package. I modified the boot-loader in a way that it will not load an app but run a small delay loop and a pin toggle directly in the bl_main.
int main(void)
{
/* Configures PLL and DDR controller*/
BlPlatformConfig();
UARTPuts("StarterWare ", -1);
UARTPuts(deviceType, -1);
UARTPuts(" Boot Loader\n\r", -1);
/* Copies application from non-volatile flash memory to RAM */
//ImageCopy();
UARTPuts("Jumping to StarterWare Application...\r\n\n", -1);
/* Do any post-copy config before leaving boot loader */
//BlPlatformConfigPostBoot();
/* Giving control to the application */
//appEntry = (void (*)(void)) entryPoint;
//(*appEntry)( );
/* prepare GPIO for set and reset */
////////////////////////////////////////////////////////////////
/* Enabling functional clocks for GPIO1 instance. */
GPIO1ModuleClkConfig();
/* Selecting GPIO1[23] pin for use. */
GPIO1Pin23PinMuxSetup();
/* Selecting GPIO1[17] pin for use as output */
GPIO1Pin17PinMuxSetup();
/* Enabling the GPIO module. */
GPIOModuleEnable(GPIO_INSTANCE_ADDRESS);
/* Resetting the GPIO module. */
GPIOModuleReset(GPIO_INSTANCE_ADDRESS);
/* Setting the GPIO pins as output pins. */
GPIODirModeSet(GPIO_INSTANCE_ADDRESS,
GPIO_INSTANCE_PIN_NUMBER_LED,
GPIO_DIR_OUTPUT);
GPIODirModeSet(GPIO_INSTANCE_ADDRESS,
GPIO_INSTANCE_PIN_NUMBER_OUT,
GPIO_DIR_OUTPUT);
while(1){
HWREG(0x4804C194) = 0x20000; // set pin high
Delay(0x8000);
HWREG(0x4804C190) = 0x20000; // set pin low
Delay(0x8000);
}
return 0;
}
/*
** A function which is used to generate a delay.
*/
static void Delay(volatile unsigned int count)
{
while(count--);
}
The functionality has been taken from the gpioLEDBlink application. I changed it to use an accessible port pin for toggling and I measure the pin output cycle time with an oscilloscope. What I wanted to estimate is the time needed for one run of the Delay function loop ( while(count--); ). I get a time of 8.7ms for the high or the low phase of the pin. Count is set to 0x8000 which means a single loop step is taking about 265ns. I would assume that this type of loop would be at a maximum 2 processor cycles (maybe even one). However 265ns means about 3.8MHz processor clock or 7.5MHz in case of 2 cycles per loop step. From all I can see the processor is setup for running the ARM core at 1GHz which means the it takes over 260 clock cycles for the operation. This sounds very slow. I understand that the port pin functions are slower but with 0x8000 for the delay loop that additional delay should be insignificant (actually toggling a pin without the Delay function takes about 250ns in my setup).
The question is whether I'm doing something wrong or whether my expectations/ assumptions are wrong? I have used an 200MHz MCU before which is running the same application way faster than this Beagle Bone setup (actually it runs at one clock cycle per loop-step) however I'll need about 4 times the speed for my final application.
Thanks!