Commit 74d7770a authored by Sergi Hernandez's avatar Sergi Hernandez
Browse files

Minor chnages in the TX CAN interrupt handling to avoid timout problems.

parent 3ab0bbe6
......@@ -264,8 +264,8 @@ void HAL_CAN_TxCpltCallback(CAN_HandleTypeDef* CANHandle)
}
}
//__HAL_CAN_DISABLE_IT(CANHandle,CAN_IT_TME);
__HAL_CAN_CLEAR_FLAG(CANHandle,CAN_FLAG_RQCP0);
__HAL_CAN_CLEAR_FLAG(CANHandle,CAN_FLAG_TXOK0);
//__HAL_CAN_CLEAR_FLAG(CANHandle,CAN_FLAG_RQCP0);
//__HAL_CAN_CLEAR_FLAG(CANHandle,CAN_FLAG_TXOK0);
}
void HAL_CAN_RxCpltCallback(CAN_HandleTypeDef* CANHandle)
......@@ -381,6 +381,8 @@ unsigned char can_cancel_receive_irq(void)
/* DMA functions */
unsigned char can_send_dma(unsigned char *data,unsigned short int length)
{
__HAL_CAN_CLEAR_FLAG(&CANHandle,CAN_FLAG_RQCP0);
__HAL_CAN_CLEAR_FLAG(&CANHandle,CAN_FLAG_TXOK0);
if(length > 8){
CANHandle.pTxMsg->DLC = 8;
for (uint8_t i=0;i<length;i++)
......@@ -401,14 +403,14 @@ unsigned char can_send_dma(unsigned char *data,unsigned short int length)
{
CANHandle.pTxMsg->Data[i] = data[i];
}
can_send_lenght = 0;
can_send_iterations = 0;
HAL_CAN_Transmit_IT(&CANHandle);
uint8_t byte;
comm_do_dma_send(can_comm_dev);
comm_do_irq_send(can_comm_dev,&byte);
}
//HAL_CAN_Transmit_IT(&CANHandle);
__HAL_CAN_CLEAR_FLAG(&CANHandle,CAN_FLAG_RQCP0);
__HAL_CAN_CLEAR_FLAG(&CANHandle,CAN_FLAG_TXOK0);
return 0x00;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment