2025-07-21 6:13 AM
I'm trying to set up CAN communication between two STM32F4 boards using CJMCU-230 transceivers, but I'm not receiving any messages. Here's a full breakdown of the setup and what I've tried:
MCU: STM32F4 Discovery (hcan1)
Transceiver: CJMCU-230
Second Node: Another STM32F4 with same configuration
Bitrate: 125 kbit/s on both ends
Termination: 120Ω termination resistor is likely present on the transceiver (CJMCU-230) board, but not manually added externally. I haven't removed or measured it directly, but many CJMCU-230 modules include onboard termination resistors by default.
GPIO, RCC, NVIC configurations are done correctly.
HAL_CAN_Start() and HAL_CAN_ActivateNotification() are called.
Transmitting messages works fine; HAL_CAN_AddTxMessage() returns HAL_OK.
No CAN message is received via CAN1 RX0 interrupt. The CAN1_RX0_IRQHandler() is never triggered.
HAL_CAN_GetRxMessage() returns HAL_ERROR when called in the main loop.
HAL_CAN_AddTxMessage() sometimes returns HAL_ERROR in the loop, but returns HAL_OK inside an external interrupt.
After sending ~9 messages, the internal hcan1.Instance->ESR register gives a value of 0x800003, which includes:
EPVF (Error Passive Flag) → CAN controller became error-passive
Transmission is no longer possible
CAN messages are sent with:
CAN filter is configured in mask mode, accepting all messages (all ID and mask bits set to 0).
CAN speed: 125 kbps on both devices.
Interrupts and NVIC configuration are properly done.
HAL_CAN_Start() and HAL_CAN_ActivateNotification() are called.
Any ideas or guidance on how to fix this would be greatly appreciated.
2025-07-23 1:28 AM
A transmitting node going error passive is a sign that there is nothing else on the bus capable of sending out "ack" bits, which makes it look like you have a transceiver or bus issue.
Have you verified that you do have termination resistors (measure the resistance between the CAN high and low)?
Have you used a 'scope or logic analyser to see what is getting onto the bus?
2025-07-24 7:47 AM
Thanks a lot for your detailed reply and guidance!
You were absolutely right — the problem was with the transceiver. I was using a CJMCU-230 module, which apparently doesn't have a TJA1050 on it. After struggling for a while with no ACKs and constant Error Passive status on the STM32 side, I decided to replace the transceiver.
I switched to a standard TJA1050-based module, and boom — everything started working flawlessly. CAN communication is now solid, ACKs are received properly, and the bus is alive.
Your message pointed me in the right direction. Much appreciated!
2025-07-24 7:52 AM
Glad it helped.
It would be great if you would accept my original post as the "Accepted solution" so that this thread shows as solved.