Using CAN2 (slave) without CAN1 (master)?
Hi, I have just received a custom PCB using STM32F413RG (64 pin package) for a university design competition. We are using a single CAN bus (CAN2) for this PCB. I was trying to get CAN communication working and I only managed to get some junk data from the STM32.
Details are below. My questions are:
- What exactly is the master-slave relationship between CAN1 and CAN2?
- Is it possible to use CAN2 alone while the CAN1 pins are used for other peripherals?
- What setup for CAN1 needs to be done in order to use CAN2 alone?
- If CAN2 cannot be used alone, is it possible to use CAN1 alone?
- If CAN1 cannot be used alone, then we must use CAN3 only?
I found that when using CAN2, the CAN_TIR register (containing CAN message ID) and CAN_TDTR register (containing CAN message DLC) have junk in them which is NOT overwritten by the AddTxMessage HAL function (except for the TX request bit in TIR register). Thus I get CAN messages, but they have a junk ID and a DLC of 11 (obviously junk). I tried writing directly to the registers in my program and reading back the values, but they did not change.
As an experiment, I tried to write to the CAN1 TIR and TDTR registers with random values and read them back. This worked perfectly fine.
Investigating the reference manual RM0430, I found that CAN2 is a "slave" to CAN1 "master," in dual CAN configuration, while CAN3 is for single CAN configuration. However, the RM0430 document is unclear regarding the exact "master-slave" relationship between CAN1 and CAN2.