M52235EVB - FlexCan Bus Off

cancel
Showing results for 
Search instead for 
Did you mean: 

M52235EVB - FlexCan Bus Off

5,020 Views
Contributor II
I'm trying to initialize my M52235EVB FlexCan controler and I'm getting a state of the ERRSTAT register that told me the Bus is off (ERRSTAT = 0x00004036). The module is enabled, and I have set the first Message Buffer Code to 1100b with fake data to see if the Code change to 1000b, but it stays in the 1100b state.

Is there any jumper I have to modify from the board ?

Thank you and have a nice day

Fred Talbot

--
Alban Edit: Please always include FSL Part Number in Message Subject line.
http://forums.freescale.com/freescale/board/message?board.id=FORUMUSE&message.id=865



Message Edited by Alban on 2007-10-16 09:18 PM
Labels (1)
0 Kudos
7 Replies

119 Views
Contributor II
I'm using an CAN-USB device as my second CAN device.

I was using the internal clock (CLK_SRC set in CANCTRL register) and I had a timing problem. The M52235EVB have a 25MHz crystal and the SYNCR MFD bits have a 0x4 value, and RFD have 0x0, so the internal clock should be 25MHz x 12 = 300 MHz, but when setting PRESDIV using 300 MHz, communication doesn't work. I've try with 300MHz/2 = 150 MHz too, cause the documentation is talking about F(sys/2), but it doesn't work either.

I actually working with EXTAL as clock source (CLK_SRC bit in CANCTRL register), and set PRESDIV with this value and the communication is working well, so maybe my internal frequency isn't 300MHz or 150MHz.

Alban, you're talking using 2 CAN modules of the same micro. Are you talking about setting the RX buffers to different ID, or there is multiple CAN controler on the micro ?

Thank you for your help

Fred Talbot


Message Edited by FredT on 2007-10-19 04:45 PM
0 Kudos

119 Views
Senior Contributor I
Hi Fred,
  Be sure the core frequency doen't go over the max spec of 60MHz.   This is the output frequency from the PLL.  The system frequency, which many of the peripheral modules run off, is half the core frequency.  We recommend that you set the CCHR (pll pre-divider), then set the RFD to your desired RFD plus 1, set MFD, then put RFD where you want it.  This will ensure that the core frequency doesn't exceed its maximum while the PLL is being set up.
 
Regards,
Mac
0 Kudos

119 Views
Contributor II
Thank you for the infos Macl.

Now I'm trying to set a interrupt when a message is received, but it isn't clear where to set it. I've set the IMASK and IFLAG register so interrupt will be called, but where am I suppose to indicate the adress of the function I was to be call when a new message is received.

I've look in Chapter 15 Interrupt Controler Module of the manual, and I read about the exception vector table that containt the adress, but I didn't saw something about where the Message Buffer is in the table, and where is locate the table.

Fred Talbot
0 Kudos

119 Views
Contributor II
More info: my ERRCNT register increase regulary. Is the bit timing configuration can generate error in this register ?
0 Kudos

119 Views
Senior Contributor II
Hello Fred,

I don't know your product, but CAN.
You need another node on the network to acknowledge reception of the message you sent.
Otherwise your node will flag an error each time a message is not acknowledged.
8 by 8 the counter will increase.
It will go from Error Active to Error Passive and end in Bus Off mode.

You need another node with the same timing configuration for them to talk to each other and then the Error Counter will stay at 0 and traffic work.

Alban.
0 Kudos

119 Views
Contributor II
Thank you Alban. I wasn't understanding the loop back mode.

Using LPB in CANCTRL for testing is a good idea finaly...

To the others beginners like me, the SYNCA and SYNCB pins must be set to CANTX and CANRX. I had to initialize all the Message Buffer cause the MAXMB in CANMCR is by default at 16.

Now I'm using the loop-back mode and the ERRCNT stay at zero. I'm filling a Message Buffer configure in Tx with data and set the Code field at 0xC to send it and the Code field change to 0x8, and the TimeStamp filed by CPU, so the transmission is Ok. One of my Message Buffer is set to the ID of my transmission, so it receive the message and change the code from 0x4 to 0x2.

Rock on !!!

Fred Talbot


Message Edited by FredT on 2007-10-18 03:44 PM
0 Kudos

119 Views
Senior Contributor II
Great News Fred,
 
Thanks for telling us that it is working now.
Another possibility is to link two CAN modules of the same micro.
 
I'm not sure that the Loop Back mode is actually sending on the bus.
 
Alban.
 
0 Kudos