Part Number:TMS320F280049C
IODFTCTRL寄存器用于模拟各种错误和测试条件,其中第28位用于创建ISF错误,启用IODFT模式后(IODFTENA=1010),在LIN模式下,同步字段中的位宽会发生变化,发送数据未设置ISF错误,但是仅在CERRENA/PBERRENA/BERRENA使能后相应的错误标准位都置位了,这个功能是如何使用的呢
Yale Li:
我已经咨询了相关工程师,请关注下方链接:
https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/1289130/tms320f280049c-lin-register-iodftctrl-bit28-isferrena
,
? ??:
问题在于使能ISFERRENA以后,开启模拟回环通过发送引脚后,相应的标志位没有被设置,我使用逻辑分析仪捕捉了信号,发现同步字段与正常的一样,(波特率20K)
以下是我的代码
__interrupt void level0ISR(void); __interrupt void level1ISR(void); void lin_enable_int(LIN_InterruptLine INTERRUPT_LINEx,uint32_t intFlags); void main() {uint16_t txID;txID = 0x10 ;txID = LIN_generateParityID(txID);Device_init();Device_initGPIO();GPIO_setPinConfig(GPIO_37_LINA_TX);GPIO_setPadConfig(37, GPIO_PIN_TYPE_STD | GPIO_PIN_TYPE_PULLUP);GPIO_setQualificationMode(37, GPIO_QUAL_ASYNC);GPIO_setDirectionMode(37U, GPIO_DIR_MODE_OUT);GPIO_setPinConfig(GPIO_35_LINA_RX);GPIO_setPadConfig(35, GPIO_PIN_TYPE_STD);GPIO_setQualificationMode(35, GPIO_QUAL_ASYNC);GPIO_setDirectionMode(35U, GPIO_DIR_MODE_IN);Interrupt_initModule();Interrupt_initVectorTable();EINT;ERTM;Interrupt_register(INT_LINA_0, &level0ISR);Interrupt_register(INT_LINA_1, &level1ISR);Interrupt_enable(INT_LINA_0);Interrupt_enable(INT_LINA_1);LIN_initModule(LINA_BASE);//波特率20KLIN_setBaudRatePrescaler(LINA_BASE, 312U, 0U);//设置ISF中断lin_enable_int(LIN_INTERRUPT_LINE0,LIN_INT_ISFE);LIN_disableIntLoopback(LINA_BASE);//创建isf错误// Clear the IO DFT Enable KeyHWREGH(myLIN_BASE + LIN_O_IODFTCTRL) &= ~(LIN_IODFTCTRL_IODFTENA_M);// Enable write accessHWREGH(myLIN_BASE + LIN_O_IODFTCTRL) |= (LIN_IO_DFT_KEY <<LIN_IODFTCTRL_IODFTENA_S);//HWREG_BP(myLIN_BASE + LIN_O_IODFTCTRL) |= LIN_ISF_ERROR;HWREG_BP(myLIN_BASE + LIN_O_IODFTCTRL) |= LIN_ISF_ERROR|0x2;//模拟回环通过发送引脚while(!LIN_isTxReady(LINA_BASE));//发送数据LIN_sendData(LINA_BASE, txData);LIN_setIDByte(LINA_BASE, txID);while(1); } void lin_enable_int(LIN_InterruptLine INTERRUPT_LINEx,uint32_t intFlags) {LIN_enableInterrupt(LINA_BASE, intFlags); //INT0if(INTERRUPT_LINEx==LIN_INTERRUPT_LINE0){//仅在LIN模式下,将各个中断源映射到 INT0 线LIN_setInterruptLevel0(LINA_BASE, intFlags);//使能全局中断0LIN_enableGlobalInterrupt(LINA_BASE, LIN_INTERRUPT_LINE0);//失能全局中断1LIN_disableGlobalInterrupt(LINA_BASE, LIN_INTERRUPT_LINE1);//清除全局中断标志位LIN_clearGlobalInterruptStatus(LINA_BASE, LIN_INTERRUPT_LINE0);} //INT1else{//仅在LIN模式下,将各个中断源映射到 INT1 线LIN_setInterruptLevel1(LINA_BASE, intFlags);LIN_enableGlobalInterrupt(LINA_BASE, LIN_INTERRUPT_LINE1);//失能全局中断0LIN_disableGlobalInterrupt(LINA_BASE, LIN_INTERRUPT_LINE0);LIN_clearGlobalInterruptStatus(LINA_BASE, LIN_INTERRUPT_LINE1);} } __interrupt void level0ISR(void) {level0Count++;if(LIN_getInterruptStatus(LINA_BASE)& LIN_FLAG_ISFE){vectorOffset = LIN_getInterruptLine0Offset(LINA_BASE);LIN_clearInterruptStatus(LINA_BASE, LIN_INT_ISFE);}if(LIN_getInterruptStatus(LINA_BASE)& LIN_FLAG_CE){vectorOffset = LIN_getInterruptLine0Offset(LINA_BASE);LIN_clearInterruptStatus(LINA_BASE, LIN_INT_ISFE);}vectorOffset = LIN_getInterruptLine0Offset(LINA_BASE);LIN_clearGlobalInterruptStatus(LINA_BASE, LIN_INTERRUPT_LINE0);Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP8); }__interrupt void level1ISR(void) {}
,
? ??:
你好,能继续帮我问一下工程师吗,谢谢帮助
,
Yale Li:
已跟进