cancel
Showing results for 
Search instead for 
Did you mean: 

STM32-MAT Blockset CAN block bugs?

jonathan_blom
Associate
Posted on July 30, 2015 at 15:51

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-mat
1 REPLY 1
jonathan_blom
Associate