From 17445c182e1cfbb48c2931832ecb0125e1228f91 Mon Sep 17 00:00:00 2001 From: Rakshita Date: Tue, 15 Apr 2025 12:04:55 +0530 Subject: [PATCH] fix: Correct relay pin configuration and bit mapping --- .settings/org.eclipse.core.resources.prefs | 54 ++++++++++++++++ ivec_RTE/src/ivec_rte.c | 73 ++++++++++++++++++++++ 2 files changed, 127 insertions(+) diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs index b847005..51d1a5c 100644 --- a/.settings/org.eclipse.core.resources.prefs +++ b/.settings/org.eclipse.core.resources.prefs @@ -114,6 +114,60 @@ encoding//Debug/ivec_ESDK/ivec_esdk_nfc_pn532/src/subdir_rules.mk=UTF-8 encoding//Debug/ivec_ESDK/ivec_esdk_nfc_pn532/src/subdir_vars.mk=UTF-8 encoding//Debug/ivec_RTE/src/subdir_rules.mk=UTF-8 encoding//Debug/ivec_RTE/src/subdir_vars.mk=UTF-8 +encoding//Debug/ivec_cmplx_vframe/src/subdir_rules.mk=UTF-8 +encoding//Debug/ivec_cmplx_vframe/src/subdir_vars.mk=UTF-8 +encoding//Debug/lib/gcc/m0p/mspm0c110x/subdir_rules.mk=UTF-8 +encoding//Debug/lib/gcc/m0p/mspm0c110x/subdir_vars.mk=UTF-8 +encoding//Debug/lib/gcc/m0p/mspm0g1x0x_g3x0x/subdir_rules.mk=UTF-8 +encoding//Debug/lib/gcc/m0p/mspm0g1x0x_g3x0x/subdir_vars.mk=UTF-8 +encoding//Debug/lib/gcc/m0p/mspm0gx51x/subdir_rules.mk=UTF-8 +encoding//Debug/lib/gcc/m0p/mspm0gx51x/subdir_vars.mk=UTF-8 +encoding//Debug/lib/gcc/m0p/mspm0l111x/subdir_rules.mk=UTF-8 +encoding//Debug/lib/gcc/m0p/mspm0l111x/subdir_vars.mk=UTF-8 +encoding//Debug/lib/gcc/m0p/mspm0l11xx_l13xx/subdir_rules.mk=UTF-8 +encoding//Debug/lib/gcc/m0p/mspm0l11xx_l13xx/subdir_vars.mk=UTF-8 +encoding//Debug/lib/gcc/m0p/mspm0l122x_l222x/subdir_rules.mk=UTF-8 +encoding//Debug/lib/gcc/m0p/mspm0l122x_l222x/subdir_vars.mk=UTF-8 +encoding//Debug/lib/iar/m0p/mspm0c110x/subdir_rules.mk=UTF-8 +encoding//Debug/lib/iar/m0p/mspm0c110x/subdir_vars.mk=UTF-8 +encoding//Debug/lib/iar/m0p/mspm0g1x0x_g3x0x/subdir_rules.mk=UTF-8 +encoding//Debug/lib/iar/m0p/mspm0g1x0x_g3x0x/subdir_vars.mk=UTF-8 +encoding//Debug/lib/iar/m0p/mspm0gx51x/subdir_rules.mk=UTF-8 +encoding//Debug/lib/iar/m0p/mspm0gx51x/subdir_vars.mk=UTF-8 +encoding//Debug/lib/iar/m0p/mspm0l111x/subdir_rules.mk=UTF-8 +encoding//Debug/lib/iar/m0p/mspm0l111x/subdir_vars.mk=UTF-8 +encoding//Debug/lib/iar/m0p/mspm0l11xx_l13xx/subdir_rules.mk=UTF-8 +encoding//Debug/lib/iar/m0p/mspm0l11xx_l13xx/subdir_vars.mk=UTF-8 +encoding//Debug/lib/iar/m0p/mspm0l122x_l222x/subdir_rules.mk=UTF-8 +encoding//Debug/lib/iar/m0p/mspm0l122x_l222x/subdir_vars.mk=UTF-8 +encoding//Debug/lib/keil/m0p/mspm0c110x/subdir_rules.mk=UTF-8 +encoding//Debug/lib/keil/m0p/mspm0c110x/subdir_vars.mk=UTF-8 +encoding//Debug/lib/keil/m0p/mspm0g1x0x_g3x0x/subdir_rules.mk=UTF-8 +encoding//Debug/lib/keil/m0p/mspm0g1x0x_g3x0x/subdir_vars.mk=UTF-8 +encoding//Debug/lib/keil/m0p/mspm0gx51x/subdir_rules.mk=UTF-8 +encoding//Debug/lib/keil/m0p/mspm0gx51x/subdir_vars.mk=UTF-8 +encoding//Debug/lib/keil/m0p/mspm0l111x/subdir_rules.mk=UTF-8 +encoding//Debug/lib/keil/m0p/mspm0l111x/subdir_vars.mk=UTF-8 +encoding//Debug/lib/keil/m0p/mspm0l11xx_l13xx/subdir_rules.mk=UTF-8 +encoding//Debug/lib/keil/m0p/mspm0l11xx_l13xx/subdir_vars.mk=UTF-8 +encoding//Debug/lib/keil/m0p/mspm0l122x_l222x/subdir_rules.mk=UTF-8 +encoding//Debug/lib/keil/m0p/mspm0l122x_l222x/subdir_vars.mk=UTF-8 +encoding//Debug/lib/ticlang/m0p/mspm0c110x/subdir_rules.mk=UTF-8 +encoding//Debug/lib/ticlang/m0p/mspm0c110x/subdir_vars.mk=UTF-8 +encoding//Debug/lib/ticlang/m0p/mspm0g1x0x_g3x0x/subdir_rules.mk=UTF-8 +encoding//Debug/lib/ticlang/m0p/mspm0g1x0x_g3x0x/subdir_vars.mk=UTF-8 +encoding//Debug/lib/ticlang/m0p/mspm0gx51x/subdir_rules.mk=UTF-8 +encoding//Debug/lib/ticlang/m0p/mspm0gx51x/subdir_vars.mk=UTF-8 +encoding//Debug/lib/ticlang/m0p/mspm0l111x/subdir_rules.mk=UTF-8 +encoding//Debug/lib/ticlang/m0p/mspm0l111x/subdir_vars.mk=UTF-8 +encoding//Debug/lib/ticlang/m0p/mspm0l11xx_l13xx/subdir_rules.mk=UTF-8 +encoding//Debug/lib/ticlang/m0p/mspm0l11xx_l13xx/subdir_vars.mk=UTF-8 +encoding//Debug/lib/ticlang/m0p/mspm0l122x_l222x/subdir_rules.mk=UTF-8 +encoding//Debug/lib/ticlang/m0p/mspm0l122x_l222x/subdir_vars.mk=UTF-8 +encoding//Debug/m0p/subdir_rules.mk=UTF-8 +encoding//Debug/m0p/subdir_vars.mk=UTF-8 +encoding//Debug/m0p/sysctl/subdir_rules.mk=UTF-8 +encoding//Debug/m0p/sysctl/subdir_vars.mk=UTF-8 encoding//Debug/makefile=UTF-8 encoding//Debug/objects.mk=UTF-8 encoding//Debug/sources.mk=UTF-8 diff --git a/ivec_RTE/src/ivec_rte.c b/ivec_RTE/src/ivec_rte.c index 937b242..3b361af 100644 --- a/ivec_RTE/src/ivec_rte.c +++ b/ivec_RTE/src/ivec_rte.c @@ -476,6 +476,79 @@ void vRTE_CanFilterSaveVal(uint8_t u8Idx, uint32_t u32Filter, bool bl_bIsExtende void vCcUartRxToCanTx(IVEC_EcuCommonCanFrame_s* pxCanMsg) { + if( (pxCanMsg->u32CanId == 0x16) && (pxCanMsg->pucCanData[0] == 'V') && \ + (pxCanMsg->pucCanData[1] == 'E') && (pxCanMsg->pucCanData[2] == 'C') && \ + (pxCanMsg->pucCanData[3] == 'I') && (pxCanMsg->pucCanData[4]== 'O') && \ + (pxCanMsg->pucCanData[5] == 'T')) + { + uint32_t l_u32Id = 0x36; // ID to pass + uint8_t pu8Data[1] = {0x79}; // Data array containing 0x79 + uint8_t u8Len = sizeof(pu8Data); // Length of data array + int l_i32RetSize = 0; + uint8_t l_u8UartBuffer[30] = { 0 }; + int l_i32Status = -1; + l_i32RetSize = u16CMPLX_vFrameEncode((uint32_t)l_u32Id, (uint8_t*)&pu8Data[1], u8Len, l_u8UartBuffer, 30); + l_i32Status = IVEC_ECUUartWrite(&__gprv_UartCcHandle, l_u8UartBuffer, l_i32RetSize); + vMCAL_softReset(); + } + + if(pxCanMsg->ucCanDlc > 0 && pxCanMsg->u32CanId == 0x00) + { + uint32_t l_u32Baudrate = 0; + uint8_t l_u8Mode = pxCanMsg->pucCanData[0];//g_pu8UartBuffer[ecuUART_PKT_HEADER_u8]; + memcpy(&l_u32Baudrate, &pxCanMsg->pucCanData[1], (uint32_t)pxCanMsg->ucCanDlc); + iECU_UartInitiateTransmit(&g_xUartHandle, 0x01,(uint8_t*)&pxCanMsg->pucCanData[0],0); + if( l_u8Mode == 0 ) + { + __gprv_UartCcHandle.u32BaudRate = l_u32Baudrate; + xECU_UartReinit(&__gprv_UartCcHandle); + } + else if( l_u8Mode == 1 ) + { + g_xCanHandle.u16Speed = (uint16_t)l_u32Baudrate; + xECU_CANReInit(&g_xCanHandle); + } + else if( l_u8Mode == 2 ) + { + + if( pxCanMsg->pucCanData[1] != 0 ){//22(20+2) rx filter available send each id in a frame + uint32_t l_U32FilterId = 0; + memcpy(&l_U32FilterId, &pxCanMsg->pucCanData[3], sizeof(uint32_t)); + bool l_bIsExtended = 0; + l_bIsExtended = (l_U32FilterId > 0x7FF); // Standard IDs are <= 0x7FF + vRTE_CanFilterSaveVal((pxCanMsg->pucCanData[1] - 1), l_U32FilterId, l_bIsExtended); + if( pxCanMsg->pucCanData[2])//All filter received. Trigger Filter Settings + { + xECU_CANReInit(&g_xCanHandle); + } + else + return; + } + else{ + xECU_CANReInit(&g_xCanHandle); + } + } + + else if ( l_u8Mode == 3 ) + { + if( (pxCanMsg->pucCanData[1] < 1) || (pxCanMsg->pucCanData[1] > 8) )//0-7 maximum received pkts + return; + uint32_t l_u32u32MaskId = 0; + memcpy(&l_u32u32MaskId, &pxCanMsg->pucCanData[3], sizeof(uint32_t)); + bool l_bIsExtended = 0; + l_bIsExtended = (l_u32u32MaskId > 0x7FF); // Standard IDs are <= 0x7FF + vRTE_CanFilterMaskSaveVal((pxCanMsg->pucCanData[1] - 1), l_u32u32MaskId, l_bIsExtended); + } + else if (l_u8Mode == 100) + { + g_u32CanId = l_u32Baudrate; + return; + } + + vMCAL_delayTicks(100); + iECU_UartInitiateTransmit(&g_xUartHandle, 0x01,(uint8_t*)&pxCanMsg->pucCanData[0],0); + } + if(pxCanMsg->u32CanId != 0x00) {