2024-10-06 07:14 AM - edited 2024-10-06 07:15 AM
Hi,
I am using STM32G0B1CBT3 controller and would like to send and receive data in classic mode. I have configured all necessary parameters using cubemx but the buffer is getting full when I call this function HAL_FDCAN_AddMessageToTxFifoQ(&hfdcan1, &TxHeader, TxData).
The CAN termination is connected properly.
Following are my configuration settings:
2024-10-08 06:46 AM
Hello @vrushalighorpade,
For your application, I recommend referring to the example located at Projects/STM32G0C1E-EV/Examples/FDCAN/FDCAN_Classic_Frame_Networking. It includes a .ioc file for STM32CubeMX, allowing you to easily customize the configuration to suit your specific needs.
2024-10-08 07:03 AM - edited 2024-10-08 07:05 AM
Hello @vrushalighorpade and welcome to the community,
As per your main.c, you are using Normal mode:
hfdcan1.Init.Mode = FDCAN_MODE_NORMAL;
1- What board are you using? custom or ST board example: NUCLEO-G0B1?
2- Are you using a CAN transceiver?
3- Did you connect another CAN node on the bus?
4- This CAN timing is not optimized for good operation:
hfdcan1.Init.NominalPrescaler = 16;
hfdcan1.Init.NominalTimeSeg1 = 3;
hfdcan1.Init.NominalTimeSeg2 = 4;
Your sample point needs to be between 75% and 85%. So please decrease the prescaler as much as possible and increase BS1 and BS2 in such way: BS1 ~= (75% to 85%)x(BS1+BS2).
Please also review this article.
2024-10-10 11:02 AM
Thank You for your reply. Now buffer overflow error is solve by making changes in transceiver but still I am experiencing CAN frame receive and transmit issue.
Not able to transmit and receive CAN frames using CANFD classic mode on STM32G0B1CBT3
Following are the answers for your questions
1- What board are you using? custom or ST board example: NUCLEO-G0B1?
Ans : I am using custom Board with STM32G0B1CBT3
2- Are you using a CAN transceiver?
Ans : Yes, TCAN1044AVDRQ1e
3- Did you connect another CAN node on the bus?
Ans : At another end I have connected PCAN USB adapter and checking CAN messages on Busmaster/PCAN View
4- This CAN timing is not optimized for good operation:
Ans : Tried to optimize the prescaler but no success.
Anything else am I missing?
Thank You.
2024-10-10 11:03 AM
Hi,
I have modified .ioc file example file based on my requirement but no success.
2024-10-10 11:14 AM
As I am using normal mode and classic frame format is it necessary to configure following parameters for normal mode as well?
2024-10-11 12:44 AM
Hello,
As you are using Classic mode, no need to configure data timings, but you need to configure the number of filters.
Could you please attach your project?
Other questions:
As you are using TCAN1044 transceiver, does it have VIO pin? How did you connect it?
Do you have 120 ohm termination resistors at both sides of the bus?
Could you please show your schematics?
2024-10-11 12:51 AM
Test in loopback mode.
If it works then it's hardware issue. If it doesn't work, then something in your code.
2024-10-25 08:38 AM
Hello @vrushalighorpade ,
Could you please state on this thread please? did you solve your issue?