Skip to main content
Visitor II
June 5, 2007
Question

CAN bus

  • June 5, 2007
  • 3 replies
  • 1160 views
Posted on June 05, 2007 at 11:11

CAN bus

    This topic has been closed for replies.

    3 replies

    Visitor II
    May 17, 2011
    Posted on May 17, 2011 at 09:44

    Hi all,

    I have an application where a STR912 communicates with a PIC controller using CAN bus.

    The STR912 sends data to the PIC controller.

    when I configure the STR CAN device in testmode with loopback enabled (not silent), It works fine.

    On my oscilloscope, I see a valid CAN message and my PIC receives this message correct.

    However, when I disable the loopback, on the oscilloscope I see a train of pulses for 1 second and the pic does not receive any valid message. I use the STR912 library.

    I think it has something to do with bus-arbitration, but the function CAN_sendMessage() does not return an ERROR condition.

    Can somebody help me please.

    Luc vercruysse.

    Visitor II
    May 17, 2011
    Posted on May 17, 2011 at 09:44

    Try changing the bit timing

    In 91x_can.c if have changed the line:

    CAN_TIMING(11, 4, 4, 4), /*0x3AC3 125 kbit/s 16 11 4 4 4 */

    to:

    CAN_TIMING(13, 5, 4, 40), /*0x3AC3 125 kbit/s 16 11 4 4 4 */

    I am using ST library and and 96MHz PCLK.

    The timing is not perfect but works for my first test.

    Visitor II
    May 17, 2011
    Posted on May 17, 2011 at 09:44

    Hi,

    Thank you for response. I did already change the baudrate settings to the correct settings.

    There were 2 problems, one problem on the PIC-side.

    After solving this problem it still didn't work.

    As I sead in an earlier thread

    http://mcu.st.com/mcu/

    there are problems using UARTs on port3 in combination with CAN on port 5.

    I found out that when defining the Txd pins (as output)on port 3, you have to disconnect them from input function using GPIOInit.GPIO_IPConnected = GPIO_IPConnected_Disable.

    I think I have to start a new thread with this bug, somewhere on this forum somebody has the same problem.

    Luc