cancel
Showing results for 
Search instead for 
Did you mean: 

CAN

gregory
Associate II
Posted on April 26, 2008 at 07:17

CAN

3 REPLIES 3
gregory
Associate II
Posted on May 17, 2011 at 12:31

hi all,

I'm trying to test the CAN bus on my hardware.

I use the CAN example program available in the FWLIb.

My hardware is based on the STM32F103VBT6 and the CAN is mapped on PD0 and PD1.

Here is the GPIO initialization

/* Remap the CAN pins on PD0 & PD1 */

GPIO_PinRemapConfig(GPIO_Remap2_CAN,ENABLE);

/* Configure CAN pin: RX */

GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0;

GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPU;

GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;

GPIO_Init(GPIOD, &GPIO_InitStructure);

/* Configure CAN pin: TX */

GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1;

GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;

GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;

GPIO_Init(GPIOD, &GPIO_InitStructure);

When i put a probe on the CANTX I/O, there's no activity !!!!!

Any idea ?

greg

lanchon
Associate III
Posted on May 17, 2011 at 12:31

have you enabled clocks for CAN, AFIO and GPIOD? have you read the STM32 family errata document?

gregory
Associate II
Posted on May 17, 2011 at 12:31

hello,

Indeed the AFIO clock in the ST CAN example was not enabled.

thanks

greg