tao_z
2022-06-01 73bf3cdb517b55f662ed5fa513cdaaf55c1fd0c8
Bootloader调试完成,可以正常烧录程序
1 files modified
19 ■■■■ changed files
Application/source/uds_modules/uds.c 19 ●●●● patch | view | raw | blame | history
Application/source/uds_modules/uds.c
@@ -155,7 +155,7 @@
#define RSP_DATA_LEN (6)
#define UDS_TASK_RATE (10)
#define CANTP_RX_BUFFER_SIZE (128)
#define CANTP_RX_BUFFER_SIZE (266)
#define FBL_RX_BUFFER_SIZE (256)
#define CANTP_TX_BUFFER_SIZE (128)
@@ -386,9 +386,9 @@
    {ROUTINE_CONTROL,               UDS_RoutineControl,         false, true,  false,   false, SECURITY_ACCESS_UNLOCK_LEVEL_2},
    {TESTER_PRESENT,                UDS_TesterPresent,          true,  true,  true,    true,  SECURITY_ACCESS_LOCKED},
    // {CONTROL_DTC_SETTING,           UDS_ControlDTCSetting,      false, true,  false,    true,  SECURITY_ACCESS_LOCKED},
    {REQUEST_DOWNLOAD,              UDS_RequestDownload,      false, true,  false,    true,  SECURITY_ACCESS_UNLOCK_LEVEL_2},
    {TRANSFER_DATA,                 UDS_TransferData,      false, true,  false,    true,  SECURITY_ACCESS_UNLOCK_LEVEL_2},
    {REQUEST_TRANSFER_EXIT,         UDS_RequestTransferExit,      false, true,  false,    true,  SECURITY_ACCESS_UNLOCK_LEVEL_2},
    {REQUEST_DOWNLOAD,              UDS_RequestDownload,      false, true,  false,    false,  SECURITY_ACCESS_UNLOCK_LEVEL_2},
    {TRANSFER_DATA,                 UDS_TransferData,      false, true,  false,    false,  SECURITY_ACCESS_UNLOCK_LEVEL_2},
    {REQUEST_TRANSFER_EXIT,         UDS_RequestTransferExit,      false, true,  false,    false,  SECURITY_ACCESS_UNLOCK_LEVEL_2},
};
/* clang-format on */
@@ -1480,14 +1480,15 @@
        break;
    case PROGRAMMING:
        /* UDS_SendNegResp(NRC_SUBFUNCTION_NOT_SUPPORTED); */
        if (((UDS_L_Diag_session_e == EXTENDED) || (UDS_L_Diag_session_e == PROGRAMMING)) && (UDS_L_ProgrammingPreconditionCheckOK_b == true))
        if (((UDS_L_Diag_session_e == EXTENDED) || (UDS_L_Diag_session_e == PROGRAMMING)))
        {
            /**/
            CDT_RESET(TesterPresentTimer_u16,
                      UDS_NS_SessionTimeout_u16 / UDS_TASK_RATE);
            UDS_L_Diag_session_e = PROGRAMMING;
            UDS_SessionSetOk_b = true;
            FblSetFblProgramRequestFlag();
        }
        else if ((UDS_L_Diag_session_e == DEFAULT) || (UDS_L_ProgrammingPreconditionCheckOK_b == false)) /*DEFAULT session can not trans to PROGRAMMING*/
        else if ((UDS_L_Diag_session_e == DEFAULT)) /*DEFAULT session can not trans to PROGRAMMING*/
        {
            UDS_SendNegResp(NRC_CONDITIONS_NOT_CORRECT);
        }
@@ -1511,6 +1512,7 @@
            /* Compose a response message and send a positive */
            /* response with the request data */
            UDS_RespTxMessage();
            FblClrFblProgramRequestFlag();
            while (cnt--)
            {
                ; /// wait send command send out and then reset
@@ -1936,7 +1938,6 @@
        return;
    }
    UDS_L_ResponsePendingRequest_e |= ERASE_RESP_PENDING;
    UDS_SendNegResp(NRC_SERVICE_BUSY);
    erase_state = NVM_EraseData(eraseAddress, eraseRemainder);
    if (erase_state == OP_STATUS_OK)
@@ -2215,7 +2216,7 @@
    operation_write.current_sequenc = expectedSequenceCnt;
    operation_write.prev_seqence = currentSequenceCnt;
    UDS_SendNegResp(NRC_SERVICE_BUSY);              // first send busy
    // UDS_SendNegResp(NRC_SERVICE_BUSY);              // first send busy
    write_result = NEM_WriteData(&operation_write); // todo write all data at this function
    if (write_result == OP_STATUS_OK)
    {