Hi,
I am working on a project in which i have to test LIN transceiver.
I am using RM46L852 Hercules Launchpad and Halcogen for generating the code.
I am planning to to generate data on LIN_tx pin and then send it to the tx pin of LIN Transceiver and then connect tx pin of trnasceiver to LIN_tx on micro controller, compare both.
Sys_main.c code is:
/* USER CODE END */
/* Include Files */
#include "sys_common.h"
/* USER CODE BEGIN (1) */
/* USER CODE END */
/** @fn void main(void)
* @brief Application main function
* @note This function is empty by default.
*
* This function is called after startup.
* The user can use this function to implement the application.
*/
/* USER CODE BEGIN (2) */
#define TSIZE1 8
uint8 TEXT1[TSIZE1]= {'H','E','R','C','U','L','E','S'};
#define TSIZE2 10
uint8 TEXT2[TSIZE2]= {0};
#define TSIZE3 19
uint8 TEXT3[TSIZE3]= {'T','E','X','A','S',' ','I','N','S','T','R','U','M','E','N','T','S','\n','\r'};
/* USER CODE END */
void main(void)
{
/* USER CODE BEGIN (3) */
/* Set length of data response in bytes (7 implies 8 bytes */
while(1){
linSetLength(linREG, 7);
linInit();
linEnableLoopback(linREG,Digital_Lbk);
//linDisableLoopback(linREG);
/* Checking that Tx is ready and also if the LIN bus is free (Checking BUSY flag) */
while((!(linIsTxReady(linREG))) || (linREG->FLR & 0x8U == 0x8U));
/*Send lin header including sync break field, sync field and identifier. */
linSendHeader(linREG, 0x28);
/*Send data TEXT1 */
linSend(linREG,&TEXT1[0]);
/* Checking if Rx is ready. */
while((linREG->FLR & LIN_RX_INT) == 0U);
/*Data is read from RD register and stored in TEXT2. */
linGetData(linREG, TEXT2);
}
while(1);
/* USER CODE END */
}
If i able lin loopback (linEnableLoopback(linREG,Digital_Lbk);) then even without using LIN trnasceiver, data is being transmitted but it is not showing on LIN_tx or LIN_rx pin.
I want to use LIN transceiver as i have to test it so commented linEnableLoopback(linREG,Digital_Lbk); but this time data is not being transmitted to TEXT2(i.e.) on rx pin and also there is just a constant 3.3 v on both tx and rx pin.
I am attaching my project file for reference.
Where am i going wrong?
Please guide me in this.