Thread 中讨论的其他器件: SYSBIOS
工具与软件:
大家好、我使用的是 AM5706处理器、想要触发并处理 GPIO5_6引脚的中断。 我曾尝试使用 PDK 文件夹(LED 闪烁 API)中提供的 GPIO API、但没有找到如何使用这些 API、还尝试了直接访问 GPIO 寄存器、结果也没得到。
谢谢
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
大家好、实际上我可以为 GPIO LED 运行项目并且能够触发中断、但是他们用于触发 GPIO 中断的 API 基于 IRQ_STATUS_RAW0寄存器(将1写入特定位置会触发 GPIO 相应引脚的中断)、 并且我希望每当 GPIO5_6引脚(DATA_IN 寄存器在特定位置获得对应于 GPIO 特定引脚的值0)作为外部器件数据时触发 GPIO 中断。
我会在明天尝试给你的日志。
大家好、下面随附的代码 基于 GPIO 端口5 (引脚6、7、8)、我将使用此代码来触发 TI LED 闪烁示例代码指定的中断、这些代码正在使用 GPIOTriggerPinInt () 为了触发中断、我只是不想使用此 API、而是想在某些引脚在 GPIO5_6、GPIO5_7、GPIO5_8上写入零时触发中断。
GPIO 中断的配置有什么问题吗?如果有、请更正。
#include <ti/csl/csl_utils.h>
#include <ti/csl/soc/am571x/src/cslr_soc.h>
#include <ti/csl/csl_types.h>
#include <ti/drv/gpio/GPIO.h>
#include <ti/drv/gpio/soc/GPIO_soc.h>
#include <ti/drv/gpio/soc/GPIO_v1.h>
#include <ti/csl/soc/am571x/src/cslr_soc_mpu_baseaddress.h>
#include <ti/csl/hw_types.h>
#include <ti/csl/csl_clec.h>
/* Number of GPIO ports */
#define CSL_GPIO_PER_CNT 8U
/* GPIO Driver hardware attributes */
GPIO_v1_hwAttrs_list GPIO_v1_hwAttrs = {
{
CSL_MPU_GPIO1_REGS,
61,
0,
55,
0
},
{
CSL_MPU_GPIO2_REGS,
62,
0,
56,
0
},
{
CSL_MPU_GPIO3_REGS,
63,
0,
57,
0
},
{
CSL_MPU_GPIO4_REGS,
64,
0,
58,
0
},
{
CSL_MPU_GPIO5_REGS,
65,
0,
59,
0
},
{
CSL_MPU_GPIO6_REGS,
66,
0,
60,
0
},
{
CSL_MPU_GPIO7_REGS,
67,
0,
61,
0
},
{
CSL_MPU_GPIO8_REGS,
153,
0,
0,
0
},
};
/* GPIO configuration structure */
CSL_PUBLIC_CONST GPIOConfigList GPIO_config =
{
{
&GPIO_FxnTable_v1,
NULL,
NULL
},
/* "pad to full predefined length of array" */
{
NULL,
NULL,
NULL
},
{
NULL,
NULL,
NULL
}
};
/* Callback function */
void AppGpioCallbackFxn1(void);
void AppGpioCallbackFxn2(void);
void AppGpioCallbackFxn3(void);
void AppGPIOInit(void);
/**********************************************************************
************************** Global Variables **************************
**********************************************************************/
uint32_t gpioBaseAddr;
uint32_t gpioPin;
/* GPIO pin number connected to the green LED */
#define GPIO_6_PIN_NUM (0x6)
/* GPIO port number connected to the green LED */
#define GPIO_PORT_NUM (0x5)
/* GPIO pin number connected to the yellow LED */
#define GPIO_7_PIN_NUM (0x7)
/* GPIO pin number connected to the yellow LED */
#define GPIO_8_PIN_NUM (0x8)
/* GPIO Driver board specific pin configuration structure */
GPIO_PinConfig gpioPinConfigs[] = {
/* Input pin with interrupt enabled */
GPIO_DEVICE_CONFIG(GPIO_PORT_NUM, GPIO_6_PIN_NUM) |
GPIO_CFG_IN_INT_FALLING | GPIO_CFG_INPUT,
/* Input pin with interrupt enabled */
GPIO_DEVICE_CONFIG(GPIO_PORT_NUM, GPIO_7_PIN_NUM) |
GPIO_CFG_IN_INT_FALLING | GPIO_CFG_INPUT,
/* Input pin with interrupt enabled */
GPIO_DEVICE_CONFIG(GPIO_PORT_NUM, GPIO_8_PIN_NUM) |
GPIO_CFG_IN_INT_FALLING | GPIO_CFG_INPUT
};
/* GPIO Driver call back functions */
GPIO_CallbackFxn gpioCallbackFunctions[] = {
&AppGpioCallbackFxn1,
&AppGpioCallbackFxn2,
&AppGpioCallbackFxn3
// NULL,
// NULL,
// NULL
};
/* GPIO Driver configuration structure */
GPIO_v1_Config GPIO_v1_config = {
gpioPinConfigs,
gpioCallbackFunctions,
sizeof(gpioPinConfigs) / sizeof(GPIO_PinConfig),
sizeof(gpioCallbackFunctions) / sizeof(GPIO_CallbackFxn),
0x20,
};
/*
* ======== AppGPIOInit ========
*/
void AppGPIOInit(void)
{
/* GPIO5 Clock Enable */
*(unsigned int*)0x4A009778 = (unsigned int)(0x00000102);
/* Pinmux for GPIO5_6 */
*(unsigned int*)0x4A0036C4 = (unsigned int)(0x0000000EU);
/* Pinmux for GPIO5_7 */
*(unsigned int*)0x4A0036C8 = (unsigned int)(0x0000000EU);
/* Pinmux for GPIO5_7 */
*(unsigned int*)0x4A0036CC = (unsigned int)(0x0000000EU);
}
unsigned int ret_val;
void gpio_test(UArg arg0, UArg arg1)
{
uint32_t testOutput = 0;
AppGPIOInit();
/* GPIO initialization */
GPIO_init();
GPIO_setCallback(0, AppGpioCallbackFxn1);
/* Enable GPIO interrupt on the specific gpio pin */
GPIO_enableInt(0);
/* Set the callback function */
GPIO_setCallback(1, AppGpioCallbackFxn2);
/* Enable GPIO interrupt on the specific gpio pin */
GPIO_enableInt(1);
/* Set the callback function */
GPIO_setCallback(2, AppGpioCallbackFxn3);
/* Enable GPIO interrupt on the specific gpio pin */
GPIO_enableInt(2);
GPIOTriggerPinInt(0x4805B000, 0, 6);
GPIOTriggerPinInt(0x4805B000, 0, 7);
GPIOTriggerPinInt(0x4805B000, 0, 8);
}
// * ======== Callback function ========
void AppGpioCallbackFxn1(void)
{
UART_printf("interrupt triggered for GPIO5-6------------------------------------- \n");
ret_val = GPIOPinRead(0x4805B000, 6);
UART_printf("in GPIO 6 0x%x\n",ret_val);
}
void AppGpioCallbackFxn2(void)
{
UART_printf("interrupt triggered for GPIO5-7------------------------------------- \n");
ret_val = GPIOPinRead(0x4805B000, 7);
UART_printf("in GPIO 7 0x%x\n",ret_val);
}
void AppGpioCallbackFxn3(void)
{
UART_printf("interrupt triggered for GPIO5-8------------------------------------- \n");
ret_val = GPIOPinRead(0x4805B000, 8);
UART_printf("in GPIO 8 0x%x\n",ret_val);
}谢谢!
检查以下主题以获取想法:
-若苏厄
Josue、我将介绍 TI 处理器的连接、我已经通过 SPI 接口将 ARINC 芯片(HI-3220)连接到 ti 处理器、ARINC 芯片的 int 引脚连接到 ti 处理器的 GPIO5_6引脚、一旦 ARINC 接收到数据、它就会触发中断并使 int 引脚变为低电平、这应该会在 ti 处理器的 GPIO5_6上生成中断。
除此之外、我想问一下我是否需要为 ti am5706的寄存器分配我的 ISR 地址、如果它存在、您能否向我发送为中断寄存器分配 ISR 的小片段?
Hardik、
遗憾的是不可以 我的带宽非常低、并且正在处理一些内部升级、因此我可能没有时间在接下来的两周内尝试任何操作。
很抱歉耽误你的时间。 现在、您将不得不自己进行实验。
请密切关注
您还可以查看 SYS/BIOS (TI-RTOS 内核)用户指南(修订版 V) 中有关 SYS/BIOS 参考的内容
另请访问 https://software-dl.ti.com/processor-sdk-rtos/esd/docs/latest/rtos/index_device_drv.html#gpio
此致!
若苏厄
你好、Hardik、
您能否看一下以下 API 以及它们在此处是否可供使用?
https://software-dl.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/bios/sysbios/6_70_01_03/exports/bios_6_70_01_03/docs/cdoc/ti/sysbios/family/arm/a15/tci66xx/CpIntc.html
-若苏厄