2021-04-17 09:46 AM
Dear sirs,
I am trying to communicate through CANBUS an F407 and an H757 with external MCP transceivers.
The problems I have are:
-For the F407, If I set the mode to Loopback, I see with my external logic analyzer that it sends the message in the CAN1_TX pin, but if I set it to work in normal mode, it sends only the start of frame, but does not continue sending the rest of the message.
-For the H757, is the same but for both Loopback modes (internal and External) and the Normal mode of operation, it only sends the start of frame but then it does not send nothing.
What could be happening? Could it be that the MCPs are wrong? If I try to send from the F407 the message correctly, and read the TX line of the second MCP(the one that should send the message from the bus to the 747, it does not do nothing.
Thank you so much
Best regards.
I attach an screencapture of the F407 sending the message in loopback:
I attach an screencapture of the logic analyzer interface of them sending only the start of frame:
2021-04-17 11:43 AM
Hi,
It is no easy say what is wrong. Please send more information: configuration CAN, Clock in Your project.
Best Regards,
Slawek
2021-04-18 08:48 AM
Hi,
In the H757, the FDCAN is fed by the PLLQ at 42Mhz, with the following config:
In the F407 the can is fed with 42Mhz too, and the following settings:
I would like to achieve between 0.25 and 1 Mbps rates.
Thank you so much
Best regards
2021-04-18 10:10 AM
Hi,
Please see my calculation parameters CAN for STM32F407 and other STM. I see that You have Nominal Prescaler = 20 for H757 and for F407 You have Prescaler = 17. You must have the same value if You have the same clock, TBS1 and TBS2 (Time Bit Segment).
I do not see You Your filter settings. Please send code from Your program.
Best Regards,
Slawek
2021-04-18 10:15 AM
Hi,
For the F407:
CAN_TX_HDR.DLC = 1;
CAN_TX_HDR.IDE = CAN_ID_STD;
CAN_TX_HDR.RTR = CAN_RTR_DATA;
CAN_TX_HDR.StdId = 0x01;
sFilterConfig.FilterFIFOAssignment = CAN_FILTER_FIFO0;
sFilterConfig.FilterIdHigh = 0x05<<5;
sFilterConfig.FilterIdLow = 0x00;
sFilterConfig.FilterMaskIdHigh = 0xFFF<<5;
sFilterConfig.FilterMaskIdLow = 0;
sFilterConfig.FilterScale = CAN_FILTERSCALE_32BIT;
sFilterConfig.FilterActivation = ENABLE;
HAL_CAN_ConfigFilter(&hcan1, &sFilterConfig);
HAL_CAN_Start(&hcan1);
HAL_CAN_ActivateNotification(&hcan1, CAN_IT_RX_FIFO0_MSG_PENDING);
For the H757:
CANhdr_tx.Identifier = 0x00;
CANhdr_tx.DataLength = 1;
CANhdr_tx.IdType = FDCAN_STANDARD_ID;
CANhdr_tx.TxFrameType = FDCAN_DATA_FRAME;
CANhdr_tx.ErrorStateIndicator = FDCAN_ESI_ACTIVE;
CANhdr_tx.BitRateSwitch = FDCAN_BRS_OFF;
CANhdr_tx.FDFormat = FDCAN_CLASSIC_CAN;
CANhdr_tx.TxEventFifoControl = FDCAN_NO_TX_EVENTS;
CANhdr_tx.MessageMarker = 0;
sFilterConfig.IdType = FDCAN_STANDARD_ID;
sFilterConfig.FilterIndex = 0;
sFilterConfig.FilterType = FDCAN_FILTER_MASK;
sFilterConfig.FilterConfig = FDCAN_FILTER_TO_RXFIFO0;
sFilterConfig.FilterID1 = 0x0;
sFilterConfig.FilterID2 = 0x7FF;
HAL_FDCAN_ConfigFilter(&hfdcan1, &sFilterConfig);
HAL_FDCAN_Start(&hfdcan1);
HAL_FDCAN_ActivateNotification(&hfdcan1, FDCAN_IT_RX_FIFO0_NEW_MESSAGE, FDCAN_RX_BUFFER0); //enable interrupts
I want the F407 to send and receive data for identifiers between 0x00 and 0x05, and the H757 to send and receive data for all the identifiers.
Thank you so much
Best regards
2021-04-18 11:34 PM
Hi,
I propose remove filter from incoming message then You will see that You received message. If You write in FilterID and FilterMask zero You should receive all message. Next step is configured settings of Filter.
Best Regards,
Slawek