cancel
Showing results for 
Search instead for 
Did you mean: 

CAN2 in STM32F105

jps2
Associate
Posted on March 29, 2010 at 22:17

CAN2 in STM32F105

4 REPLIES 4
michi
Associate
Posted on May 17, 2011 at 13:45

You must activate clock for CAN1 to send with CAN2.

jps2
Associate
Posted on May 17, 2011 at 13:45

Thank you michi.

I can transmit data so I use the CAN 1 clock.

My problem is that I can't receive data?

Any Idea?

Ragards

JeePee

smart2
Associate II
Posted on May 17, 2011 at 13:45

Nobody can help you unless you give some more detail about your code,

michi
Associate
Posted on May 17, 2011 at 13:45

I had the same problem with the STM23F107 with CAN2.

You must activate clock for CAN1 and CAN2 and set the filter for CAN2:

/* CAN1 Periph clock enable */

  RCC_APB1PeriphClockCmd(RCC_APB1Periph_CAN1, ENABLE);

  /* CAN2 Periph clock enable */

  RCC_APB1PeriphClockCmd(RCC_APB1Periph_CAN2, ENABLE);

Filter settings for example for all IDs

/**

  * @brief  Configures the CAN2 filter.

  * @param  None

  * @retval None

  */

void CAN2_Filter_Config_None(void)

{

  CAN_FilterInitTypeDef   CAN_FilterInitStructure;

 

  /* CAN filter init */

  CAN_FilterInitStructure.CAN_FilterNumber=14; // for CAN2 begins the filter number with number 14

  CAN_FilterInitStructure.CAN_FilterMode=CAN_FilterMode_IdMask;

  CAN_FilterInitStructure.CAN_FilterScale=CAN_FilterScale_32bit;

  CAN_FilterInitStructure.CAN_FilterIdHigh=0x0000;

  CAN_FilterInitStructure.CAN_FilterIdLow=0x0000;

  CAN_FilterInitStructure.CAN_FilterMaskIdHigh=0x0000;

  CAN_FilterInitStructure.CAN_FilterMaskIdLow=0x0000;

  CAN_FilterInitStructure.CAN_FilterFIFOAssignment=0;

  CAN_FilterInitStructure.CAN_FilterActivation=ENABLE;

  CAN_FilterInit(&CAN_FilterInitStructure);

}

lg michi