This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hello sir
I have a question about the LIN module:
1 ) PC LIN Master Node
2 ) TMS320F2800157 LIN Slave Node
3 ) PIN5 LIN enable
PIN2 LIN-TX
PIN1 LIN-RX
1)Macor #define GPIO_PIN_LINA_RX 29 #define myLIN0_LINRX_GPIO 29 #define myLIN0_LINRX_PIN_CONFIG GPIO_29_LINA_RX // // LINA_TX - GPIO Settings // #define GPIO_PIN_LINA_TX 28 #define myLIN0_LINTX_GPIO 28 #define myLIN0_LINTX_PIN_CONFIG GPIO_28_LINA_TX #define myGPIO0 242 #define myGPIO0_GPIO_PIN_CONFIG GPIO_242_GPIO242 2 ) Init -SYSCLK 120M // GPIO242 -> myGPIO0 Pinmux GPIO_setPinConfig(GPIO_242_GPIO242); // AGPIO -> GPIO mode selected GPIO_setAnalogMode(242, GPIO_ANALOG_DISABLED); // // LINA -> myLIN0 Pinmux // GPIO_setPinConfig(myLIN0_LINRX_PIN_CONFIG); GPIO_setPadConfig(myLIN0_LINRX_GPIO, GPIO_PIN_TYPE_STD); GPIO_setQualificationMode(myLIN0_LINRX_GPIO, GPIO_QUAL_ASYNC); GPIO_setPinConfig(myLIN0_LINTX_PIN_CONFIG); // AGPIO -> GPIO mode selected GPIO_setAnalogMode(28, GPIO_ANALOG_DISABLED); GPIO_setPadConfig(myLIN0_LINTX_GPIO, GPIO_PIN_TYPE_STD); GPIO_setQualificationMode(myLIN0_LINTX_GPIO, GPIO_QUAL_ASYNC); LIN_initModule(myLIN0_BASE); // // Enter Software Reset State // LIN_enterSoftwareReset(myLIN0_BASE); LIN_setLINMode(myLIN0_BASE, LIN_MODE_LIN_RESPONDER); LIN_setCommMode(myLIN0_BASE, LIN_COMM_LIN_USELENGTHVAL); LIN_setDebugSuspendMode(myLIN0_BASE, LIN_DEBUG_COMPLETE); LIN_setChecksumType(myLIN0_BASE, LIN_CHECKSUM_ENHANCED); LIN_setMessageFiltering(myLIN0_BASE, LIN_MSG_FILTER_IDRESPONDER); LIN_enableParity(myLIN0_BASE); // // Finally exit SW reset and enter LIN ready state // LIN_exitSoftwareReset(myLIN0_BASE); // // Enable LIN Interrupts // LIN_enableInterrupt(myLIN0_BASE, LIN_INT_ID| LIN_INT_RX); // // Set the interrupt priority line // LIN_setInterruptLevel0(myLIN0_BASE, LIN_INT_ID| LIN_INT_RX); LIN_enableGlobalInterrupt(myLIN0_BASE, LIN_INTERRUPT_LINE0); LIN_clearGlobalInterruptStatus(myLIN0_BASE, LIN_INTERRUPT_LINE0); GPIO_writePin(myGPIO0, 1); Interrupt_register(INT_LINA_0, &level0ISR); Interrupt_enable(INT_LINA_0); LIN_setBaudRatePrescaler(LINA_BASE, 389U, 10U); 3 ) Interrupt Function uint32_t i, dataIndex; uint16_t txID,rxID,rxID2, error; #define FRAME_LENGTH 0x8 #define LIN_PASS 0xABCD #define LIN_FAIL 0xFFFF volatile uint32_t level0Count = 0; volatile uint32_t level1Count = 0; volatile uint32_t vectorOffset = 0; uint16_t result; uint16_t txData[8] = {0x11, 0x34, 0x56, 0x78, 0x9A, 0xAB, 0xCD, 0xEF}; uint16_t txData2[8] = {0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA}; uint16_t rxData[8] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; __interrupt void level0ISR(void) { // // Increment the interrupt count // level0Count++; rxID = LIN_getRxIdentifier(LINA_BASE)& 0x3F; if(rxID== 0x2) { LIN_setFrameLength(LINA_BASE, 8); if(LIN_isRxReady(LINA_BASE) == 1) { LIN_getData(LINA_BASE, rxData); } } else if(rxID == 0x3) { if(LIN_isTxReady(LINA_BASE) ==1) { LIN_setFrameLength(LINA_BASE, 8); LIN_sendData(LINA_BASE, txData); } } else if(rxID == 0x4) { if(LIN_isTxReady(LINA_BASE) ==1) { LIN_setFrameLength(LINA_BASE, 8); LIN_sendData(LINA_BASE, txData2); } } else if(rxID == 0x15) { i++; } // // Read the high priority interrupt vector // vectorOffset = LIN_getInterruptLine0Offset(LINA_BASE); //LIN_clearInterruptStatus(LINA_BASE, LIN_INT_ID | LIN_INT_OE |LIN_INT_FE ); LIN_clearInterruptStatus(LINA_BASE,LIN_INT_ALL); LIN_clearGlobalInterruptStatus(LINA_BASE, LIN_INTERRUPT_LINE0); // // Acknowledge this interrupt located in group 6 // Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP6); }
my LIN Schedule Table
my Exception Result
IC Receive 02 -03 02 03 04 05 06 07 08 -20ms
IC Transmit 03- 11 34 56 78 9A AB CD EF-10ms
IC Transmit 04 - AA AA AA AA AA AA AA AA-90ms
my Actual Result
Q1 : Based on Head 0x03 and 0x04 reply Message, the actual result is Head 0x04 followed by Message error,Head 0x16 followed by 0x04 want to send Message, what is the way to solve it?
Q2: How can the code configuration be modified to implement the function of sending and receiving LIN data with a single interrupt?
Hi,
I strongly suggest you post this issue to E2E directly:
The relevant R&D engineer will support you directly.
--
Thanks & Regards
You're welcome.
Because of the holidays, engineer's responses may be delayed. Thank you for your patience.
The relevant engineer will reply you ASAP. You just need to follow the link that you posted. I will close this thread.