S32K142EVB LIN with Simulink

cancel
Showing results for 
Search instead for 
Did you mean: 

S32K142EVB LIN with Simulink

Jump to solution
428 Views
Contributor I

I would like to use the NXP Model-Based design toolbox to access the LIN peripheral on the S32K142EVB board.  Per the schematic, the LIN transceiver is connected to LPUART2 on pins PTD6/PTD7.  However, LPUART2 doesn't seem to be available in the LPUART_Config block when the S32K142 device is selected.  It is available when the S32K144 is selected, but that's not the correct device for the evaluation board.  How can I access LPUART2 with the S32K142 for use with the LIN transceiver?

Thanks,

Andy

0 Kudos
1 Solution
68 Views
NXP Employee
NXP Employee

Andy,

What version of the board do you have.  According to the latest schematic you should be able to take the LIN transceiver to UART0.  Please check the attached schematic.  To answer your questions you can definitely rework the board to take the TX/RX lines to a UART port of your choosing.

View solution in original post

5 Replies
69 Views
NXP Employee
NXP Employee

Andy,

What version of the board do you have.  According to the latest schematic you should be able to take the LIN transceiver to UART0.  Please check the attached schematic.  To answer your questions you can definitely rework the board to take the TX/RX lines to a UART port of your choosing.

View solution in original post

68 Views
Contributor I

Thanks John, oversight on my part, I do have a Rev D board and was looking at the wrong schematic.  Looks like I should be good with LPUART0.

Andy K.

0 Kudos
68 Views
NXP Employee
NXP Employee

Hello andyknitt‌,

The short answer is that the data is automatically generated from a specific document, and that instance with the corresponding pins are not present there. Now for the longer answer:

Firstly I would like to go into some details about how we get the data that is displayed for the pin information in every block from our toolbox - we parse the S32K14x_IO_Signal_Description.xls document that comes with S32K-RM.pdf [available here]. We then save the data that we need from those documents in some .mat files. We then split them (by pin functionality). All this process is automated and based on what data is available in the Signal Description document provided. I have checked this document, and there seems to be no LPUART2 instance - this is the reason why it doesn't appear in the pin list for the configuration block of LPUART. Do you have other schematic/RM for S32K142? If yes, can you tell me what version? And what revision of the S32K142? b14714‌ do you have any insight regarding this matter?

Secondly, after explaining how the pin information is generated and displayed, I'd like to explain a mechanism for adding any extra pin you might want - with the mention that you'll have to make sure that what you are adding is in sync with the hardware you are using. 

If you go to {ROOT_TBX_DIR}\mbdtbx_s32k\devices\S32K142\signal_description you can find all the .mat files used for pin information management. You can manually edit each of these. For functionality only, you can edit the first 4 columns - e.g.:

[Port Name]       [Pin number]        [Mux selection]          [Port instance]

   PORTB                   5               PORT_MUX_ALT2               PTB

(The other columns are for extra information - displaying purposes.) After editing this .mat file and adding what entry you need, save it with the same name as it was. For all these operations, you can use the load and save MATLAB functions - e.g.:

var_name = load('C:\....\devices\S32K142\signal_description\LPUART0_RX.mat');

var_name.to_load{1}{1} = 'PORTD';

var_name.to_load{1}{2} = '7';

var_name.to_load{1}{3} = 'PORT_MUX_ALT4';

var_name.to_load{1}{4} = 'PTD';

save(''C:\....\devices\S32K142\signal_description\LPUART0_RX.mat', 'var_name');

In this example we've added PTD7 as another pin option for LPUART0_RX. With this in mind, you can enable any pin you want for any instance, if that instance exists. If it does not - as in your example - you'll have to do one more step: add a .mat with the instance name in {ROOT_TBX_DIR}\mbdtbx_s32k\devices\S32K142 - e.g.: add LPUART2.mat

here - just an empty file would be enough. After this, you can copy a LPUART0_RX.mat file and rename it as LPUART2_RX.mat, then do the changes as explained above - this way you can add a new instance & the pin information you want to add. 

Best regards,

Razvan.

0 Kudos
68 Views
Contributor I

Thank you for the detailed response.  The schematic I am referencing that shows LPUART2 with the S32K142 is here:

https://www.nxp.com/downloads/en/schematics/S32K142EVB-SPF-29701-RC.pdf

I see now what you are saying...there is no mention of LPUART2 in the reference manual for the S32K142, only for the S32K144.  I wonder if the evaluation board is the same for both devices and this was an oversight with the connection to the LIN transceiver for the S32K142 variant?  If that is the case, I believe I could remove R130 and R131 and flywire LPUART1 to those pads?  It would be helpful to get confirmation that this is necessary before taking that step though.

Regards,

Andy

0 Kudos
68 Views
NXP Employee
NXP Employee

johna123‌,

Who can confirm this ?

We (MBDT team) might not be the appropriate team for such suggestion.

Thank you!

Daniel 

0 Kudos