If I enable the CAN receiver (like TJA1042), but not enable the corresponding CAN module that connect to this CAN receiver, then when I initiate a power on situation, there will appear some error frames.
Can someone explain to me the specific reason why there are can error frames?
Thanks a lot.
When CAN module is enabled, the TX pin is setup as output and the pull device is disabled. The RX pin is setup as input and pull-down is disabled.
The log0 at TX pin means the dominant state while log1 is the recessive state.
So, it seems that TX pin your case has temporary/permanent log0 until you enable the CAN module.
Please check appropriate pins at the Pin Summary table in RM chapter 1 and focus mainly on reset state.
In the case of Off/Down state, you may need external pull-ups or GPIO initialization prior CAN transceiver enable.
Please check also your GPIO pin initialization code.
Additionally, the CAN module cannot acknowledge any CAN message on CAN bus prior to its own initialization.
So, if the second CAN node sends any data without acknowledging from MCU (or any other CAN node), it will lead to error passive/active frames on CAN bus until the second CAN node ends in the bus-off state.
I hope it helps you.
Have a great day,