主题中讨论的其他器件:TLIN2029EVM、 TMDSHSECDOCK、 SysConfig
我们正在测试 LIN 从设备驱动程序、 当我们从独木舟传输数据时、无法在 F280015x 控制卡上获取 RX 中断。
请查看下面的图片( F280015x_ Control_Card_Switch_Configuration )包含控制卡及开关位置,
- S2:一个开关被按下。
- S1:A 位置2开关被按下。
请查找有关硬件连接的详细信息:
我们使用 LIN 收发器(TLIN2029EVM)在具有 C2000 F280015x 控制卡的 TMDSHSECDOCK 控制卡集线站[修订版 F]与 LIN 主站(我们将 Canoe 接口用于 LIN 主站)之间建立通信。
我们已将 LIN 收发器 RX 引脚连接至 TMDSHSECDOCK 控制卡集线站[Rev F] RX 引脚、即集线站上的引脚编号90 (GPIO35)和 Tx 引脚编号85 (GPIO32)以及 LIN 收发器 EN 引脚编号88 (GPIO37)。
请查看以下 LIN 初始化 API 伪代码说明、以便在从模式下配置 LIN。
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; }
如果需要更改扩展坞或控制卡上的任何配置引脚、请告知我们。
提前感谢。
此致、
迪内什·雷迪