fix: update the CPU clock to 48Mhz

- Update the systick period enum
- Add bootloader jump and check
- Increased the destination buffer size during rx drain
- Increased uart buffer size from 8 to 64
stable
heezes 2024-11-07 10:32:26 +05:30
parent 9631a6c398
commit 51cb91df6c
10 changed files with 25 additions and 24 deletions

View File

@ -300,7 +300,7 @@
<listOptionValue builtIn="false" value="${workspace_loc:/${ProjName}/Core/Include}"/>
<listOptionValue builtIn="false" value="${workspace_loc:/${ProjName}/Core/Source}"/>
</option>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_GNU_9.0.compilerID.OPT_LEVEL.1780645341" name="Optimization Level" superClass="com.ti.ccstudio.buildDefinitions.TMS470_GNU_9.0.compilerID.OPT_LEVEL" useByScannerDiscovery="false" value="com.ti.ccstudio.buildDefinitions.TMS470_GNU_9.0.compilerID.OPT_LEVEL.3" valueType="enumerated"/>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_GNU_9.0.compilerID.OPT_LEVEL.1780645341" name="Optimization Level" superClass="com.ti.ccstudio.buildDefinitions.TMS470_GNU_9.0.compilerID.OPT_LEVEL" useByScannerDiscovery="false" value="com.ti.ccstudio.buildDefinitions.TMS470_GNU_9.0.compilerID.OPT_LEVEL.OPT_FOR_DEBUG" valueType="enumerated"/>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_GNU_9.0.compilerID.FUNCTION_SECTIONS.1169413269" name="Place each function into its own section (-ffunction-sections)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_GNU_9.0.compilerID.FUNCTION_SECTIONS" useByScannerDiscovery="false" value="true" valueType="boolean"/>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_GNU_9.0.compilerID.DATA_SECTIONS.1798321361" name="Place data items into their own section (-fdata-sections)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_GNU_9.0.compilerID.DATA_SECTIONS" useByScannerDiscovery="false" value="true" valueType="boolean"/>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_GNU_9.0.compilerID.DEBUG.1745765211" name="Generate debug information (-g)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_GNU_9.0.compilerID.DEBUG" useByScannerDiscovery="false" value="true" valueType="boolean"/>
@ -349,7 +349,7 @@
<tool id="com.ti.ccstudio.buildDefinitions.TMS470_GNU_9.0.hex.844000148" name="GNU Objcopy Utility" superClass="com.ti.ccstudio.buildDefinitions.TMS470_GNU_9.0.hex">
<option id="com.ti.ccstudio.buildDefinitions.TMS470_GNU_9.0.hex.OUTPUT_TARGET.2034251039" name="Create an output file in format &lt;bfdname&gt; (-O, --output-target)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_GNU_9.0.hex.OUTPUT_TARGET" useByScannerDiscovery="false" value="com.ti.ccstudio.buildDefinitions.TMS470_GNU_9.0.hex.OUTPUT_TARGET.IHEX" valueType="enumerated"/>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_GNU_9.0.hex.OUTPUT_FILE.1496414824" name="Specify output file name" superClass="com.ti.ccstudio.buildDefinitions.TMS470_GNU_9.0.hex.OUTPUT_FILE" useByScannerDiscovery="false" value="" valueType="string"/>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_GNU_9.0.hex.TOOL_ENABLE.1681465396" superClass="com.ti.ccstudio.buildDefinitions.TMS470_GNU_9.0.hex.TOOL_ENABLE" value="true" valueType="boolean"/>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_GNU_9.0.hex.TOOL_ENABLE.1681465396" name="Enable tool" superClass="com.ti.ccstudio.buildDefinitions.TMS470_GNU_9.0.hex.TOOL_ENABLE" value="true" valueType="boolean"/>
<outputType id="com.ti.ccstudio.buildDefinitions.TMS470_GNU_9.0.hex.outputType__BIN.1678560495" name="Binary File" superClass="com.ti.ccstudio.buildDefinitions.TMS470_GNU_9.0.hex.outputType__BIN"/>
</tool>
</toolChain>

View File

@ -20,7 +20,7 @@ volatile DL_MCAN_RxBufElement TempRxMsg;
volatile uint8_t TempRxBuffer[8];
volatile uint32_t TempRxID;
volatile uint32_t id;
DL_MCAN_ProtocolStatus HeaderStat;
volatile DL_MCAN_ProtocolStatus HeaderStat;
volatile uint32_t l_canTransmitTimeout;
volatile uint8_t u8CallBack_buff[8]={0};
volatile IVEC_McalStatus_e l_statusFlag = IVEC_MCAL_STATUS_SUCCESS;

View File

@ -36,8 +36,7 @@ void _prv_vrxcallback(UART_Regs *pxUartInstance, uint32_t event)
{
case DL_UART_MAIN_IIDX_RX:
{
bool status = 0;
uint8_t l_pu8Buffer[8] = {0}; // Adjust size as needed
uint8_t l_pu8Buffer[64] = {0}; // Adjust size as needed
uint32_t bytesRead;
// Drain the RX FIFO and store the data in buffer

View File

@ -130,7 +130,7 @@ SYSCONFIG_WEAK void SYSCFG_DL_GPIO_init(void)
DL_GPIO_initDigitalInputFeatures(GPIO_GRP_0_PIN_0_IOMUX,
DL_GPIO_INVERSION_DISABLE, DL_GPIO_RESISTOR_NONE,
DL_GPIO_HYSTERESIS_DISABLE, DL_GPIO_WAKEUP_DISABLE);
// DL_GPIO_initDigitalOutput(GPIO_GRP_0_PIN_0_IOMUX);
DL_GPIO_initPeripheralOutputFunction(
GPIO_MCAN0_IOMUX_CAN_TX, GPIO_MCAN0_IOMUX_CAN_TX_FUNC);

View File

@ -5,8 +5,8 @@
//#include "ivec_mcal_uart.h"
#define LOG_STRING "ivec-ecu-UART"
#define CAN_UART_BUFFER_MAX_SIZE 2048
#define DATA_PACKET_TIMEOUT 10
#define CAN_UART_BUFFER_MAX_SIZE 4096
#define DATA_PACKET_TIMEOUT 1
CmplxFifoQueueHandle_s __gprv_MyEcuUARTResponseQueue = { 0 };
@ -157,16 +157,15 @@ IVEC_EcuCommonErr_e xECU_UARTGetData(McalUartHandle_s *prvUartHandle, uint8_t* p
goto exit;
}
int length = 2;
uint8_t ijk = 0;
int l_u32Len = 0;
uint32_t u32CommTimestamp = i32MCAL_getTicks();
while(((i32MCAL_getTicks()-u32CommTimestamp) <= timeout+1) && (ijk < len))
{
if(!u8CMPLX_FifoQueueEmpty(&__gprv_MyEcuUARTResponseQueue)){
if( u8CMPLX_FifoDequeue(&__gprv_MyEcuUARTResponseQueue, &pucBuffer[ijk], &length, 0) == 1 )
if( u8CMPLX_FifoDequeue(&__gprv_MyEcuUARTResponseQueue, &pucBuffer[ijk], &l_u32Len, 0) == 1 )
ijk++;
}
}

View File

@ -136,7 +136,7 @@ void vRTE_InitUARTCANEcho(void)
void vRTE_UARTDataProcess(void)
{
PacketRetCode_t retCode = PACKET_FAIL;
uint32_t ulId = 0xffffffff;
uint32_t ulId = 0x1fffffff;
retCode= xECU_ReadCANDataOverUART(&g_xUartHandle,g_pu8Buf,&ulId);
ulId &= 0x1fffffff;
@ -175,14 +175,20 @@ void vRTE_UARTDataProcess(void)
void vRTE_CANDataProcess(void)
{
can_buff_t xBuff = { 0x00 };
uint8_t l_u8TxBurstMessages = 0;
while( xECU_CANGetData(&xBuff) == commonECU_SUCCESS && (l_u8TxBurstMessages < 32) )
volatile uint8_t l_u8TxBurstMessages = 0;
while( xECU_CANGetData(&xBuff) == commonECU_SUCCESS )
{
l_u8TxBurstMessages++;
if( (xBuff.id == 0x16) && (xBuff.data[0] = 'V') && \
(xBuff.data[1] == 'E') && (xBuff.data[2] == 'C'))
xMCAL_SoftReset();
vECU_InitiateUartToCanTransmit(&g_xUartHandle, (uint32_t)xBuff.id, (uint8_t*)&xBuff.data[0], (uint8_t)xBuff.length);
socTouchDisplay_U.Input[__gprv_u8Idx].ID = xBuff.id;
socTouchDisplay_U.Input[__gprv_u8Idx].Length = xBuff.length;
memcpy(&socTouchDisplay_U.Input[__gprv_u8Idx].Data[0], &xBuff.data[0], 8);
__gprv_u8Idx = (__gprv_u8Idx + 1) % MAX_CAN_MESSAGE_INSTANCE;
if(l_u8TxBurstMessages < 24)
l_u8TxBurstMessages++;
else
break;
}
}

5
main.c
View File

@ -17,12 +17,11 @@
#include "string.h"
#include "ivec_rte.h"
void vMCAL_TimerCallback(void)
{
vRTE_MatlabRun();
DL_TimerA_clearInterruptStatus(TIMER_1_INST, GPTIMER_CPU_INT_IMASK_Z_SET);
// DL_GPIO_togglePins(GPIOB, DL_GPIO_PIN_17);
}
static void __prv_TimerConfig(void)
@ -34,8 +33,6 @@ static void __prv_TimerConfig(void)
NVIC_EnableIRQ(TIMA0_INT_IRQn);
}
int main(void)
{
__enable_irq();

View File

@ -7,7 +7,7 @@ _Min_Stack_Size = 0x000012E8; /* required amount of stack */
/* Specify the memory areas */
MEMORY
{
FLASH (RX) : ORIGIN = 0x00000000, LENGTH = 0x00020000
FLASH (RX) : ORIGIN = 0x00008000, LENGTH = 0x00018000
SRAM (RWX) : ORIGIN = 0x20200000, LENGTH = 0x00008000
BCR_CONFIG (R) : ORIGIN = 0x41C00000, LENGTH = 0x00000080
BSL_CONFIG (R) : ORIGIN = 0x41C00100, LENGTH = 0x00000080
@ -33,7 +33,7 @@ SECTIONS
{
/* section for the interrupt vector area */
PROVIDE (_intvecs_base_address =
DEFINED(_intvecs_base_address) ? _intvecs_base_address : 0x00000000);
DEFINED(_intvecs_base_address) ? _intvecs_base_address : 0x00008000);
.intvecs (_intvecs_base_address) : AT (_intvecs_base_address) {
KEEP (*(.intvecs))

View File

@ -94,7 +94,7 @@ static const DL_SYSCTL_SYSPLLConfig gSYSPLLConfig = {
.enableCLK0 = DL_SYSCTL_SYSPLL_CLK0_ENABLE,
.sysPLLMCLK = DL_SYSCTL_SYSPLL_MCLK_CLK0,
.sysPLLRef = DL_SYSCTL_SYSPLL_REF_HFCLK,
.qDiv = 1,
.qDiv = 3,
.pDiv = DL_SYSCTL_SYSPLL_PDIV_1
};
@ -145,7 +145,7 @@ xCoreStatus_t xMCAL_SYSCTL_INIT(uint8_t u8CLK_SRC,uint8_t u8LP_MODE)
DL_SYSCTL_disableSYSPLL();
DL_SYSCTL_setHFCLKSourceHFXTParams(DL_SYSCTL_HFXT_RANGE_16_32_MHZ,10, true);
DL_SYSCTL_configSYSPLL((DL_SYSCTL_SYSPLLConfig *) &gSYSPLLConfig);
DL_SYSCTL_setULPCLKDivider(DL_SYSCTL_ULPCLK_DIV_1);
DL_SYSCTL_setULPCLKDivider(DL_SYSCTL_ULPCLK_DIV_2);
DL_SYSCTL_setMCLKSource(SYSOSC, HSCLK, DL_SYSCTL_HSCLK_SOURCE_SYSPLL);
}
else if(u8CLK_SRC==SYSOSC)

View File

@ -75,7 +75,7 @@ typedef enum
typedef enum
{
/*SysTick Period Options*/
Period_1ms = 24000, /*!< sets period of SysTick to 1ms */
Period_1ms = 48000, /*!< sets period of SysTick to 1ms @48Mhz*/
}xTicks_t;
typedef enum