You are here

CAN Communication | Cypress Semiconductor

CAN Communication

Summary: 12 Replies, Latest post by hli on 13 Nov 2013 03:27 AM PST
Verified Answers: 0
Last post
Log in to post new comments.
IvanFdez's picture
User
8 posts

Hello

I have CY8CKIT-030 board kit and CY8CKIT-017 CAN board, I try to listen CAN communication and for this reason, I installed on my board the CAN example.

But CAN protocol is extended (29 bits), and Bitrate=50kbit, and I don't know where I must change CAN parameter to listen correctly.

In my example, the application return me Rx errors and I think that the problem is CAN configuration.

I changed differents parameter in CAN setup, but it doesn't work ok

 

Thank you in advanced

IvanFdez's picture
User
8 posts

I have a CAN controller to 50 Kbps... and then I put this values to configure CAN:

Settings

BRP=41

Tseg1=3

Tseg2=5

Calculator

24000KHz (disabled)

Desired Baud rate= 20Kbps

SJW=1

Sample Mode=1-Sample

 

Are these values correct?

Thank you

Ranjith M's picture
Cypress Employee
11 posts

 

Hi,

I assume you are using two PSoC CY8CKIT-001s  and two CY8CKIT-017s for the CAN communication. Make sure that the settings for CAN component in both the PSoCs are the same for 'Timing' tab. 

Try these:

Settings

BRP = 2

TSEG1 = 11

TSEG2 = 4

Calculator

Clock frequency = 24000kHz

Desired Baud Rate = 500Kbps

SJW = 1

Sample mode = 1-Sample

Ranjith M's picture
Cypress Employee
11 posts

 Hi,

You can also go to the following link and download the project with this Application Note and try it.

http://www.cypress.com/?rID=37766

Another sample project is available within the PSoC Creator itself. Go to the Start page, in Examples and Kits section, choose Find Example Project. Program the CANExampleControl project in one PSoC and CANExampleRemote in the second PSoC. 

Thanks,

Ranjith

IvanFdez's picture
User
8 posts

I use a CAN example, but the application return me Rx errors then I suppose that the problem is with timing parameters.

I don't know what values introduce to use a device 50 kbps and 12 Mhz

 

IvanFdez's picture
User
8 posts

I use a CAN extended transmiter connected to CY8CKIT-017 and this to CY8CKIT-030. 

hli
user_78878863's picture
User
2759 posts

You can use the timing calculator to calculate the values. Just enter the desired baud rate. After that, the table below show possible values. Check the CAN component data sheet (page 5) for an explanation of these values.

I would suggest a setting of BRP=39, Tseg1=5, Tseg2=6. This gives a sample point right in the middle of the cycle.

For the 29 bit protocol, look at the data sheet again (page 12 ff). There you see that you need to configure the mailbox correctly (set it to Full=yes, IDE=yes, then you can enter a 29-bit address).

IvanFdez's picture
User
8 posts

If my CAN transmitor has clock 16 Mhz, I must change Cypress project demo and I must modify BUS_CLK to 16Mhz?

hli
user_78878863's picture
User
2759 posts

The crystal frequency of the CAN bus master should not matter, only the baud rate. So when you have set the CAN component to the correct baud rate, you should be fine.

IvanFdez's picture
User
8 posts

Ok, It works fine with 125 Kbps, but could I configure Crypress project to use 50 Kbps?

In desired Baud rate options, there are posibilities: 1000, 800, 500, 250, 125, 62.5, 20, 10

 

Thank you

IvanFdez's picture
User
8 posts

With BRP 39 Tseg1 5 and Tseg2 6, I think that it works ok

 

Thank you

Log in to post new comments.