Other Parts Discussed in Thread: TLIN2029EVM, TMDSHSECDOCK, SYSCONFIG
We are testing LIN slave driver and we are unable to get the RX Interrupt on the F280015x Control Card when we are transmitting data from CANOE.
Please find the below picture(F280015x_Control_Card_Switch_Configuration) contains the control card with the switch positions,
- S2:A switch pushed down.
- S1:A Position 2 switch is pushed ON.
Please find the details related to hardware connection:
We are using LIN transceiver (TLIN2029EVM) to established the communication between the TMDSHSECDOCK control CARD Docking Station [Rev F] with C2000 F280015x control CARD and the LIN master (we are using Canoe interface for LIN master).
We have connected the LIN transceiver RX pin to TMDSHSECDOCK control CARD Docking Station [Rev F] RX pin i.e. PIN No.90(GPIO35) on Docking Station and Tx PIN NO.85(GPIO32) and LIN transceiver EN PIN NO.88(GPIO37).
Please find below LIN initialization api pseudo code description to configure LIN in a slave mode.
void LINDrv_Init(void)
{
/* Initialize LIN state to IDLE. */
g_LIN_State = LIN_STATE_IDLE;
/* Enable LIN peripheral Module Clock */
SysCtl_enablePeripheral(SYSCTL_PERIPH_CLK_LINA);
EALLOW;
/* Set the Interrupt Handler */
Interrupt_register(INT_LINA_0, &LINDrv_IntLevel0Handle);
/* LIN Tx GPIO Configuration */
GPIO_setPinConfig(GPIO_32_LINA_TX);
/* Set the direction */
GPIO_setDirectionMode(LIN_TX_GPIO_PIN,GPIO_DIR_MODE_OUT);
/* Configure the Pin as PushPull */
GPIO_setPadConfig(LIN_TX_GPIO_PIN,GPIO_PIN_TYPE_STD);
/* LIN Rx GPIO Configuration */
GPIO_setPinConfig(GPIO_35_LINA_RX);
/* Set the direction */
GPIO_setDirectionMode(LIN_RX_GPIO_PIN,GPIO_DIR_MODE_IN);
/* Configure the Pin as PushPull */
GPIO_setPadConfig(LIN_RX_GPIO_PIN,GPIO_PIN_TYPE_STD);
/* Reset the Module */
LIN_REG_SCIGCR0 |= LIN_SCIGCR0_RESET;
/* Reset the Software Reset Bit */
LIN_REG_SCIGCR1 &= ~(LIN_SCIGCR1_SWNRST);
/* Configure the LINRx and LINTx Pin */
LIN_REG_SCIPIO0 |= (LIN_SCIPIO0_RXFUNC | LIN_SCIPIO0_TXFUNC);
/* Select LIN Mode */
LIN_REG_SCIGCR1 |= LIN_SCIGCR1_LINMODE;
/* Configure the LIN Module in Slave mode */
LIN_REG_SCIGCR1 |= (LIN_REG_SCIGCR1 & ~(LIN_SCIGCR1_CLK_MASTER));
/* Disable the ID4/ID5 bits for length control*/
LIN_REG_SCIGCR1 |= (LIN_REG_SCIGCR1 & ~(LIN_SCIGCR1_TIMINGMODE | LIN_SCIGCR1_COMMMODE));
/* Debug mode */
LIN_REG_SCIGCR1 |= (LIN_REG_SCIGCR1 & (~(LIN_SCIGCR1_CONT)));
/* Configure the Parity */
LIN_REG_SCIGCR1 |= LIN_SCIGCR1_PARITYENA;
/* Configure the max Response Length */
LIN_REG_SCIFORMAT |= ((((uint32_t)MAXLENGTH - (uint32_t)LIN_CONST_NO_ONE) << \
LIN_SCIFORMAT_LENGTH_S));
/* Checksum Type Selection */
#if(LIN_CHECKSUM_TYPE == LIN_ENHANCEMENT_CHECKSUM_TYPE)
{
/* Configure the Enhancement type checksum */
LIN_REG_SCIGCR1 |= LIN_SCIGCR1_CTYPE;
}
#else
{
/* Configure the Classic type checksum */
LIN_REG_SCIGCR1 |= (LIN_REG_SCIGCR1 & (~(LIN_SCIGCR1_CTYPE)));
}
#endif
/* Trigger Checksum Compare */
LIN_REG_SCIGCR2 |= LIN_SCIGCR2_CC;
/* Send CheckSum */
LIN_REG_SCIGCR2 |= LIN_SCIGCR2_SC;
/* Disable Auto BaudRate */
LIN_REG_SCIGCR1 |= (LIN_REG_SCIGCR1 & (~LIN_SCIGCR1_ADAPT));
/* Select Multi-buffer */
LIN_REG_SCIGCR1 |= LIN_SCIGCR1_MBUFMODE;
/* Disable LOOP-BACK Mode */
LIN_REG_SCIGCR1 |= (LIN_REG_SCIGCR1 &~(LIN_SCIGCR1_LOOPBACK));
/* Disable External Loop back mode */
LIN_REG_IODFTCTRL &= ~(LIN_IODFTCTRL_IODFTENA_M |LIN_IODFTCTRL_LPBENA |
LIN_IODFTCTRL_RXPENA);
/* Synch break and synch delimiter additional bits */
LIN_REG_COMP |= (LIN_SYNCH_BREAK_LEN | ((LIN_SYNCH_DELIMITER_LEN - 1U) << LIN_COMP_SDEL_S));
/* Configure the BaudRate */
LINDrv_SetBuadRate();
/* Configure message filtering */
#if(LIN_HGENCTRL_TYPE == LIN_CONST_NO_ONE)
{
/* Configure the Slave ID for message filtering */
LIN_REG_SCIGCR1 |= LIN_SCIGCR1_HGENCTRL;
/* Configure the Filter Compare Slave task ID byte*/
LIN_REG_ID |= (uint32_t)LIN_SLAVETASKIDBYTE << LIN_CONST_NO_EIGHT;
/* Configure the Rx Filter Mask */
LIN_REG_MASK |= ((uint32_t)LIN_RXMESSAGEID_FILTERMASK << LIN_CONST_NO_SIXTEEN);
/* Configure the Tx Filter Mask */
LIN_REG_MASK |= (uint32_t)LIN_TXMESSAGEID_FILTERMASK;
}
#else
{
/* Configure the ID for message filtering */
LIN_REG_SCIGCR1 |= (LIN_REG_SCIGCR1 & (~(LIN_SCIGCR1_HGENCTRL)));
/* Configure the Filter Compare ID byte*/
LIN_REG_ID |= (uint32_t)LIN_SLAVETASKIDBYTE;
/* Configure the Rx Filter Mask */
LIN_REG_MASK |= ((uint32_t)LIN_RXMSGID_FILTERMSK_ZERO << LIN_CONST_NO_SIXTEEN);
/* Configure the Tx Filter Mask */
LIN_REG_MASK |= (uint32_t)LIN_TXMSGID_FILTERMSK_ZERO;
}
#endif
/* Enable the Transmit */
LIN_REG_SCIGCR1 |= LIN_SCIGCR1_TXENA;
/* Enable the Receive */
LIN_REG_SCIGCR1 |= LIN_SCIGCR1_RXENA;
/* Reset the Software Reset Bit */
LIN_REG_SCIGCR1 |= (LIN_SCIGCR1_SWNRST);
EDIS;
/* Enable Interrupt - Bit Error Interrupt, Physical Bus Error interrupt,
* Checksum Error Interrupt, Sync Frame Error Interrupt,
* No Response Error Interrupt, Frame Error Interrupt,
* Over run Interrupt, Parity Error Interrupt,
ID Interrupt ,Timeout after Wake-up Signal Interrupt,
Timeout after Three Wake-up Signal Interrupt */
LIN_REG_SCISETINT = ( LIN_SCISETINT_SETBEINT | LIN_SCISETINT_SETPBEINT | \
LIN_SCISETINT_SETCEINT | LIN_SCISETINT_SETISFEINT | \
LIN_SCISETINT_SETNREINT | LIN_SCISETINT_SETFEINT | \
LIN_SCISETINT_SETOEINT | LIN_SCISETINT_SETPEINT | \
LIN_SCISETINT_SETIDINT | LIN_SCISETINT_SETTIMEOUTINT |
LIN_SCISETINT_SETTOA3WUSINT | LIN_SCISETINT_SETTOAWUSINT);
/* Set Interrupt Level 0 */
LIN_REG_SCICLEARINTLVL = ( LIN_SCISETINT_SETBEINT | LIN_SCISETINT_SETPBEINT | \
LIN_SCISETINT_SETCEINT | LIN_SCISETINT_SETISFEINT | \
LIN_SCISETINT_SETNREINT | LIN_SCISETINT_SETFEINT | \
LIN_SCISETINT_SETOEINT | LIN_SCISETINT_SETPEINT | \
LIN_SCISETINT_SETIDINT | LIN_SCISETINT_SETTIMEOUTINT |
LIN_SCISETINT_SETTOA3WUSINT | LIN_SCISETINT_SETTOAWUSINT);
/* Enable Global Interrupt */
LIN_REG_GLB_INT_EN |= LIN_GLB_INT_EN_GLBINT0_EN << LIN_LINE0_INTERRUPT;
/* Clear the Global Interrupt Status */
LIN_REG_GLB_INT_FLG |= LIN_GLB_INT_CLR_INT0_FLG_CLR << LIN_LINE0_INTERRUPT;
/* Enable Interrupts */
Interrupt_enable(INT_LINA_0);
/* No Error */
g_LIN_ErrVal = LIN_NOERR;
}
Please let us know if we need to change any configuration pins on Docking station or control card.
Thanks in advance.
Regards,
Dinesh Reddy