Question about lin_master_baremetal example project

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

Question about lin_master_baremetal example project

225 Views
elb1
Contributor III

Hello, i wanted to use the lin drivers from lin_master_baremetal example project for my freertos project, while i am going through this project i noticed that for send function (LIN_DRV_SendFrameData) it doesn't have the steps to send SYNCH nor PID, but it does it like this:

/* Set Break char detect length as 10 bits minimum */
LPUART_SetBreakCharDetectLength(base, LPUART_BREAK_CHAR_10_BIT_MINIMUM);

/* Set node's current state to SEND_DATA */
linCurrentState->currentNodeState = LIN_NODE_STATE_SEND_DATA;

/* Start sending data */
LPUART_Putchar(base, *linCurrentState->txBuff);


so it just send the break, then it will call this function "LPUART_Putchar" but how the synch and other stuff are sent ?

0 Kudos
2 Replies

196 Views
elb1
Contributor III

Hello, i have more updates:
so i have seen that the header is sent seperatly in other functions for instance:

BREAK: is sent from "LIN_LPUART_DRV_MasterSendHeader" function

SYNCH: is sent form "LIN_LPUART_DRV_ProcessBreakDetect"

PID: is sent from "LIN_LPUART_DRV_ProcessFrameHeader"

and the tx_buffer is sent from the function "LIN_LPUART_DRV_ProcessSendFrameData", but why then we do this line in  "LIN_LPUART_DRV_SendFrameData" function
LPUART_Putchar(base, *linCurrentState->txBuff);

it seems like we are putting tx_buffer in DATA register 2 times one in "LIN_LPUART_DRV_SendFrameData" and other time in "LIN_LPUART_DRV_ProcessSendFrameData"

0 Kudos

170 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

to start master sending LIN header, a LIN_DRV_MasterSendHeader is called with an ID to be sent. Driver is calling interrupt to send break, sync and PID. Once PID is successfully transmitted a callback is called with eventID LIN_PID_OK. In that case based on your ID you should either publish response (LIN_DRV_SendFrameData) or request response (LIN_DRV_ReceiveFrameData). Callback with LIN_TX_COMPLETED/LIN_RX_COMPLETED event ID is called after full frame is processed.

BR, Petr

0 Kudos