MC9S08DZ60 MSCAN

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

MC9S08DZ60 MSCAN

Jump to solution
3,817 Views
harisatuluri
Contributor III

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.

Labels (1)
1 Solution
2,592 Views
kef2
Senior Contributor V

Certainly something is wrong in your code. I saw no such problems in S08DZ or any other MCU with MSCAN module.

View solution in original post

0 Kudos
Reply
17 Replies
2,592 Views
weapon
Senior Contributor I

Hi Satuluri, we provide MSCAN driver in our website. you can search "mscan driver for s08" in our website, then you'll find the link.

In addition, I attached one simpe demo for your reference, which is much earier to understand than that MSCAN driver. Hope it'll be helpful.

2,592 Views
harisatuluri
Contributor III

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

0 Kudos
Reply
2,592 Views
weapon
Senior Contributor I

Hi Hari,

Is there a receiver nodes? if not, transmitter won't get successful transmission because of no ACK received. 

B.R

Weiping

2,592 Views
harisatuluri
Contributor III

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   

0 Kudos
Reply
2,592 Views
weapon
Senior Contributor I


Hi Satuluri,

kef2 is right!

2,592 Views
kef2
Senior Contributor V
  • 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,

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.

  • As i know CAN doesn't require any acknowledgement for completing transmission

You know it wrong.

2,592 Views
harisatuluri
Contributor III

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.

0 Kudos
Reply
2,592 Views
weapon
Senior Contributor I


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,

0 Kudos
Reply
2,592 Views
harisatuluri
Contributor III

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.

0 Kudos
Reply
2,592 Views
harisatuluri
Contributor III

     Ya, weiping i am using external 4Mhz crystal connected as the Clock source, but still i am having same problem..

0 Kudos
Reply
2,592 Views
kef2
Senior Contributor V


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?

0 Kudos
Reply
2,592 Views
harisatuluri
Contributor III

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.

0 Kudos
Reply
2,592 Views
kef2
Senior Contributor V

Are you trying to send any data with RTR bit set? RTR=1 messages can't carry any data.

0 Kudos
Reply
2,592 Views
harisatuluri
Contributor III

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.

0 Kudos
Reply
2,593 Views
kef2
Senior Contributor V

Certainly something is wrong in your code. I saw no such problems in S08DZ or any other MCU with MSCAN module.

0 Kudos
Reply
2,592 Views
franz_raaber
Contributor II

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>

0 Kudos
Reply
2,592 Views
harisatuluri
Contributor III

Hi weiping,

     Thanks for your reply i have completed the code and testing it in loop back mode.thanks for your help..

0 Kudos
Reply