s12zvl LIN Pin used as SCI

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

s12zvl LIN Pin used as SCI

2,084 Views
charudattaingal
Contributor IV

Dear Team,

 

I want to use dedicated LIN Pin of s12zVL micro-controller as a SCI.

Is It possible to use LIN pin of s12zVL as a SCI?

I want to configure LIN pin as a SCI.

 

If it is possible May I know How I can use LIN Pin of s12zVL Micro-controller as SCI.

 

 

Thanks & Regards,

Charudatta

Labels (1)
9 Replies

1,313 Views
charudattaingal
Contributor IV

Hello RadekS,

I am getting some junk data in RX and TX buffer, I am sending data (TX)  though LIN master and expecting TX  data transmitted by S12zvl on LIN bus.

I have limited knowledge of hardware, please Let me know how I will split TX/RX data present on LIN pin?

I want to use RS232  interface for receive and transmit  data over LIN bus.

Thanks & regards

Charudatta

0 Kudos

1,313 Views
RadekS
NXP Employee
NXP Employee

Hi Chrudatta,

Thank you for more information.

If you use LIN PHY in MCU, you need any LIN PHY also on opposite side.

However as you already mentioned, the misunderstanding probably comes from your limited knowledge of hardware.

LIN bus and RS232 buses are not compatible technologies.

https://en.wikipedia.org/wiki/RS-232

https://en.wikipedia.org/wiki/Local_Interconnect_Network

You will probably need some RS-232 line driver like MAX232 or something faster (like ICL3225E, MAX3387E, …) instead of LIN PHY:

http://datasheets.maximintegrated.com/en/ds/MAX220-MAX249.pdf

If your second node is for example PC, you could use directly converter from SCI(UART) to USB like FTDI FT232R, Profilic PL2303 or SiLabs CP2102,…

In both cases, you could use SCI1 (PT0,1 or PT4,5). If you want use SCI0, you have to route SCI0 signals to external pins. For example:

MODRR0 = 0x0E; //route IIC0 to PJ0,1; SCI1 to PT4,5; SCI0 to PS0,1; LIN PHY to PT0,1


I hope it helps you.

Have a great day,
RadekS

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

1,313 Views
RadekS
NXP Employee
NXP Employee

Hi Charudatta,

It seems that your question is almost the same as here:

https://community.freescale.com/thread/387565

https://community.freescale.com/thread/388020

I am slightly confused by your questions. Do you want implement LIN protocol communication or you just want to send SCI data over LIN bus to another S12ZVL board without implementation of LIN protocol?

Official LIN stack:

http://www.nxp.com/files/microcontrollers/software/device_drivers/FSL_LIN_2.X_STACK.zip

This stack already contains LIN examples for S12ZVL.


I hope it helps you.

Have a great day,
RadekS

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

1,313 Views
ibraheem_raed
Contributor I

those links doesn't work. it says page not found

0 Kudos

1,313 Views
RadekS
NXP Employee
NXP Employee

Hi Ibraheem,

you are right. The LIN stack was renamed. The right address for download is now:
https://www.nxp.com/webapp/Download?colCode=FSL_LIN_2.X_DRIVER 

The Freescale domain was changed to NXP after Freescale+NXP merge. They should work fine when you click on it.

Best regards

Radek

1,313 Views
charudattaingal
Contributor IV

RadekS,

I don't want to implement LIN protocol communication, I just want to send/receive SCI data over LIN bus to another device ( Custom tool) without implementation of LIN protocol, but using LIN Pin available on S12ZVL Micro_controller.

Is there any way to configure LIN Pin as as SCI ?

(Bypass the LIN Phy / SCI on top of LIN)

Basically I want to Implement UART functionality on LIN Pin.

Thanks & Regards,

Charudatta

0 Kudos

1,313 Views
RadekS
NXP Employee
NXP Employee

Hi Charudatta,

Thank you for clarification.

SCI0 module is routed to LIN PHY by default at S12ZVL.

So, you need just configure SCI and LIN PHY module.

After that, SCI TX signal should be visible on LIN bus.

There aren’t any special settings for SCI over LIN.

LIN PHY could transmit SCI signals up to 250kbit/s.

Note: since LIN is one wire bus, SCI will simultaneously receive these TX data.

Note: Despite on fact that you will not implement LIN protocol, I would like to recommend external diode and 1k pull-up at master side.  See Figure 18. Circuit diagram for LIN Interface in application note AN5084 Hardware Design Guidelines for S12ZVL Microcontrollers

http://www.nxp.com/files/microcontrollers/doc/app_note/AN5084.pdf

Could you please share you code and describe what do not work on your side?


I hope it helps you.

Have a great day,
RadekS

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

1,313 Views
charudattaingal
Contributor IV

Hello RadekS,

I appreciate your help.

Thank you very much.

I am not able to upload CW project file on Freescale community.

I will mail you the same,hope you will get the file.

Have a great day,

Reagrds,

Charudatta

0 Kudos

1,313 Views
RadekS
NXP Employee
NXP Employee

Hi Charudatta,

I shortly checked your code.

I see in your code command:

SCI0CR1= 0xA0; /* Loop operation Enable ,=Receiver input connected externally to transmitter */

LOOPS and RSRC bits are sets = Single-wire mode with TXD pin connected to the receiver input.

However, setting the LOOPS bit disables the path from the RXD pin to the receiver.

This is the reason, why you cannot receive any data from LIN bus.

Please do not use SCI Single-wire mode for connection to LIN PHY.

SCI0 is connected to LIN PHY by two lines = TX and RX pins. LIN PHY is responsible for transform to single wire bus.

So, I would like to recommend:

SCI0CR1= 0x00; /* Loop operation Disabled */

In that case, command SCI0SR2_TXDIR =0x0; has no meaning and it could be deleted.

I hope it helps you.

Have a great day,
RadekS

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------