@@ -251,7 +251,7 @@ void RAMN_ISOTP_ProcessRxMsg(RAMN_ISOTPHandler_t* handler, uint8_t dlc, const ui
251251 if (handler -> rxMustSendCF == True )
252252 {
253253 uint8_t dlc ;
254- uint8_t data [3U ];
254+ uint8_t data [8U ];
255255 RAMN_ISOTP_GetFCFrame (handler ,& dlc ,data );
256256 handler -> pFC_CANHeader -> DataLength = UINT8toDLC (dlc );
257257 // Ignore potential error. If we miss the answer window, it is up to the diag tool to reduce speed.
@@ -268,7 +268,16 @@ RAMN_Bool_t RAMN_ISOTP_GetFCFrame(RAMN_ISOTPHandler_t* handler, uint8_t* dlc, ui
268268 data [0U ] = 0x30 | handler -> selfFCFlag ;
269269 data [1U ] = handler -> selfBlockSize ;
270270 data [2U ] = handler -> selfST ;
271+
272+ #ifdef ISOTP_ANSWER_PADDING_BYTE
273+ * dlc = 8U ;
274+ for (uint8_t i = 3U ; i < 8U ; i ++ )
275+ {
276+ data [i ] = ISOTP_ANSWER_PADDING_BYTE ;
277+ }
278+ #else
271279 * dlc = 3U ;
280+ #endif
272281 wroteValidMessage = True ;
273282 handler -> rxMustSendCF = False ;
274283 }
@@ -348,6 +357,20 @@ RAMN_Bool_t RAMN_ISOTP_GetNextTxMsg(RAMN_ISOTPHandler_t* handler, uint8_t* dlc,
348357 handler -> txLastTimestamp = tick ;
349358 }
350359 }
360+ #ifdef ISOTP_ANSWER_PADDING_BYTE
361+ // Add padding if required
362+ if (wroteValidMessage == True )
363+ {
364+ if (* dlc < 8U )
365+ {
366+ for (uint8_t i = * dlc ; i < 8U ; i ++ )
367+ {
368+ data [i ] = ISOTP_ANSWER_PADDING_BYTE ;
369+ }
370+ * dlc = 8U ;
371+ }
372+ }
373+ #endif
351374 return wroteValidMessage ;
352375}
353376
0 commit comments