cancel
Showing results for 
Search instead for 
Did you mean: 

CAN bus

craig239955_st
Associate II
Posted on June 05, 2007 at 11:11

CAN bus

3 REPLIES 3
craig239955_st
Associate II
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.

heiko2399
Associate II
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.

craig239955_st
Associate II
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