Skip to main content
vova
Associate II
May 12, 2010 12:10 PM UTC
Question

CAN problem with GPIO pin

Posted on May 12, 2010 at 14:10

CAN problem with GPIO pin

    This topic has been closed for replies.

    6 replies

    vova
    vovaAuthor
    Associate II
    May 17, 2011 11:50 AM UTC
    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??

    vova
    vovaAuthor
    Associate II
    May 17, 2011 11:50 AM UTC
    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

    Tesla DeLorean
    Guru
    May 17, 2011 11:50 AM UTC
    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 (See Profile) Up vote any posts that you find helpful, it shows what's working..
    smart2
    Visitor II
    May 17, 2011 11:50 AM UTC
    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)

    vova
    vovaAuthor
    Associate II
    May 17, 2011 11:50 AM UTC
    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!

    vova
    vovaAuthor
    Associate II
    May 17, 2011 11:50 AM UTC
    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...