Tool/software:
Hello,
I am struggeling with a baremetal hello_world program that should
- Run on Main R5F Core 0 (MCU2_0) (j721e Eval board) via CSS
- Send a simple CAN message on MAIN_CAN0 -
As reference I used the mcan_evm_loopback_app_main_k3.c file.
1) I need help where to find the possbile PINS for STB, EN, TX, RX for the Main_CAN0 (and other)
/* GPIO initialization */ GPIO_init(); /* Enable CAN transceivers by setting the STB pins */ /* Enable the TCAN on GESI board. * Main Domain MCAN instances 4,5,6,7,9,11. */ GPIO_write(0, GPIO_PIN_LOW); /* Set MCU_MCAN1_STB to LEVEL_LOW to exit CAN1 from Standby mode */ GPIOSetDirMode_v0(CSL_WKUP_GPIO0_BASE, MCU_MCAN1_STB_PIN, GPIO_DIRECTION_OUTPUT); GPIOPinWrite_v0(CSL_WKUP_GPIO0_BASE, MCU_MCAN1_STB_PIN, GPIO_PIN_LOW); #if defined (SOC_J721E) || defined (SOC_J7200) || defined (SOC_J721S2) /* Set MCU_MCAN0_EN Enable to LEVEL_HIGH to Enable MCU MCAN 0*/ GPIOSetDirMode_v0(CSL_WKUP_GPIO0_BASE, MCU_MCAN0_ENABLE_PIN, GPIO_DIRECTION_OUTPUT); GPIOPinWrite_v0(CSL_WKUP_GPIO0_BASE, MCU_MCAN0_ENABLE_PIN, GPIO_PIN_HIGH); /* Set MCU_MCAN0_STBz pin to LEVEL_High to exit CAN0 from Standby mode */ GPIOSetDirMode_v0(CSL_WKUP_GPIO0_BASE, MCU_MCAN0_STBZ_PIN, GPIO_DIRECTION_OUTPUT); GPIOPinWrite_v0(CSL_WKUP_GPIO0_BASE, MCU_MCAN0_STBZ_PIN, GPIO_PIN_HIGH); #endif
Where / in which document I find the mapping from STB Pin to CSL_WKUP_GPIOx_BASE?
2) How the GPIO mapping is done in the example?
First part is done via GPIO interface, the other part is done via I2C. Why?
#if defined (SOC_J721E) /* * Configuring TCA6424 IO Exp 2 with addr 0x22 * This io expander is controlled by i2c0 * For Main MCAN2 P13 and P14 should be set to 0, This should route the MCAN2 STB line to transciver. * For Main MCAN0 P06 and P07 should be set to 1. */ /* I2C initialization */ I2C_init(); I2C_Params_init(&i2cParams); i2cParams.transferMode = I2C_MODE_BLOCKING; i2cParams.bitRate = I2C_400kHz; i2cParams.transferCallbackFxn = NULL; handle = I2C_open(0U, &i2cParams); dataToSlave[0] = TCA6424_REG_CONFIG0 | TCA6424_CMD_AUTO_INC; dataToSlave[1] = 0x0U; SetupI2CTransfer(handle, 0x22, &dataToSlave[0], 2, NULL, 0); dataToSlave[0] = TCA6424_REG_INPUT0 | TCA6424_CMD_AUTO_INC; dataToSlave[1] = 0x0U; dataToSlave[2] = 0x0U; dataToSlave[3] = 0x0U; SetupI2CTransfer(handle, 0x22, &dataToSlave[0], 1, &dataToSlave[1], 3); /* Set P06 and P07 to 1. * Set P13 and P14 to 0. */ dataToSlave[0] = TCA6424_REG_OUTPUT0 | TCA6424_CMD_AUTO_INC; dataToSlave[1] |= 0xC0; dataToSlave[2] &= ~(0x18); SetupI2CTransfer(handle, 0x22, &dataToSlave[0], 1, &dataToSlave[1], 3); #endif
And the comment does not match the code? Whre exactly is P06 and P07 activated?