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.

MSPM0C1104: LIN Responder transmit once only and no interrupt forever

Part Number: MSPM0C1104

Tool/software:

Hi,

I found my LIN responder can only transmit its msg back to commander for the first time. When next msg received from commander, it will not going to interrupt "DL_UART_EXTEND_IIDX_RX" and stucks at there forever. Can someone advise whether which interrupt masks need to be cleared after transmit done? Or any other suggestions?

Here is the LIN_0_INST_IRQHandler code and just ignore a, b, c, d, etc. since they are just simple counter to monitor whether trigger condition respectively.

void LIN_0_INST_IRQHandler(void)
{
    a++;
    lin_interrupt_status = DL_UART_Extend_getPendingInterrupt(LIN_0_INST);
    switch(lin_interrupt_status)
    {
        case DL_UART_EXTEND_IIDX_LIN_FALLING_EDGE: //0x08
        b++;
        if(lin_state == LIN_STATE_WAIT_FOR_BREAK)
        {
            c++;
            lin_state = LIN_STATE_BREAK_FIELD;
            counterVal = DL_UART_Extend_getLINCounterValue(LIN_0_INST);
            if(counterVal < (LIN_0_TBIT_WIDTH * 13.5) && counterVal > (LIN_0_TBIT_WIDTH * LIN_0_TBIT_COUNTER_COEFFICIENT))
            {
                d++;
                lin_state = LIN_STATE_SYNC_FIELD_NEG_EDGE;
                DL_UART_Extend_enableLINCounterClearOnFallingEdge(LIN_0_INST);
                DL_UART_Extend_enableInterrupt(LIN_0_INST,DL_UART_EXTEND_INTERRUPT_RXD_NEG_EDGE);
                DL_UART_Extend_enableInterrupt(LIN_0_INST,DL_UART_EXTEND_INTERRUPT_RXD_POS_EDGE);
                DL_UART_Extend_enableLINSyncFieldValidationCounterControl(LIN_0_INST);
            }
            else
            {
                lin_state = LIN_STATE_WAIT_FOR_BREAK;
            }
            DL_UART_Extend_disableInterrupt(LIN_0_INST,DL_UART_EXTEND_INTERRUPT_RX);
        }
        break;

        case DL_UART_EXTEND_IIDX_RXD_NEG_EDGE: //0x06
        e++;
        if(lin_state == LIN_STATE_SYNC_FIELD_NEG_EDGE)
        {
                if(lin_state == LIN_STATE_SYNC_FIELD_NEG_EDGE)
                {
                    f++;
                    gBitTimes[gNumCycles].negEdge = DL_UART_Extend_getLINFallingEdgeCaptureValue(LIN_0_INST);
                    lin_state = LIN_STATE_SYNC_FIELD_POS_EDGE;
                }
        }
        break;

        case DL_UART_EXTEND_IIDX_RXD_POS_EDGE: //0x07
        g++;
        if(lin_state == LIN_STATE_SYNC_FIELD_POS_EDGE)
        {
            h++;
            gBitTimes[gNumCycles].pos_Edge = DL_UART_Extend_getLINRisingEdgeCaptureValue(LIN_0_INST);
            if(gBitTimes[gNumCycles].pos_Edge > (LIN_0_TBIT_WIDTH * 0.95) && gBitTimes[gNumCycles].pos_Edge < (LIN_0_TBIT_WIDTH * 1.05))
            {
                i++;
                gNumCycles++;
            }
            if(gNumCycles == LIN_RESPONDER_SYNC_CYCLES)
            {
                j++;
                DL_UART_Extend_enableInterrupt(LIN_0_INST, DL_UART_EXTEND_INTERRUPT_RX);
                DL_UART_Extend_disableInterrupt(LIN_0_INST, DL_UART_EXTEND_INTERRUPT_RXD_NEG_EDGE);
                DL_UART_Extend_disableInterrupt(LIN_0_INST, DL_UART_EXTEND_INTERRUPT_RXD_POS_EDGE);
                gNumCycles = 0;
            }
            else
            {
                lin_state = LIN_STATE_SYNC_FIELD_NEG_EDGE;
            }
        }
        break;      

        case DL_UART_EXTEND_IIDX_RX:   //0x0B
        k++;
        if(lin_state == LIN_STATE_SYNC_FIELD_POS_EDGE)
        {
            l++;
            data_buffer = DL_UART_Extend_receiveData(LIN_0_INST);
            if(data_buffer == LIN_SYNC_BYTE)
            {
                m++;
                lin_state = LIN_STATE_PID_FIELD;
            }
            else
            {
                lin_state = LIN_STATE_BREAK_FIELD;
            }
        }
        else if(lin_state == LIN_STATE_PID_FIELD)
        {
            PID_Buffer = DL_UART_Extend_receiveData(LIN_0_INST);
            count = 0;
            if(PID_Buffer == 0x39)
            {
                n++;
                lin_state = LIN_STATE_DATA_FIELD;
            }
            else if(PID_Buffer == 0xC1)
            {
                o++;
                delay_cycles(LIN_RESPONSE_LAPSE);
                checksum_transmit = checksum_calc(PID_Buffer, TxData, 8);
                DL_UART_Extend_disableInterrupt(LIN_0_INST, DL_UART_EXTEND_INTERRUPT_RX);
                for(int transmit_count=0; transmit_count<8; transmit_count++)
                {
                    p++;
                    DL_UART_Extend_transmitDataBlocking(LIN_0_INST, TxData[transmit_count]);
                }
                DL_UART_Extend_transmitDataBlocking(LIN_0_INST, checksum_transmit);
                while(DL_UART_Extend_isBusy(LIN_0_INST));
                DL_UART_Extend_clearInterruptStatus(LIN_0_INST, DL_UART_EXTEND_INTERRUPT_RX);
                DL_UART_Extend_enableInterrupt(LIN_0_INST, DL_UART_EXTEND_INTERRUPT_RX);
                lin_state = LIN_STATE_WAIT_FOR_BREAK;
            }
            else
            {
                q++;
                lin_state = LIN_STATE_WAIT_FOR_BREAK;
            }

        }
        else if(lin_state == LIN_STATE_DATA_FIELD)
        {
            data_buffer = DL_UART_Extend_receiveData(LIN_0_INST);
            if(count < 8)
            {
                r++;
                RxData[count] = data_buffer;
                count++;
            }
            else
            {
                checksum_received = data_buffer;
                lin_state = LIN_STATE_WAIT_FOR_BREAK;
            }
        }
        break;

        default:
        break;
    }
}