Hi,
i'm trying to integrate McSpi1 Interface to the EtherCat example. The mcspi_app_flash and EtherCat example are working fine so i'm using the the mcspi_app_flash as role model and made the adjustments for SPI1 as suggested in the "Building/Running McSpi Flash Demo C:\ti\sysbios_ind_sdk_2.1.1.2..." thread, but get this error
[CortxA8] ti.sysbios.family.arm.a8.intcps.Hwi: line 1002: E_undefined: Hwi undefined, intnum: 125
xdc.runtime.Error.raise: terminating execution.
the code in tiescappl.c
#include "board_support.h" #include "tiescutils.h" #include "tieschw.h" #include "EtherCATSampleLibrary.h" #include "types.h" #include "error.h" #include "board.h" #include "soc.h" #include "device.h" #include "chipdb.h" #include "mcspi.h" #include "console_utils.h" /* Application header files */ #include "mcspi_app.h" /* ========================================================================== */ /* Macros */ /* ========================================================================== */ /** \brief MCSPI instance number to which flash is connected*/ #define MCSPI_FLASH_INST_NUM (1U) /*----------------------------------------------------------------------------------------- ------ ------ local variables and constants ------ -----------------------------------------------------------------------------------------*/ #define ESC_ADDR_SM0_PHYS_ADDR (0x800) #define ESC_ADDR_SM1_PHYS_ADDR (ESC_ADDR_SM0_PHYS_ADDR + 8) #define ESC_ADDR_SM2_PHYS_ADDR (ESC_ADDR_SM0_PHYS_ADDR + 2 * 8) #define ESC_ADDR_SM3_PHYS_ADDR (ESC_ADDR_SM0_PHYS_ADDR + 3 * 8) /*----------------------------------------------------------------------------------------- ------ ------ application specific functions ------ -----------------------------------------------------------------------------------------*/ /** * \brief Fetch board information. * * \details This function will check if SPI flash is present on the board * and accordingly provide the MCSPI controllers instance number * and instance ID.. * * \param pObj Pointer to the MCSPI application configuration * structure. * * \retval #S_PASS - Flash support is present for the MCSPI instance. * \retVal #E_FAIL - Flash support is not present for the MCSPI instance. */ static int32_t McspiAppBoardInfoGet(mcspiAppCfgObj_t *pObj); /** * \brief Fetch the MCSPI instance address. * * \param pObj Pointer to the MCSPI application configuration * structure. * * \retval #S_PASS - MCSPI instance is present. * \retVal #E_FAIL - MCSPI instance is not present. */ static int32_t McspiAppSocInfoGet(mcspiAppCfgObj_t *pObj); /* ========================================================================== */ /* Global Variables */ /* ========================================================================== */ /* Transmit buffer to hold data of 1 page. */ static uint8_t gFlashAppTxBuffer[8U]; /* Receive buffer to hold data of 1 page. */ static uint8_t gFlashAppRxBuffer[8U]; /* Buffer used to verify the Written and read data. */ //static uint8_t gFlashAppVerifyData[256U]; /** \brief Application default configuration */ static const mcspiAppCfgObj_t MCSPIAPP_DEFAULT = { 1U, /* instNum.*/ 0U, /* instAddr.*/ 48000000U, /* inClk.*/ 24000000U, /* outClk.*/ 0U, /* channelNum.*/ 0U, /* dataLength.*/ gFlashAppTxBuffer, /* pTx.*/ gFlashAppRxBuffer, /* rTx.*/ { MCSPI_CH_SINGLE, /* channel.*/ MCSPI_TRANSFER_MODE_TX_RX, /* txRxMode.*/ MCSPI_DATA_LINE_COMM_MODE_1, /* pinMode. */ MCSPI_CLK_MODE_0, /* clkMode.*/ 8U, /* wordLength.*/ MCSPI_CS_POL_LOW, /* csPolarity.*/ TRUE, /* txFifoCfg.*/ TRUE, /* rxFifoCfg.*/ MCSPI_INTR_TX_EMPTY(0U) | \ MCSPI_INTR_RX_FULL(0U) /* interrupt.*/ }, { INTC_TRIG_HIGH_LEVEL, /* trigType.*/ 0U, /* intrLine.*/ 10U, /* intrPriority.*/ FALSE, /* isIntrSecure.*/ NULL, /* pTxBuf.*/ NULL, /* pRxBuf.*/ NULL /* pFnIntrHandler.*/ }, { TRUE, /* csFlag.*/ MCSPI_MODE_MASTER, /* modeFlag.*/ MCSPI_INTERRUPT_MODE /* comFlag.*/ } }; /** \brief Global object for the MCSPI Flash application. */ static mcspiAppCfgObj_t gAppCfg; ///////////////////////////////////////////////////////////////////////////////////////// /** \brief This function will called from the synchronisation ISR or from the mainloop if no synchronisation is supported *//////////////////////////////////////////////////////////////////////////////////////// extern pECAT_SLAVE_INTERFACE pSlaveInterface; /////////////////////////////////////////////////////////////////////////////////////////// void Demo_Application(unsigned short outputs_running) { /* static Uint8 prevState = 55; uint8_t digInData = 0; if(!pSlaveInterface) { return; } */ int32_t status = S_PASS; volatile uint32_t count = 0x0FFFU; gAppCfg = MCSPIAPP_DEFAULT; mcspiAppCfgObj_t *pCfgMcspi=&gAppCfg; status = BOARDInit(NULL); /* Initialize the UART console */ CONSOLEUtilsInit(); /* Select the console type based on compile time check */ CONSOLEUtilsSetType(CONSOLE_UTILS_TYPE_UART); CONSOLEUtilsPrintf("\n MCSPI Application!!\n"); CONSOLEUtilsPrintf("BOARDInit status [0x%x]\n", status); /* Print SoC & Board Information. */ SOCPrintInfo(); BOARDPrintInfo(); /* Get board info */ status = McspiAppBoardInfoGet(&gAppCfg); if (S_PASS == status) { /* Get SoC info */ status = McspiAppSocInfoGet(&gAppCfg); if (S_PASS == status) { /* Initialize the MCSPI controller. */ status = MCSPIAppInit(&gAppCfg); if(S_PASS == status) { unsigned int index = 0U; for(index = 0U; index < 8U; index++) { gFlashAppTxBuffer[index] = (uint8_t) index; } pCfgMcspi->dataLength = 8U; MCSPIAppTransfer(pCfgMcspi); while(count--); count = 0x0FFFU; } else { CONSOLEUtilsPrintf("MCSPI initialization failed!\n"); } } else { CONSOLEUtilsPrintf("MCSPI instance is not present\n"); } } /* Uint8 LED = (*(pSlaveInterface->pOutput)) & 0xFF; Board_getDigInput(&digInData); Uint32 INPUT = (uint32_t)digInData & 0xFF; INPUT |= 0xaabbcc00; *(pSlaveInterface->pInput) = INPUT; if(!outputs_running) { return; } if(LED != prevState) { Board_setDigOutput(LED); } prevState = LED; */ } void Demo_StateTrans(unsigned short state) { Uint32 addr_len; switch(state) { //INIT_2_PREOP case 0x12: HW_EscReadDWord(addr_len, ESC_ADDR_SM0_PHYS_ADDR); bsp_set_sm_properties(MAILBOX_WRITE, (addr_len & 0xFFFF), (addr_len >> 16)); HW_EscReadDWord(addr_len, ESC_ADDR_SM1_PHYS_ADDR); bsp_set_sm_properties(MAILBOX_READ, (addr_len & 0xFFFF), (addr_len >> 16)); break; //PREOP_2_SAFEOP case 0x24: HW_EscReadDWord(addr_len, ESC_ADDR_SM3_PHYS_ADDR); bsp_set_sm_properties(PROCESS_DATA_IN, (addr_len & 0xFFFF), (addr_len >> 16)); break; //SAFEOP_2_OP case 0x48: HW_EscReadDWord(addr_len, ESC_ADDR_SM2_PHYS_ADDR); bsp_set_sm_properties(PROCESS_DATA_OUT, (addr_len & 0xFFFF), (addr_len >> 16)); break; //OP_2_SAFEOP case 0x84: *(pSlaveInterface->pOutput) = 0; break; default: break; } } ///////////////////////////////////////////////////////////////////////////////////////// /** \brief This is the main function *//////////////////////////////////////////////////////////////////////////////////////// int main() { common_main(); return(0); } static int32_t McspiAppBoardInfoGet(mcspiAppCfgObj_t *pObj) { int32_t status = E_FAIL; // chipdbModuleID_t modId; uint32_t mcspiInstNum; uint32_t mcspiCs; /* Get the MCSPI data for FLASH from the board data */ // modId = BOARDGetDeviceCtrlModId(DEVICE_ID_W25Q64BV, MCSPI_FLASH_INST_NUM); /* if (CHIPDB_MOD_ID_INVALID == modId) { CONSOLEUtilsPrintf("Device is not available on this board!\n"); } else if (CHIPDB_MOD_ID_MCSPI == modId) { */ /* Read the MCSPI instance number. */ mcspiInstNum = 1;//BOARDGetDeviceCtrlModInstNum(DEVICE_ID_W25Q64BV, // MCSPI_FLASH_INST_NUM); /* Read the MCSPI chip select number. */ mcspiCs =0;// BOARDGetDeviceCtrlInfo(DEVICE_ID_W25Q64BV, // MCSPI_FLASH_INST_NUM); if ((INVALID_INST_NUM == mcspiInstNum) || (INVALID_INFO == mcspiCs)) { CONSOLEUtilsPrintf("Invalid MCSPI board data!\n"); } else { CONSOLEUtilsPrintf("MCSPI Instance number: %d\n", mcspiInstNum); CONSOLEUtilsPrintf("Channel/Chip Select number: %d\n", mcspiCs); pObj->instNum = mcspiInstNum; pObj->channelNum = mcspiCs; status = S_PASS; } /* } else { CONSOLEUtilsPrintf("Device is not connected to MCSPI!\n"); } */ return(status); } static int32_t McspiAppSocInfoGet(mcspiAppCfgObj_t *pObj) { int32_t status = E_FAIL; if (TRUE == CHIPDBIsResourcePresent(CHIPDB_MOD_ID_MCSPI, pObj->instNum)) { /* MCSPI interrupt line number. */ pObj->intrCfg.intrLine = 125U; /* Read the MCSPI instance base address. */ pObj->instAddr = CHIPDBBaseAddress(CHIPDB_MOD_ID_MCSPI, pObj->instNum); CONSOLEUtilsPrintf("The instance address is %x\n", pObj->instAddr); status = S_PASS; } else { CONSOLEUtilsPrintf("The MCSPI instance number %d ", pObj->instNum); CONSOLEUtilsPrintf("is not present on the SOC\n"); } return(status); } /** @} */
What did i forget? Are there more adjustments that has to be done to use the mcspi api from starterware with sysbios?
best regards,
Viktor Lange