Other Parts Discussed in Thread: CONTROLSUITE, C2000WARE
Hi
I am doing the LIN configuration in its registers but LIN registers are not getting updated in the "Registers" View.
Tried Control Suite LIN related example and there also couldn't see registers getting updated.
Please find the attached LIN configuration code and images of the "Registers" View and help me solve this issue.
void LIN_Init(void)
{
EALLOW; // This is needed to write to EALLOW protected registers
PieVectTable.LIN0INTA = &Lin_Level0_ISR;
PieVectTable.LIN1INTA = &Lin_Level1_ISR;
EDIS; // This is needed to disable write to EALLOW protected registers
/* Enable LINA_INT1 to LINA_INT0 in PIE */
PieCtrlRegs.PIECTRL.bit.ENPIE = 1; // Enable the PIE block
PieCtrlRegs.PIEIER9.bit.INTx3 = 1; // PIE Group 9, INT3
PieCtrlRegs.PIEIER9.bit.INTx4 = 1; // PIE Group 9, INT4
IER = 0x100; // Enable CPU INT
EINT;
EALLOW;
/* Module Reset*/
LinaRegs.SCIGCR0.bit.RESET = 0;
/* Pull module out of reset */
LinaRegs.SCIGCR0.bit.RESET = 1;
/* The BLIN is in its reset state; no data will be transmitted
or received. */
LinaRegs.SCIGCR1.bit.SWnRST = 0;
LinaRegs.SCIGCR1.bit.LINMODE = 1;
/* LIN node is in mode */
LinaRegs.SCIGCR1.bit.CLK_MASTER = 1;//LIN_SLAVEMODE
/* LIN Automatic baudrate adjustment is enabled according to LIN Master */
LinaRegs.SCIGCR1.bit.ADAPT = 0;
LinaRegs.BRSR.bit.SCI_LIN_PSL = 96; // 19.2 kbps
LinaRegs.BRSR.bit.M = 11;
LinaRegs.MBRSR = 92; //20kHz (max autobaud rate)
/* In LIN mode ID4 and ID5 are not used for
length control */
LinaRegs.SCIGCR1.bit.COMMMODE = 0;
/* Continue on Suspend, the SCI/BLIN continues to operate until the current
transmit and receive functions are complete */
LinaRegs.SCIGCR1.bit.CONT = 1;
LinaRegs.SCIGCR1.bit.CTYPE = 1;
/* ID filtering using ID-SlaveTask byte, RECID and ID-Slave task byte are
used for detecting a match */
LinaRegs.SCIGCR1.bit.HGENCTRL = 1;
/* Loop back mode is disabled */
LinaRegs.SCIGCR1.bit.LOOPBACK = 0;
/* RX/TX multibuffers are used */
LinaRegs.SCIGCR1.bit.MBUFMODE = 1;
/* Parity Check */
LinaRegs.SCIGCR1.bit.PARITYENA = 1;
/* Enable TX, Enable transfers of data from SCITD or TDy to SCITXSHF */
LinaRegs.SCIGCR1.bit.RXENA = 1;
/* Enable RX, Allows the receiver to transfer data from the shift buffer to
the receive buffer or multi-buffers */
LinaRegs.SCIGCR1.bit.TXENA = 1;
/* Validate checksum */
LinaRegs.SCIGCR2.bit.CC = 1;
/* Set all interrupts to disabled */
LinaRegs.SCICLEARINT.all = 0xFFFFFFFF;
LinaRegs.SCIFORMAT.bit.LENGTH = 0;
/* SYNC Field Configuration */
/* Sync break is 13 + 5 = 18 Tbits */
LinaRegs.LINCOMP.bit.SBREAK = 5;
/* Sync delimiter is 1 + 3 = 4 Tbits */
LinaRegs.LINCOMP.bit.SDEL = 3;
/* LIN MASK, allow all ID reception */
LinaRegs.LINMASK.bit.RXIDMASK = 0xFF;
LinaRegs.LINMASK.bit.TXIDMASK = 0xFF;
/* Ensure IODFT (used to force different error conditions) is disabled */
LinaRegs.IODFTCTRL.bit.IODFTENA = 0;
LinaRegs.IODFTCTRL.bit.LPBENA = 0;
/* Pull out of software reset */
LinaRegs.SCIGCR1.bit.SWnRST = 1;
EDIS;
EALLOW;
/* Under Reset */
LinaRegs.SCIGCR1.bit.SWnRST = 0;
LinaRegs.SCIGCR1.bit.PARITYENA = 0;
// LinaRegs.SCISETINT.all = 0xFFFFFFFF;
LinaRegs.SCISETINT.bit.SETIDINT = 1;//IDINT
LinaRegs.SCISETINT.bit.SETRXINT = 1;//RXINT
LinaRegs.SCISETINT.bit.SETTXINT = 1;//TXINT
LinaRegs.SCISETINT.bit.SETWAKEUPINT = 1;
LinaRegs.SCICLEARINTLVL.all = 0xFFFFFFFF; // Interrupt asserted in INT0
LinaRegs.LINMASK.bit.RXIDMASK = 0xA;
LinaRegs.LINMASK.bit.TXIDMASK = 0xA;
/* Initialize the Slave LINIDNUM register */
LinaRegs.LINID.bit.IDSLAVETASKBYTE = 0x30;
/* Pull out of software reset */
LinaRegs.SCIGCR1.bit.SWnRST = 1;
/* Number of bytes in the response field */
LinaRegs.SCIFORMAT.bit.LENGTH = 7;
/* Intialize LIN state to LIN_INIT */
LIN_Status = LIN_INIT;
/* Intialize the LIN ID */
LIN_Id = ZERO;
/* Intialize the recieve wait time count */
LIN_RecWaitTime = ZERO;
/* Intialize the communication time count */
LIN_CommTime = ZERO;
/* Intialize the LIN recive wait timeout status */
LIN_RecWaitErrSt = FALSE;
if(LIN_RecWaitErrSt);
EDIS;
}
Regards
Mayank Bhatt