Other Parts Discussed in Thread: HALCOGEN
Tool/software: Code Composer Studio
i have a question please i have a sensor with (LIN protocol and operating voltage of 12v )so i connected SPI to CAN FD SBC+LIN Transceiver boosterpack from TI with LIN driver of tms570ls1224 .but i didn't get the sensor data.
IN Halcogen i leave the default settings just i enabled Rx interrupt (TX/RX-Mask both set to 0xFF HGEN = 1 and using master mode with 20k baudrate)
1)the sensor write settings frame : break+syn+ID(0x38) ,PID(0x78) +data1(0x01)+data2(0x02)+checksum
2)delay 1s
3)the sensor read data frame :break+syn+ID(0x01) ,PID(0xC1) and Will return 8 data bytes.
i checked the sending data by oscilloscope it displays
/* USER CODE BEGIN (0) */
#include "lin.h"
#include "sys_core.h"
/* USER CODE END */
/* Include Files */
#include "sys_common.h"
#include "system.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 2
uint8 TEXT1[TSIZE1]= {0x01,0x02};
#define TSIZE2 10
uint8 TEXT2[TSIZE2]= {0};
/* USER CODE END */
void main(void)
{
/* USER CODE BEGIN (3) */
/* Enable interrupts. */
_enable_IRQ();
/* Set length of data response in bytes (7 implies 8 bytes */
linInit();
/* 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, 0x78);
linSetLength(linREG,2);
/*Send data TEXT1 */
linSend(linREG,&TEXT1[0]);
__delay_cycles(40000000);
while(1){
__delay_cycles(80000000);
linSendHeader(linREG,0xC1);
}
}
/* USER CODE BEGIN (4) */
void linNotification(linBASE_t *lin, uint32 flags)
{
/*Data is read from RD register and stored in TEXT2. */
if((linREG->FLR & LIN_RX_INT) == LIN_RX_INT)
{
linGetData(linREG, TEXT2);
}
} /* USER CODE END */