Need your help:How can I access MSCAN with Processor Expert

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

Need your help:How can I access MSCAN with Processor Expert

Jump to solution
1,757 Views
AliasKid
Contributor I

Hi all,

        

        I am new to Processor Expert . My English is not that good ,forgive me if somehow cause a misunderstanding .Here below is what U may help me :

  1. 1. I am nOw working on a DEMO09S12XEP100 bord without a hardware     data sheet in my hand...:smileysad:
  2. 2. I am now using PE to configure my MSCAN ,but it still can not work ,I can't receive any data from the CAN PORT.
  3. 3. How can I divide the standard fram and  extended frame?
  4. 4. Do I need an initialization function to be put into the MAIN () if I have already set  CAN initialization "init.code" enable?
  5. 5. Anything can be helpful!

best regards !

 

hefei

BATTERY MANAGEMENT SYSTEM R&D.WXEV

0 Kudos
1 Solution
1,083 Views
ProcessorExpert
Senior Contributor III

Please find attached a simple demo project for HCS12 C32 that you may find useful. It  does a simple "bridge" between SCI and CAN (MSCAN) with using FreescaleCAN. It receives characers on SCI and sends them via CAN and vice versa. It also shows  reading ADC and settings PWM. 

 

You can also find some basic code snippets on "Typical usage" page of the help for the Freescale_CAN component.

 

best regards
Petr Hradsky
Processor Expert Support Team

 

View solution in original post

0 Kudos
12 Replies
1,083 Views
Petr_H
NXP Employee
NXP Employee

I attach the example project. It was probably accidentally removed during forums migration.

best regards

Petr Hradsky

Processor Expert Support Team

0 Kudos
1,083 Views
james07
Contributor I

Hello all, i´m new with the P.E too, and i´m in trouble  trying to configure the MSCAN on Cold Fire V1.

I tryed to find the attached simple demo project for HCS12 C32 but i didn´t get anything. I´m using CW 6.3. To be honest, i´m starting with the CAN module, i don´t have a simple idea how to procedure. Could anyone help me?

Petr Hradsky or anyone else, could you direct me , where can i find that useful bridge document  about SCI and CAN?


Thank you!

0 Kudos
1,083 Views
AliasKid
Contributor I

first,U need a license.

second,you can find everything in your PC somewhere like :\Freescale\CodeWarrior for Microcontrollers V6.3\ProcessorExpert\Projects\Test projects

This can BE a lot help :smileyhappy:

0 Kudos
1,083 Views
james07
Contributor I

Hi Steven, i have already a license for the MCU Code Warrior 6.3, but that library doesn´t contain that micro controller that you are using, because of that i would like to see a demo project to configure mine.  I found the Typical Usage that you all were refering to. Thanks! I apreciate very much!

P.S. do you have a document, or PDF that you can show me, a little example of the can process? I´m really lost about it =\

After all, i´m going to reconfigure my MCU and see if a can handle that.

Best regards;

0 Kudos
1,083 Views
AliasKid
Contributor I

I will be back later and answer your question . I am quite busy right at the moment~

0 Kudos
1,083 Views
ProcessorExpert
Senior Contributor III

Hi,

 

ad 1) Do you mean board documentation ? The schematics is available at 

http://cache.freescale.com/files/soft_dev_tools/hardware_tools/schematics/DEMO9S12XEP100_SCH.pdf?fps...

other documents are also available on the product page:

http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=DEMO9S12XEP100&fsrch=1

 

ad 2) What PEx component do you use for the configuration? There are two available - Init_MSCAN that provides just initialization code and Freescale_CAN component that also provides a runtime methods for CAN communication and it's commertial (can be bought from Freescale).

 

ad 4) If you set Init.code to enable, you don't need to call the initalization from the main, it's handled in PE_low_level_init() function.

 

For debugging purposes I recommend to enable loop-back mode and also enable error interrupt/event. If you send anything in loop mode, you should receive it immediatelly. 

 

best regards
Petr Hradsky
Processor Expert Support  Team

 

0 Kudos
1,083 Views
AliasKid
Contributor I

Hi, thank you for the board documentation . YEAH , I do use  Freescale_CAN component for my  configuration .Thank you again for telling the initalization is handled in PE_low_level_init() function ,otherwise  the compiler  may keep warn me for ignoring it .

 

I had been woking on  the loop-back mode configuration these days . Somehow it meets problems that I can not tell exactly .

DO U have a DEMO PE project for  CAN communication ? Or  where can I find a tutorial documentation for  PE MSCAN configuration ?

 

Thank you so much !

 

best regards !

He Fei

BMS R&D.WXEV

0 Kudos
1,084 Views
ProcessorExpert
Senior Contributor III

Please find attached a simple demo project for HCS12 C32 that you may find useful. It  does a simple "bridge" between SCI and CAN (MSCAN) with using FreescaleCAN. It receives characers on SCI and sends them via CAN and vice versa. It also shows  reading ADC and settings PWM. 

 

You can also find some basic code snippets on "Typical usage" page of the help for the Freescale_CAN component.

 

best regards
Petr Hradsky
Processor Expert Support Team

 

0 Kudos
1,083 Views
AliasKid
Contributor I

:smileytongue:  It is me again .I have got two questions here :

         

   first,do I need to confige the PINs through the CAN configuration?Most of the time I cannot see them(or it) .

 

   second ,during the CAN1_SendFrame()function ,I got a "transmit buffer full error" all the time .what can I do ?

 

/*

 

 if (!(CAN0TFLG & bufmask)) {         /* Is the transmit buffer full? */
    return ERR_TXFULL;                 /* If yes then error */
  }


*/

 

Attachment:  picture for the first question ,the other for the second and my code is in event.c document .thank you !

0 Kudos
1,083 Views
ProcessorExpert
Senior Contributor III

Hi,

 

ad 1) Yes, the pins need to be selected. From your screensot, there seems to be a problem that you have two Freescale_CAN components in the project - you should remove one of them.

 

ad 2) This error means that your message wasn't received. In CAN communication, the message is not treated as sent  until the receiving  device acknowledges the reception. The problem might be that you don't have target device properly connected, it doesn't work or the timing configurations of the transmitter and receiver do not match.

 

best regards
Petr Hradsky
Processor Expert Support Team

 

0 Kudos
1,083 Views
AliasKid
Contributor I

Thank you so much ! My  target device  was not connected properly   :smileyvery-happy:

0 Kudos
1,083 Views
AliasKid
Contributor I

HAHA ,the "Typical Usage" pageis just amazing !!!

I happened TO go to the "Bean FreescaleCAN page"early today ,some how just miss it ! THE Typical Usage page !! Thanks a lot ! Now I am going to read all of them !

Thank you again for all your kindhearted help !!!   :smileyvery-happy:

 

I will be back soon ~~~

0 Kudos