cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F0 CAN pin configuration

reinerschmidt
Associate
Posted on March 24, 2015 at 20:05

Hello, I am basing this post off of the STM32F0 firmware V1.5.

I am working on a CAN project where we recently migrated to a smaller package chip (we are now using the STM32F072RB). The firmware example for CAN networking uses the CAN bus on PORTD. However we are now using the CAN bus on PORTB (PB8, PB9). However i am unable to get the pin configuration to work at all. Below are the defines in main.h of the firmware example ported to portB.

#define CANx CAN
#define CAN_CLK RCC_APB1Periph_CAN
#define CAN_RX_PIN GPIO_Pin_8
#define CAN_TX_PIN GPIO_Pin_9
#define CAN_GPIO_PORT GPIOB
#define CAN_GPIO_CLK RCC_AHBPeriph_GPIOB
#define CAN_AF_PORT GPIO_AF_1
#define CAN_RX_SOURCE GPIO_PinSource8
#define CAN_TX_SOURCE GPIO_PinSource9

Other than above the code is the same as the firmware example. I have gone through the much of the documentation and have been unable to find my error. Thanks #!stm32f0-!controlareanetwork
1 REPLY 1
Posted on March 24, 2015 at 21:10

According to the 

http://www.st.com/st-web-ui/static/active/en/resource/technical/document/datasheet/DM00090510.pdf

 it's AF_4, not AF_1

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..