MPC5744p S32DS LINBUS master slave example

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

MPC5744p S32DS LINBUS master slave example

2,911 Views
akovacevic
Contributor I

Hello everyone,

Could someone help me with information about whether there is an MPC5744p LINBUS Master/Slave example for S32 Design Studio?

Thank you!

0 Kudos
Reply
8 Replies

2,901 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

there are LIN master and slave examples within S32DS, so you can refer to it.

PetrS_0-1692959754415.pngPetrS_0-1692959754415.png

BR, Petr

0 Kudos
Reply

2,865 Views
akovacevic
Contributor I

What is the best approach here to use the SDK and LIN bus? I tried generating a LIN message with linflexd_uart, but generating that break and wakeup isn't possible. Should I use TX as a digital output?

0 Kudos
Reply

2,812 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

as far as I know there's no LIN support in the SDK and there are no plans to add it.

BR, Petr

0 Kudos
Reply

149 Views
akovacevic
Contributor I

The attached ZIP contains the modified driver files 

Tested configuration:
- MPC5744P
- S32 Design Studio for Power Architecture 2.1
- S32_SDK_S32PA_RTM_3.0.3
- INST_LINFLEXD_UART2
- FreeRTOS
- Two physical slave controllers

Implemented functionality:
- LIN break and 0x55 synchronization byte
- Protected identifier generation and validation
- Master header transmission
- Interrupt-driven slave response
- Classic and enhanced checksum
- Frames with up to 8 data bytes
- Response timeout handling
- Recovery after a slave is disconnected, reset or reconnected
- Polling of multiple slave identifiers

The driver was tested with two physical MPC5744P slave controllers.

Installation:
1. Back up the original SDK driver files.
2. Copy the provided header to:
platform/drivers/inc/
3. Copy the provided source file to:
platform/drivers/src/linflexd/
4. Refresh the linked SDK files in the project.
5. Perform a clean rebuild.

I hope this helps anyone who needs basic LIN communication with the S32 SDK.
Feedback and test results on other MPC5xxx devices are welcome.

Best regards

0 Kudos
Reply

2,805 Views
akovacevic
Contributor I

My idea is to stay in the SDK environment, which is now, in your opinion, the best way to enable LIN hardware? Or is there maybe a way to create software via PIT and GPIO?

0 Kudos
Reply

2,788 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

you can stay with SDK and LINFlex module, but you need to write code/driver yourself, for example reusing available baremetal code. 

BR, Petr

0 Kudos
Reply

2,096 Views
akovacevic
Contributor I
here is a way that works and simulates a wakeup signal
 
#define SYNC 0x55
#define WAKEUP = 0x00;
   ....
    LINFLEXD_UART_DRV_SetBaudRate(INST_LINFLEXD_UART1,4800);
    LINFLEXD_UART_DRV_SendDataBlocking(INST_LINFLEXD_UART1, &WAKEUP, 1,100);
    LINFLEXD_UART_DRV_SetBaudRate(INST_LINFLEXD_UART1,9600);
    masterMessage.sync = SYNC;
    masterMessage.id = PID;
    masterMessage.data[0] = 0x00;
    masterMessage.data[1] = 0x00;
    masterMessage.chksum = linbus_calculate_checksum(masterMessage.data,2);
 
0 Kudos
Reply

2,873 Views
akovacevic
Contributor I
Thank you for quick replay, is it possible to integrate a part of the example (initialization and sending a LIN message) with, let's say, a FreeRTOS example from the SDK package without any major issues?
0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-1711413%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EMPC5744p%20S32DS%20LINBUS%20master%20slave%20example%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1711413%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHello%20everyone%2C%3C%2FP%3E%3CP%3ECould%20someone%20help%20me%20with%20information%20about%20whether%20there%20is%20an%20MPC5744p%20LINBUS%20Master%2FSlave%20example%20for%20S32%20Design%20Studio%3F%3C%2FP%3E%3CP%3EThank%20you!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2407254%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20MPC5744p%20S32DS%20LINBUS%20master%20slave%20example%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2407254%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EThe%20attached%20ZIP%20contains%20the%20modified%20driver%20files%26nbsp%3B%3C%2FP%3E%3CP%3ETested%20configuration%3A%3CBR%20%2F%3E-%20MPC5744P%3CBR%20%2F%3E-%20S32%20Design%20Studio%20for%20Power%20Architecture%202.1%3CBR%20%2F%3E-%20S32_SDK_S32PA_RTM_3.0.3%3CBR%20%2F%3E-%20INST_LINFLEXD_UART2%3CBR%20%2F%3E-%20FreeRTOS%3CBR%20%2F%3E-%20Two%20physical%20slave%20controllers%3C%2FP%3E%3CP%3EImplemented%20functionality%3A%3CBR%20%2F%3E-%20LIN%20break%20and%200x55%20synchronization%20byte%3CBR%20%2F%3E-%20Protected%20identifier%20generation%20and%20validation%3CBR%20%2F%3E-%20Master%20header%20transmission%3CBR%20%2F%3E-%20Interrupt-driven%20slave%20response%3CBR%20%2F%3E-%20Classic%20and%20enhanced%20checksum%3CBR%20%2F%3E-%20Frames%20with%20up%20to%208%20data%20bytes%3CBR%20%2F%3E-%20Response%20timeout%20handling%3CBR%20%2F%3E-%20Recovery%20after%20a%20slave%20is%20disconnected%2C%20reset%20or%20reconnected%3CBR%20%2F%3E-%20Polling%20of%20multiple%20slave%20identifiers%3C%2FP%3E%3CP%3EThe%20driver%20was%20tested%20with%20two%20physical%20MPC5744P%20slave%20controllers.%3C%2FP%3E%3CP%3EInstallation%3A%3CBR%20%2F%3E1.%20Back%20up%20the%20original%20SDK%20driver%20files.%3CBR%20%2F%3E2.%20Copy%20the%20provided%20header%20to%3A%3CBR%20%2F%3Eplatform%2Fdrivers%2Finc%2F%3CBR%20%2F%3E3.%20Copy%20the%20provided%20source%20file%20to%3A%3CBR%20%2F%3Eplatform%2Fdrivers%2Fsrc%2Flinflexd%2F%3CBR%20%2F%3E4.%20Refresh%20the%20linked%20SDK%20files%20in%20the%20project.%3CBR%20%2F%3E5.%20Perform%20a%20clean%20rebuild.%3C%2FP%3E%3CP%3EI%20hope%20this%20helps%20anyone%20who%20needs%20basic%20LIN%20communication%20with%20the%20S32%20SDK.%3CBR%20%2F%3EFeedback%20and%20test%20results%20on%20other%20MPC5xxx%20devices%20are%20welcome.%3C%2FP%3E%3CP%3EBest%20regards%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1961800%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20MPC5744p%20S32DS%20LINBUS%20master%20slave%20example%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1961800%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CDIV%3E%3CDIV%3E%3CDIV%3E%3CDIV%3E%3CDIV%3E%3CSPAN%3Ehere%20is%20a%20way%20that%20works%20and%20simulates%20a%20wakeup%20signal%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%23define%3C%2FSPAN%3E%20%3CSPAN%3ESYNC%3C%2FSPAN%3E%20%3CSPAN%3E0x55%3C%2FSPAN%3E%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FDIV%3E%3CDIV%3E%23define%26nbsp%3B%3CSPAN%3EWAKEUP%3C%2FSPAN%3E%3CSPAN%3E%20%3D%20%3C%2FSPAN%3E%3CSPAN%3E0x00%3C%2FSPAN%3E%3CSPAN%3E%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3C%2FDIV%3E%3CSPAN%3E%26nbsp%3B%20%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3E....%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%26nbsp%3B%20%26nbsp%3B%20LINFLEXD_UART_DRV_SetBaudRate%3C%2FSPAN%3E%3CSPAN%3E(%3C%2FSPAN%3E%3CSPAN%3EINST_LINFLEXD_UART1%3C%2FSPAN%3E%3CSPAN%3E%2C%3C%2FSPAN%3E%3CSPAN%3E4800%3C%2FSPAN%3E%3CSPAN%3E)%3B%3C%2FSPAN%3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2C%3C%2FSPAN%3E%3CSPAN%3E2%3C%2FSPAN%3E%3CSPAN%3E)%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1713192%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20MPC5744p%20S32DS%20LINBUS%20master%20slave%20example%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1713192%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%2C%3C%2FP%3E%0A%3CP%3Eyou%20can%20stay%20with%20SDK%20and%20LINFlex%20module%2C%20but%20you%20need%20to%20write%20code%2Fdriver%20yourself%2C%20for%20example%20reusing%20available%20baremetal%20code.%26nbsp%3B%3C%2FP%3E%0A%3CP%3EBR%2C%20Petr%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1712517%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20MPC5744p%20S32DS%20LINBUS%20master%20slave%20example%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1712517%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3E%3CSPAN%3EMy%20idea%20is%20to%20stay%20in%20the%20SDK%20environment%2C%20which%20is%20now%2C%20in%20your%20opinion%2C%20the%20best%20way%20to%20enable%20LIN%20hardware%3F%20Or%20is%20there%20maybe%20a%20way%20to%20create%20software%20via%20PIT%20and%20GPIO%3F%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1712332%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20MPC5744p%20S32DS%20LINBUS%20master%20slave%20example%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1712332%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%2C%3C%2FP%3E%0A%3CP%3Eas%20far%20as%20I%20know%26nbsp%3B%3CSPAN%3Ethere's%20no%20LIN%20support%20in%20the%20SDK%20and%20there%20are%20no%20plans%20to%20add%20it.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EBR%2C%20Petr%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1711532%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20MPC5744p%20S32DS%20LINBUS%20master%20slave%20example%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1711532%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EWhat%20is%20the%20best%20approach%20here%20to%20use%20the%20SDK%20and%20LIN%20bus%3F%20I%20tried%20generating%20a%20LIN%20message%20with%20linflexd_uart%2C%20but%20generating%20that%20break%20and%20wakeup%20isn't%20possible.%20Should%20I%20use%20TX%20as%20a%20digital%20output%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1711483%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20MPC5744p%20S32DS%20LINBUS%20master%20slave%20example%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1711483%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EThank%20you%20for%20quick%20replay%2C%20is%20it%20possible%20to%20integrate%20a%20part%20of%20the%20example%20(initialization%20and%20sending%20a%20LIN%20message)%20with%2C%20let's%20say%2C%20a%20FreeRTOS%20example%20from%20the%20SDK%20package%20without%20any%20major%20issues%3F%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1711429%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20MPC5744p%20S32DS%20LINBUS%20master%20slave%20example%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1711429%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%2C%3C%2FP%3E%0A%3CP%3Ethere%20are%20LIN%20master%20and%20slave%20examples%20within%20S32DS%2C%20so%20you%20can%20refer%20to%20it.%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22PetrS_0-1692959754415.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22PetrS_0-1692959754415.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F238083i69EF2A3E2C6AF7AA%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22PetrS_0-1692959754415.png%22%20alt%3D%22PetrS_0-1692959754415.png%22%20%2F%3E%3Cspan%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3EPetrS_0-1692959754415.png%3C%2Fspan%3E%3C%2Fspan%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3EPetrS_0-1692959754415.png%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EBR%2C%20Petr%3C%2FP%3E%3C%2FLINGO-BODY%3E