Other Parts Discussed in Thread: SYSCONFIG
Hi,I want to control main domain gpio in r5f mcu (mcu1_0),I follow the drv document and write the demo to toggle GPIO0_64,but it seem there is no effect,did I miss something?is there any demo of controlling main domain gpios in mcu island? thanks!
here is my code.
In "J721E_pinmux_data.c",I add GPIO0_64 pinmux by sysconfig tools
/* MyGPIO0 -> GPIO0_64 -> AD28 */ { PIN_PRG0_PRU1_GPO1, PIN_MODE(7) | \ ((PIN_PULL_DISABLE | PIN_INPUT_ENABLE) & (~PIN_PULL_DIRECTION)) },
#include <ti/osal/osal.h> #include <ti/drv/gpio/GPIO.h> #include <ti/drv/gpio/soc/GPIO_soc.h> #include <ti/board/board.h> #include "GPIO_log.h" #include <ti/drv/gpio/src/v0/GPIO_v0.h> #define LED0_PORT_NUM (0) #define LED0_PIN_NUM (64) /* ON Board LED pins which are connected to GPIO pins. */ typedef enum { LED0 = 0, }BOARD_LED; #define DELAY_VALUE (500U) /* 500 msec */ /* GPIO Driver board specific pin configuration structure */ GPIO_PinConfig gpioPinConfigs[] = { /* Output pin GPIO0_64*/ GPIO_DEVICE_CONFIG(LED0_PORT_NUM, LED0_PIN_NUM) | GPIO_CFG_OUTPUT }; /* GPIO Driver call back functions */ GPIO_CallbackFxn gpioCallbackFunctions[] = { NULL, }; /* GPIO Driver configuration structure */ GPIO_v0_Config GPIO_v0_config = { gpioPinConfigs, gpioCallbackFunctions, sizeof(gpioPinConfigs) / sizeof(GPIO_PinConfig), sizeof(gpioCallbackFunctions) / sizeof(GPIO_CallbackFxn), 0 }; static void BSP_GPIO_Init(void) { //GPIO_v0_HwAttrs gpio_cfg; //GPIO_socGetInitCfg(LED0_PORT_NUM, &gpio_cfg); //gpio_cfg.baseAddr = CSL_GPIO0_BASE; //gpio_cfg.intCfg->intNum = CSLR_MCU_R5FSS0_CORE0_INTR_MAIN2MCU_LVL_INTRTR0_OUTL_0+LED0_PIN_NUM/16; //GPIO_configIntRouter(LED0_PORT_NUM, LED0_PIN_NUM, 0, &gpio_cfg); //GPIO_socSetInitCfg(LED0_PORT_NUM, &gpio_cfg); GPIO_init(); } static void BSP_Board_Init(void) { Board_initCfg boardCfg; boardCfg = BOARD_INIT_PINMUX_CONFIG | /* enable pinmux */ BOARD_INIT_MODULE_CLOCK | /* enable main and mcu clock */ BOARD_INIT_UART_STDIO; /* enable uart for stdio */ Board_init(boardCfg); } int main(void) { BSP_Board_Init(); BSP_GPIO_Init(); while (1) { GPIO_write(LED0, 1); GPIO_log("led is %s\r\n", GPIO_read(LED0) == 1 ? "ON" : "OFF"); Osal_delay(DELAY_VALUE); GPIO_write(LED0, 0); GPIO_log("led is %s\r\n", GPIO_read(LED0) == 1 ? "ON" : "OFF"); Osal_delay(DELAY_VALUE); } }