Hi All,
can i find any sample code on how to write CAN driver for MSCAN in MC9S08DZ60 and how to read and write the CAN Message Buffers.
Please help me thanks in advance.
Solved! Go to Solution.
Certainly something is wrong in your code. I saw no such problems in S08DZ or any other MCU with MSCAN module.
Hi weiping,
I am working with the example code given by you but the problem is while i am trying to send a CAN message it is not completing the transmission, its blocked in polling the transmission complete flag, can you please solve me this issue, FYI i am using TLE7250 CAN Tranceiver. Thanks in advance.
Hari
Hi Hari,
Is there a receiver nodes? if not, transmitter won't get successful transmission because of no ACK received.
B.R
Weiping
Hi weiping,
Thanks for the reply,as you informed i have configured another Hardware as a receiver in listen only mode and connected to the CAN bus, but its of no use,
the problem still remains the same, code is blocking in the while loop for checking the completion of transmission, and it is incrementing the transmitter error count.
As i know CAN doesn't require any acknowledgement for completing transmission as it is not a peer to peer communication protocol, but i tried as you informed and is of no use. So, can you please help me out to clear this problem.
Regards,
Hari
Hi Satuluri,
kef2 is right!
And that's the problem. In listen only mode node can't ACK messages from other nodes. No ACK forces sender to resend it's message. Without active no-listenonly node your sender can't complete sending.
You know it wrong.
Hi Edward Karpicz,
Thanks for your reply, i got resolved with the problem of transmission complete flag. But i got struck with another problem,
Here while i am transmitting CAN frame in another node i am able to receive it, but while receiving i am getting the exact ID what i am transmitting but the data is being corrupted. So, can you suggest me any procedure or any validations i need to check while transmitting or receiving data.
Generally speaking, if the ID is correct,data can't be error. are you sure the transmitter send the data you want?
In additon, it's recommend to use external crystal as CAN' clock source,
Hi kef2& Weiping,
Thanks for your support, i had successfully transmitted and received the CAN Frames, I got solved with the problem of receiving wrong data.
The problem is while i am continuously transmitting data i have not updated my data pointer which is incrementing while loading into registers, i got the bug and solved it thanks for you support.
Hari.
Ya, weiping i am using external 4Mhz crystal connected as the Clock source, but still i am having same problem..
I don't believe data is corrupted. Isn't it that you set data size to be less than 8 bytes, but you still expect all 8 bytes to be sent properly? Or something like that?
Hi Edward,
I am sure of sending 4 bytes of data and checking for the 4 bytes of data in receiver end.
I can see the transmitted Data 4 bytes in CANTDSR registers while transmitting, but while receiving i am getting 0xFF in CANRDSR0, CANRDSR1, CANRDSR2, CANRDSR3 registers.
Are you trying to send any data with RTR bit set? RTR=1 messages can't carry any data.
I am checking the RTR bit too it is in Reset state only, I am able to get the CANRDLR value as i am transmitting, but the received data is 0xFF only.
Certainly something is wrong in your code. I saw no such problems in S08DZ or any other MCU with MSCAN module.
Dear Mr. Karpicz,
thank you for your information; I think that I mailed by an incorrect subject.
Yours
Franz Raaber
Von: Edward Karpicz
Gesendet: Mittwoch, 21. August 2013 11:13
An: Raaber Franz
Betreff: Re: - MC9S08DZ60 MSCAN
<https://community.freescale.com/>
MC9S08DZ60 MSCAN
reply from Edward Karpicz<https://community.freescale.com/people/kef2?et=watches.email.thread> in 8-bit Microcontrollers - View the full discussion<https://community.freescale.com/message/345893?et=watches.email.thread#345893>
Hi weiping,
Thanks for your reply i have completed the code and testing it in loop back mode.thanks for your help..