Skip to main content
Associate III
May 22, 2024
Solved

Unable to transmit CAN signal on Bluepill.

  • May 22, 2024
  • 4 replies
  • 1662 views

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.

 

This topic has been closed for replies.
Best answer by Peter BENSCH

No original STM32F103s have been used on Bluepill for a long time, only counterfeits. Please read my replies to this and that thread, maybe some things will become clearer to you.

The cheapest way out would be to desolder the fakes and solder on original STM32F103C8T6, alternatively you can use a suitable NUCLEO board and be happy with it.

Good luck!

Regards
/Peter

4 replies

Peter BENSCH
Peter BENSCHBest answer
ST Technical Moderator
May 22, 2024

No original STM32F103s have been used on Bluepill for a long time, only counterfeits. Please read my replies to this and that thread, maybe some things will become clearer to you.

The cheapest way out would be to desolder the fakes and solder on original STM32F103C8T6, alternatively you can use a suitable NUCLEO board and be happy with it.

Good luck!

Regards
/Peter

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
mƎALLEm
ST Technical Moderator
May 24, 2024

Hello,

As stated by @Peter BENSCH we are not confident about the chip used on Black/Blue pill boards as they are most fake. Additionally, many community members encountered issues with CAN when using these boards.

You can purchase any of ST boards: Nucleo for example and attach a CAN transceiver in Normal mode where another node is attached to the bus. In loopback mode no need for a transceiver.

To give better visibility on the answered topics, please click "Best answer" on the reply which solved your issue or answered your question.
Tesla DeLorean
Guru
May 24, 2024

What's the error? Understand WHAT the HAL is complaining about, when not HAL_OK, perhaps dig into instance looking for ErrorCode type detail. Add optional instrumentation so the software can report failure in a way that you can readily see what's happening, and if failure is cascading.

The FIFO isn't deep, and the CAN peripheral needs to see other devices, and those need to acknowledge acceptance so the pending message can be retired.

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
Senior III
May 25, 2024

What else is connected to the CAN BUS? ,else it will stop sending. Or as explained above try loopback

"If you feel a post has answered your question, please click ""Accept as Solution""."