Tool/software: TI-RTOS
Hi:
When I operated GPIO2_27 on the DSP terminal, I found that I couldn't control the high and low level.
GPIO2_27PIN:
root@am57xx-evm:~# devmem2 0x4A0034D4
/dev/mem opened.
Memory mapped at address 0xb6f49000.
Read at address 0x4A0034D4 (0xb6f494d4): 0x0001000E
When I change the GPIO2_27 to GPIO4_4, I can control it at the DSP end.
Software version RTOS_4.3 AM5728
#include <stdlib.h>
#include <xdc/std.h>
#include <xdc/runtime/Diags.h>
#include <xdc/runtime/Error.h>
#include <xdc/runtime/Log.h>
#include <xdc/runtime/System.h>
/* package header files */
#include <ti/ipc/Ipc.h>
#include <xdc/runtime/Registry.h>
#include <ti/ipc/MessageQ.h>
#include <ti/ipc/MultiProc.h>
#include <ti/sysbios/BIOS.h>
#include <ti/sysbios/knl/Task.h>
#include <ti/drv/gpio/GPIO.h>
#include <ti/drv/gpio/soc/GPIO_v1.h>
#include "../shared/AppCommon.h"
#define MODULE_NAME "Server"
/* module structure */
typedef struct {
UInt16 hostProcId; // host processor id
MessageQ_Handle slaveQue; // created locally
} Server_Module;
//GPIO4_4, GPIO4_9, GPIO2_27
GPIO_PinConfig gpioPinConfigs[] = {
GPIO_DEVICE_CONFIG(0x04, 0x04) | GPIO_CFG_OUTPUT,
GPIO_DEVICE_CONFIG(0x04, 0x09) | GPIO_CFG_OUTPUT,
GPIO_DEVICE_CONFIG(0x02, 0x27) | GPIO_CFG_OUTPUT,
GPIO_DEVICE_CONFIG(0x04, 0x03) | GPIO_CFG_OUTPUT
//GPIO_DEVICE_CONFIG(0x03, 0x28) | GPIO_CFG_OUTPUT,
//GPIO_DEVICE_CONFIG(0x03, 0x29) | GPIO_CFG_OUTPUT,
//GPIO_DEVICE_CONFIG(0x03, 0x30) | GPIO_CFG_OUTPUT,
};
/* GPIO Driver call back functions */
GPIO_CallbackFxn gpioCallbackFunctions[] = {
NULL,
NULL,
NULL
};
GPIO_v1_Config GPIO_v1_config = {
gpioPinConfigs,
NULL,
sizeof(gpioPinConfigs) / sizeof(GPIO_PinConfig),
//sizeof(gpioCallbackFunctions) / sizeof(GPIO_CallbackFxn),
0,
0,
};
Void MessageTask(UArg arg0, UArg arg1);
Int main(Int argc, Char* argv[])
{
Error_Block eb;
Task_Params taskParams;
Error_init(&eb);
Task_Params_init(&taskParams);
taskParams.instance->name = "smain";
taskParams.arg0 = (UArg)argc;
taskParams.arg1 = (UArg)argv;
taskParams.stackSize = 0x4000;
Task_create(MessageTask, &taskParams, &eb);
if (Error_check(&eb)) {
System_abort("main: failed to create application startup thread");
}
GPIO_init();
/* start scheduler, this never returns */
BIOS_start();
return (0);
}
Void MessageTask(UArg arg0, UArg arg1)
{
Int status = 0;
UInt index = 0;
UInt GpioNum = 0;
Server_Module Module;
MessageQ_Params msgqParams;
App_Msg * msg;
MessageQ_QueueId queId;
Module.hostProcId = MultiProc_getId("HOST");
MessageQ_Params_init(&msgqParams);
Module.slaveQue = MessageQ_create("DSP1", &msgqParams);
if ( Module.slaveQue == NULL )
goto messageq_create_err;
GpioNum = sizeof(gpioPinConfigs) / sizeof(GPIO_PinConfig);
while ( TRUE ) {
status = MessageQ_get(Module.slaveQue, (MessageQ_Msg *)&msg,
MessageQ_FOREVER);
if (status < 0) {
break;
}
if ( msg->cmd == 0xFF) {
for ( index = 0; index < GpioNum; index++ )
GPIO_write(index, 1U);
} else {
for ( index = 0; index < GpioNum; index++ )
GPIO_write(index, 0U);
}
queId = MessageQ_getReplyQueue(msg);
MessageQ_put(queId, (MessageQ_Msg)msg);
}
MessageQ_delete(&Module.slaveQue);
return;
messageq_create_err:
return ;
}
