S12C128 MSCAN Module

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

S12C128 MSCAN Module

1,952 Views
liam5360
Contributor I
Hi,

I have developed some code for the S12X which utilises the MSCAN module, however we will be using the S12C128 for the final product and I'm currently porting the code to this processor. On the S12C128, the RXCAN and TXCAN connections use the same pins and PORTM, pins 0 and 1. The default mapping for these pins is for I/O use rather than CAN, and I can't seem to find anything in the data sheet about how to change the mapping. Any suggestions?
Labels (1)
0 Kudos
4 Replies

382 Views
Lundin
Senior Contributor IV
CAN will have precedence. Check DDRM on p93 in the manual.

"If SPI or MSCAN is enabled, SPI and MSCAN modules determines the pin directions."

Every port on the S12 works in the same way, GPIO has got the lowest prio. As soon as you enable anything else the corresponding GPIO pins will be disabled.
0 Kudos

382 Views
liam5360
Contributor I
Thanks for the response. I had seen this line in the data sheet myself, however I am still having problems with CAN communication on the S12. Code which worked correctly on the S12X is currently being run on the S12 and waits infinitely for a CAN message to be sent. I suspected that the problem was with the connection to the tranceiver, as the program functions correctly when tested in loopback mode. Any suggestions for this problem would be greatly appreciated.
0 Kudos

382 Views
Lundin
Senior Contributor IV
Yes, it sounds like a hardware problem.

I'm assuming that you haven't done the classic mistake and tried the CAN with no other nodes on the bus, because then you'll get the error you describe.
0 Kudos

382 Views
liam5360
Contributor I
Thanks for the help, after two days of pulling my hair out over this, I've tracked the problem down to a faulty CAN transceiver. Tried another one and it all works fine now!
0 Kudos