Unable to transmit CAN signal on Bluepill.
I am transmitting a CAN signal using bluepill but there is no signal on the CAN Bus. I added two counters which will check whether transmission was successful with the following code.
if(HAL_CAN_AddTxMessage(&hcan, &TxHeader, TxData, &TxMailbox) == HAL_OK){
transmitCount++;
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_13, 0);
} else {
failCount++;
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_13, 1);
}The transmitCount is increasing till 19 everytime, and then failCount starts to increase.
This is not happening always, sometimes it works properly, sometimes it causes issue. I currently have 2 bluepills, this issue is happening in one and the other is working properly. but earlier, both bluepills were working.
I have made the CAN bus hardware as stable as possible to eliminate any loose connections. So loose connection is highly unlikely. They why might it be behaving differently everytime? Why is it increasing till exactly 19 everytime?
I have attached the full project, ioc file and main.c file with this question.
