CAN Tx Timeout on MOD5441X

Discussion to talk about software related topics only.
Post Reply
GeneralUser
Posts: 17
Joined: Mon Apr 21, 2014 4:49 am

CAN Tx Timeout on MOD5441X

Post by GeneralUser »

Hey guys, anyone know what would cause a CAN Tx timeout when calling the SendMessage() function? My CanInit() returns OK and if my channels were either not available or all in use, I would get a different return value from SendMessage(). I have my CAN Rx and Tx connected to a CAN transceiver as well but if there was a wiring issue, would that cause this error?

Setup the CAN0 pins as such:

Code: Select all

J2[41].function(PINJ2_41_CAN1_RX);
J2[44].function(PINJ2_44_CAN1_TX);
CAN Tx Code:

Code: Select all

resultOK = SendMessage(NormToNbId(107), (PBYTE) txbuffer, strlen(txbuffer), 250);
Any help would be appreciated....
mbrown
Posts: 61
Joined: Tue Jan 29, 2013 7:12 pm

Re: CAN Tx Timeout on MOD5441X

Post by mbrown »

It looks like you may be confusing which CAN module you're using. You mention you're initializing CAN0, then set up the pins for CAN1. If you're using CAN0 (and the canif.h files), you need to actually initialize pins 39 and 42. While CanInit may return OK, the init call pretty much sets up the appropriate registers for use, turns on an interrupt then says I'm ready to run. If you're using CAN1, you'll need to use the multican.h files as your include and interface. The functionality is the same as the canif.h files, there's just an extra argument in front of all the calls for which CAN module you're addressing.

If you're doing what I think you're doing, you've initialized the registers for CAN0, but want to use the CAN1 lines. The chip says it's inited okay, but you're timing out because the CAN module is trying to listen on the 0 lines and not hearing anything.

If this is your first time using our CAN module, you'll also need to know that you'll probably need an external CAN transceiver. The MOD-DEV-70s do not have one of these. If you're using a MOD-DEV-100, it does, but you'll have to configure the jumpers such that the CAN1 pins are attached to the transceiver to get this working properly if that's what you're doing. If you're using your own hardware, I'm just assuming you've connected things appropriately, but it may also be helpful for debugging here for you to include a schematic or diagram or explanation of how you've attached your hardware.
GeneralUser
Posts: 17
Joined: Mon Apr 21, 2014 4:49 am

Re: CAN Tx Timeout on MOD5441X

Post by GeneralUser »

Ok, I made the change to CAN0 (no need to use CAN1 on my side). So with that said, everything is the same but still get the -5 return. I am using a CAN transceiver, so if my wiring is not correct, would this cause a timeout? Just trying to understand from the CAN side of things what causes timeouts....

Setup CAN0

Code: Select all

J2[39].function(PINJ2_39_CAN0_RX);
J2[42].function(PINJ2_42_CAN0_TX);
Thomasj
Posts: 3
Joined: Sun May 11, 2008 2:46 pm

Re: CAN Tx Timeout on MOD5441X

Post by Thomasj »

Hi,
The CAN protocol requires that at least one other node acknowledges the transmission. Do you have other nodes connected to your CAN bus ?
User avatar
pbreed
Posts: 1087
Joined: Thu Apr 24, 2008 3:58 pm

Re: CAN Tx Timeout on MOD5441X

Post by pbreed »

If there is no CAN receiver listing to that CAN message it never gets an ack and times out....

Every CAN message is acked......

So if there are no other CAN devices on your can net ALL messages will time out...
Post Reply