Tool/software: Code Composer Studio
Hello!
Given:
1. CCS 9.0.1/CCS 9.3, pdk_am57xx_1_0_16
2. JTAG emulator: XDS220 ISO
3. Windows 7
4. AM5728, ARM frequency - 1.5 GHz
5. Pulse generator 100KHz
6. TI-RTOS
There is a code:
/* XDCtools Header files */
#include <xdc/std.h>
#include <xdc/runtime/System.h>
#include <xdc/runtime/Error.h>
/* BIOS Header files */
#include <ti/sysbios/BIOS.h>
#include <ti/sysbios/knl/Task.h>
#include <ti/sysbios/hal/Hwi.h>
#include <stdio.h>
#include <string.h>
/* TI-RTOS Header files */
#include <ti/drv/gpio/GPIO.h>
#include <ti/drv/gpio/soc/GPIO_soc.h>
#include <ti/board/board.h>
#include <ti/csl/csl_clec.h>
#include <ti/csl/csl_gpio.h>
#include <ti/csl/example/utils/uart_console/inc/uartConfig.h>
#include <ti/csl/soc.h>
#include <ti/csl/hw_types.h>
/* Callback function */
void AppGpioCallbackFxn();
uint32_t gpio_base_address=CSL_MPU_GPIO2_REGS;
uint32_t gpio_pin[2] = {25, 28};
/*
* ======== main ========
*/
int main(void)
{
Board_initCfg boardCfg;
boardCfg = BOARD_INIT_PINMUX_CONFIG |
BOARD_INIT_MODULE_CLOCK | //BOARD_INIT_PLL_OPP_HIGH |
BOARD_INIT_UART_STDIO;
Board_init(boardCfg);
/*Enable GPIO clock*/
HW_WR_REG32(CSL_MPU_L4PER_CM_CORE_REGS+CSL_L4PER_CM_CORE_COMPONENT_CM_L4PER_GPIO2_CLKCTRL_REG,0x102);
while ((HW_RD_REG32(CSL_MPU_L4PER_CM_CORE_REGS+CSL_L4PER_CM_CORE_COMPONENT_CM_L4PER_GPIO2_CLKCTRL_REG) & (0x00030000U)) != 0x0)
{
;
}
/*Reset GPIO*/
GPIOModuleReset(gpio_base_address);
/*Enable GPIO*/
GPIOModuleEnable(gpio_base_address);
GPIOIntTypeSet(gpio_base_address, gpio_pin[0], GPIO_INT_TYPE_RISE_EDGE);
/*Set pin direction*/
GPIODirModeSet(gpio_base_address, gpio_pin[0], GPIO_DIR_INPUT); //25 - input
GPIODirModeSet(gpio_base_address, gpio_pin[1], GPIO_DIR_OUTPUT); //28 - output
/*Clear interrupt*/
GPIOPinIntDisable(gpio_base_address, GPIO_INT_LINE_1, gpio_pin[0]);
GPIOPinIntClear(gpio_base_address, GPIO_INT_LINE_1, gpio_pin[0]);
/*Enable interrupt*/
GPIOPinIntEnable(gpio_base_address, GPIO_INT_LINE_1, gpio_pin[0]);
Hwi_Params hwiParams;
Hwi_Handle hwiHandle;
Error_Block eb;
Hwi_Params_init(&hwiParams);
Error_init(&eb);
hwiParams.eventId = 62; //MPU_IRQ_30(ID62)25 (MPU_IRQ_30 (ID62) 25 CTRL_CORE_MPU_IRQ_30_31[8:0] 25 GPIO2_IRQ_1 - AM572x TRM on page 4120)
hwiParams.arg = 0;
hwiParams.maskSetting = Hwi_MaskingOption_SELF;
hwiParams.enableInt = FALSE;
hwiHandle = Hwi_create(62, AppGpioCallbackFxn, &hwiParams, &eb);
if (hwiHandle == NULL) {
System_abort("Hwi create failed\n");
}
Hwi_enable();
Hwi_enableInterrupt(62);
/* Start BIOS */
BIOS_start();
return (0);
}
void AppGpioCallbackFxn()
{
// GPIOPinWrite(gpio_base_address, gpio_pin[1], GPIO_PIN_HIGH);
*(Uint32 *)0x48055194 = (Uint32)0x10000000;
/*Disable interrupt*/
// GPIOPinIntDisable(gpio_base_address, GPIO_INT_LINE_1, gpio_pin[0]);
// GPIOPinIntClear(gpio_base_address, GPIO_INT_LINE_1, gpio_pin[0]);
*(Uint32 *)0x4805502CU = (Uint32)(0x02000000);
/*Enable interrupt*/
//GPIOPinIntEnable(gpio_base_address, GPIO_INT_LINE_1, gpio_pin[0]);
// GPIOPinWrite(gpio_base_address, gpio_pin[1], GPIO_PIN_LOW);
*(Uint32 *)0x48055190 = (Uint32)0x10000000;
}
Screenshot of the oscilloscope runtime code in function AppGpioCallbackFxn.
The blue line is the execution time from setting the pin to GPIO_PIN_HIGH and after removing the pin to GPIO_PIN_LOW.
As you can see, the execution time is 300 ns as seen in the screenshot. How can I reduce code execution time to at least 20-50 nanoseconds? Or is this already the limit of execution, what is impossible to further reduce the execution time?
Thanks!
