2015-07-30 06:51 AM
Hello,
I just started to use the CAN blocks in this block-set, I�m using Matlab 2014a and I�m expensing some potential bugs in the generated code. Am I doing something wrong or are these bugs?1: CAN_Filter block dose not generate much code at all only a comment in the step function: /* S-Function Block: <Root>/CAN_Filter */and some variable declarations:/* CAN1 filter configuration structure */CAN_FilterConfTypeDef CAN1_sFilterConfig;/* CAN1 filter configuration structure */extern CAN_FilterConfTypeDef CAN1_sFilterConfig;No call to HAL_CAN_ConfigFilter()??
2: The CAN_Send block writes to the Rx buffer instead of the Tx buffer for the specified CAN, consequentially no message is sent.
/* Build frame to send */
if (STM32CAN_B.sf_MATLABFunction3.y == CAN_ID_STD) {
hcan2.pRxMsg->StdId = (uint32_t)STM32CAN_B.sf_MATLABFunction2.y;
hcan2.pRxMsg->ExtId = (uint32_t)0;
hcan2.pRxMsg->IDE = CAN_ID_STD;
} else {
hcan2.pRxMsg->StdId = (uint32_t)0;
hcan2.pRxMsg->ExtId = (uint32_t)STM32CAN_B.sf_MATLABFunction2.y;
hcan2.pRxMsg->IDE = CAN_ID_EXT;
}
hcan2.pRxMsg->RTR = (uint32_t)STM32CAN_P.Constant3_Value;
hcan2.pRxMsg->DLC = (uint32_t)STM32CAN_B.sf_MATLABFunction1.y;
strncpy((char*)hcan2.pRxMsg->Data, (char const*)&STM32CAN_B.y[0],(uint32_t)
STM32CAN_B.sf_MATLABFunction1.y);
/* Send pooling mode frame */
HAL_CAN_Transmit(&hcan2, 10);
#simulink-stm32f4-stm32-mat2015-07-31 02:44 AM
Until the block-set is updated the attached files can be used to solve the problem
put files in: STM32-MAT\STM32\blks\mex\tlc_c\ ________________ Attachments : CAN_Filter.tlc : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HzOx&d=%2Fa%2F0X0000000bLK%2FcM4NJWeP7R7Yvf5Wn5_kevImcLDBKCSuInrKYCiQAT4&asPdf=falseCAN_Send.tlc : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HzOs&d=%2Fa%2F0X0000000bLI%2FSmaJTXBBfp3FlPX_HfPYhBiQJdRLGk_wYW.Pudjc76U&asPdf=false