cancel
Showing results for 
Search instead for 
Did you mean: 

CAN problem with GPIO pin

vova
Associate II
Posted on May 12, 2010 at 14:10

CAN problem with GPIO pin

6 REPLIES 6
vova
Associate II
Posted on May 17, 2011 at 13:50

if another mcu sends a package, then I can not initialize  CAN to these GPIO pins (

CAN_Init() returns  CANINITFAILED

) ... why??

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

I am not sure which version of Firmware library you are using.

Use version V3.1.0 with old version there was already some problem in CANInit code.

Just make sure you have right prescaler and other setting for right baud rate and also add speed 50Mhz for both CAN Tx and Rx pins.

(GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz)

Posted on May 17, 2011 at 13:50

add speed 50Mhz for both CAN Tx and Rx pins. (GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz)

 

You don't need to specify the 50MHz speed to an INPUT pin, it controls the drive current/slew rate of OUTPUT pins.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
vova
Associate II
Posted on May 17, 2011 at 13:50

I use Firmware lib 3.3.0

Rx pin 

does not need 

speed 50Mhz

baudrate is set correctly on 

500kbps (PCLK1=36MHz, TQ=18, br=4) 

initialization is successful if I

 assign to the other pins that are not connected to the CAN bus

vova
Associate II
Posted on May 17, 2011 at 13:50

if doing so

CAN_Init (CAN1, & CAN_InitStructure); // return ОК

GPIO_PinRemapConfig (GPIO_Remap1_CAN1, ENABLE); // 

place after

 CAN_Init

But I have form error ...

I think that 

to quit the initialization CAN controller must be synchronized with the bus, but since the pins are not remap and synchronization does not occur...

vova
Associate II
Posted on May 17, 2011 at 13:50

Problem solved!

core frequency  configured not correctly  , because I use quartz for 8 MHz (default is 25 MHz)

Thanks!