Skip to main content
Associate
October 29, 2024
Solved

Issue in CAN Normal mode with STM32F412

  • October 29, 2024
  • 7 replies
  • 1564 views

If anyone Work on project that interfacing Can transceiver TJA1050 with STM32F412RET6 , if yes i hope  anyone send Example code that work and clock configurations ,, the loopback mode work correctly .. but in normal mode problems start ... and operating voltages of TJA

 

This topic has been closed for replies.
Best answer by mƎALLEm

Hello @mohamed_25 and welcome to the community,

Please share your schematics and the code you have used for tests. Are you using CubeMx? please share also the .ioc file

You can inspire from this example: https://github.com/STMicroelectronics/STM32CubeF4/tree/master/Projects/STM324xG_EVAL/Examples/CAN/CAN_Networking

7 replies

Ozone
Principal
October 29, 2024

@mohamed_25 wrote:

If anyone Work on project that interfacing Can transceiver TJA1050 with STM32F412RET6 , if yes i hope  anyone send Example code that work and clock configurations ,, the loopback mode work correctly .. but in normal mode problems start ... and operating voltages of TJA

 


The TJA1050 is just a simple "combinatorial" device, i.e. logic for voltage level adaption. There is no programmable functionality whatsoever. 
Loopback mode works correctly because the loopback is usually internal (i.e. on-chip), and the signals don't leave the MCU (or have no consequence).

If loopback works, the next step is to connect two compatible CAN nodes on digital level directly.
Compatible means either two STM32F412 boards, or two CAN interfaces on the same board. (CAN-TX1 to CAN-RX2, and vice versa).

If that works, you can proceed to different nodes connected via transceivers. You will need a scope, or configurable logic analyser. CAN is a differential bus : https://en.wikipedia.org/wiki/CAN_bus#/media/File:ISO11898-2.svg

 

 

Associate
October 29, 2024

i understand this ,, i use 2 MCUS with 2 tja1050 Transciever but i dont work so i need example code to make sure that problem in hardware

 

Andrew Neil
Super User
October 29, 2024

@mohamed_25 wrote:

 it dont work so i need example code to make sure that problem in hardware


So use a scope or logic analyser to see what's actually happening on the wires.

No point in messing with software if it is a hardware problem!

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
Ozone
Principal
October 29, 2024

Hello Andy, good to hear you are still around ! 
Had been off for months at times, busy with other projects and occupations.

mƎALLEm
ST Technical Moderator
October 29, 2024

The TJA1050 is a 5V transceiver but VIHmin = 2V which is OK.

Meanwhile, what do you set as voltage level for S pin (Silent mode)?

SofLit_0-1730210824649.png

SofLit_1-1730210888431.png

SofLit_0-1730211144231.png

So check if S pin in connected to the ground.

To give better visibility on the answered topics, please click "Best answer" on the reply which solved your issue or answered your question.
mƎALLEm
ST Technical Moderator
November 11, 2024

Hello @mohamed_25 ,

Could you please provide a status on this thread? did you solve your issue?

Thank you.

To give better visibility on the answered topics, please click "Best answer" on the reply which solved your issue or answered your question.