cancel
Showing results for 
Search instead for 
Did you mean: 

CAN intermittent send message failures with Blue Pill board

pulsar
Associate II

I'm doing can-bus work with F103 and having a problem I can't figure out.

I'm listening for a specific message, it's on a 20ms interval, and then when that message arrives I right away broadcast a new message using the same id but with different data.  To do this I'm setting a flag inside HAL_CAN_RxFifo0MsgPendingCallback and then monitor this flag inside the main loop. If the flag is set I'm calling HAL_CAN_AddTxMessage to send a new message and resetting the flag.  This repeats.

Now, everything seems to be working most of the time, but at random times, it can be a minute or several minutes or longer, my messages are not sent for a second or few seconds or randomly sent/not sent for few seconds.  Then everything will go back to normal for a while and then it might get "broken" again.  This will repeat.

HAL_CAN_AddTxMessage() is always returning OK.

HAL_CAN_TxMailbox[0-2]CompleteCallback() are not being called when I notice the failures.

There are 3 other nodes on this network; one is my CAN analyzer and two are locked commercial devices.

 

Any help is appreciated.  Thank you.

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

@pulsar wrote:

I've been working with Blue Pill + external CAN transceiver and my own custom very simple PCB with f103


Note that Blue Pill boards and some other colorful boards -most probably- contain a counterfeit MCU. I remember in this forum that some people faced issues with these boards especially with CAN communication.

So what I suggest is to purchase a chip ST board like NUCLEO-F103 and we are here to help you.

Thank you for your understanding.

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.

View solution in original post

4 REPLIES 4
mƎALLEm
ST Employee

Hello,

You need to provide more and more deials then that when it comes to CAN communication issues.

1- Provide your Hardware details. Saying that you are using F103 with other nodes does tell anything. So you need to provide your schematics especially the STM32 side.

2- What is your Clock configuration? have you used an external crystal or used the internal HSI?. It's recommended to use HSE with a crystal or any other precise clock source.

3- Check you wiring and connections with a contuinuity tester.

 

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.
pulsar
Associate II

I've been working with Blue Pill + external CAN transceiver and my own custom very simple PCB with f103 and CAN transceiver.

My custom PCB does not have an external crystal but the blue pill does, tried both HSI and HSE on the blue pill and they behave the same.

I'm listening for errors via the HAL_CAN_ErrorCallback and it's always the same error:

Decimal:2048

Hex:0x800

 

I'm not sure what that error is exactly.  Hard to see it being a wiring issue since it's all sitting on my desk and works fine most of the time while running, just from time to time it goes into a state where it triggers the errors and then it goes back to running fine again.

Attached is the .ico from the project.

pulsar
Associate II

So it looks like its throwing arbitration lost error.

#define HAL_CAN_ERROR_TX_ALST0 (0x00000800U /*!< TxMailbox 0 transmit failure due to arbitration lost */


@pulsar wrote:

I've been working with Blue Pill + external CAN transceiver and my own custom very simple PCB with f103


Note that Blue Pill boards and some other colorful boards -most probably- contain a counterfeit MCU. I remember in this forum that some people faced issues with these boards especially with CAN communication.

So what I suggest is to purchase a chip ST board like NUCLEO-F103 and we are here to help you.

Thank you for your understanding.

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.