I have integrated CANopenNodeStack with my STM32 FreeRTOs based code . Below is my code
And here is the repository I am using for CANopenNode stack for STM32 https://github.com/CANopenNode/CanOpenSTM32/tree/master
void canopennode_mtr(void* argument) {
uint32_t ticks = osKernelGetTickCount();
canopen_init();
while (1) {
canopen_app_process();
}
// Sleep for 1ms, you can decrease it if required, in the canopen_app_process we will double check to make sure 1ms passed
ticks += 1;
osDelayUntil(ticks);
}
}
void canopen_init(void) {
//Assign CANOpenNode parameters
CANopenNodeSTM32 canOpenNodeSTM321;
canOpenNodeSTM321.CANHandle = &hcan1;
canOpenNodeSTM321.HWInitFunction = MX_CAN1_Init;
canOpenNodeSTM321.timerHandle = &htim14;
canOpenNodeSTM321.desiredNodeID = 0x11;
canOpenNodeSTM321.baudrate = 500;
canopen_app_init(&canOpenNodeSTM321);
}
CANopenNodeSTM32* canopenNodeSTM32;
is a variable which gets filed during initialization and its in heap . And this variable resets to 0 when I enter canopen_app_process
(canopen_app_process
is a function from CANopenNode Stack).
My question is there a obvious reason in freeRTOS for a heap to reset or am I missing something ?
Note : I am not asking specific to CANopenNode Stack , I just wanna understand general reasons for the heap variable reset
You need to sign in to view this answers