Understand the high-speed CAN transceiver TJA1145 in one article
Preface
First of all, Xiao T would like to ask you a few questions. You know:
-
What is TJA1145?
-
Do you know the basic logic of sleep wake-up control?
-
How does TJA1145 control the ECU to wake up from sleep?
-
What precautions should be taken when using TJA1145?
Today, let’s explore and answer these questions. In order to facilitate everyone's understanding, the following is the topic outline of this article:
text
Introduction to TJA1145
TJA1145 is a high-speed CAN transceiver customized by NXP for the automotive electronics field. It provides an interface between the CAN controller and the physical CAN twisted pair. Compared with other CAN transceivers, it has the following characteristics:
-
It can maintain extremely low power consumption in Standby and Sleep states, and the power consumption in Sleep state is lower than that in Standy state;
-
Can support some CAN networks that comply with the ISO11898-2:2016 standard through the selective wake-up function;
-
For the two TJA1145/FD variants, TJA1145T/FD and TJA1145TK/FD, the CANFD-Passive function is supported, which can ensure that the node sleeps normally and will not be awakened by the bus CANFD general selection error under the premise of coexistence of CANFD and CAN networks;
-
TJA1145 provides an interface to connect to a 3.3V or 5V microcontroller, and can be used to control CAN transceiver control and status acquisition through SPI;
-
The TJA1145 physical layer implementation meets the ISO11898-2:2016 and SAE J2284 standards, and can achieve stable communication at the CANFD 2M communication rate;
The above characteristics of TJA1145 enable it to be used as a key tool to control the entire power supply system of the ECU. It can reduce the overall current consumption of the ECU as much as possible through the sleep feature, and will only be awakened when there is demand at the application layer.
Figure 1 below shows the basic functional block diagram of TJA1145. The basic functions of each pin are explained as follows:
Figure 3 below shows a detailed explanation of the three major power supply details inside the TJA1145:
-
BAT: This power supply is used to power the TJA1145 system status maintenance. As long as BAT is always on, the TJA1145 related status register value will not be lost, and the CAN receiver is powered by BAT;
-
VCC: On the one hand, this power supply serves as a 5V power input to the TJA1145 system module to monitor whether it is overvoltage or undervoltage. On the other hand, it supplies power to the CAN bus, and the CAN transmitter is powered by VCC;
-
VIO: On the one hand, this power supply is used as a power input to the TJA1145 system module to monitor whether it is overvoltage or undervoltage. On the other hand, it is used as a level conversion for SPI communication;
ECU sleep wake-up concept
In order to let everyone better understand the sleep wake-up control principle, Xiao T will give you a summary according to the definition of sleep wake-up in the AUTOSAR document, which can be divided into the following three scenarios:
Cold start sleep wake-up
Cold start sleep wake-up has the following characteristics:
-
MCU is in power-down state;
-
Some peripheral circuits of the ECU such as the CAN transmitter are in the power supply state (such as KL30 power supply);
-
Wake-up events can be recognized by CAN transceivers;
-
The CAN transceiver can decide whether to wake up the MCU based on the wake-up source and provide power to the MCU;
CAN channel sleep wake-up
CAN channel sleep wake-up has the following characteristics:
-
MCU is always in normal power supply state;
-
At least some peripheral circuits of the ECU, such as the CAN transceiver, are powered;
-
The CAN transceiver is in Standby state;
-
Wake-up events can be recognized by CAN transceivers;
-
After the CAN transceiver identifies a valid wake-up source, it can generate a soft interrupt to wake up the MCU or the MCU periodically checks whether there is a valid wake-up source;
CAN channel and MCU sleep wake-up
CAN channel and MCU-style sleep wake-up have the following characteristics:
-
MCU is in low power consumption state;
-
At least some peripheral circuits of the ECU, such as the CAN transceiver, are powered;
-
The CAN transceiver is in Standby state;
-
Wake-up events can be recognized by CAN transceivers;
-
After the CAN transceiver recognizes a valid wake-up source, it can generate a soft interrupt to wake up the MCU;
Sleep wake-up control principle
Through the above summary of sleep wake-up types, I believe everyone can collect the sleep scenarios encountered in their work and correspond them one by one. Xiao T will combine the most common cold start sleep wake-up to communicate with you from both the hardware and software levels. Basic principles of sleep wake-up control.
Hardware level:
As shown in Figure 4 below, Xiao T will explain the sleep wake-up control principle at the hardware level from two aspects: MCU chip power supply and TJA1145 status acquisition control:
S1: When the MCU meets the sleep conditions, it sends the SPI corresponding command to let the TJA1145 enter the Sleep state ;
S2 : After TJA1145 enters Sleep state, the INH pin will be pulled low to control 5V or 3V to turn off the power output, which indirectly causes the entire MCU system to process a power-off state . At this time, TJA1145 is always in the power supply state (because BAT is always powered). The entire ECU successfully enters the sleep state;
S3 : Although TJA1145 is in Sleep state, it is an extremely low power consumption state. It also detects whether there is a valid wake-up source on the network synchronously ;
S4 : When TJA1145 finds a valid wake-up source, it will automatically switch from Sleep state to Standby state . In Standby state, the INH pin is pulled high. At this time, 5V and 3V will be output normally, so that the MCU is powered normally and the program starts normally. run;
Software level:
Based on the AUTOSAR software architecture, the detection and processing mechanism of sleep wake-up is implemented by the EcuM module. For a detailed introduction to EcuM, please refer to the article " AUTOSAR Basics - EcuM ". The ComM module is responsible for opening the communication module. At this stage, BswM can implement some customized control behaviors to meet the special requirements of each project.
本文不会过多阐述细节,仅在说明整个休眠唤醒过程在软件逻辑层面具体如何来实现,参考如下图5所示:
S1 :当MCU Power ON之后由EcuM模块便会检查唤醒源是否有效,若有效,则通知ComM模块开启通信, 进而通过SPI通信控制TJA1145进入Normal状态 ,同时通知BswM模块开启其他BSW模块的控制以及让EcuM进入到RUN模式;
S2 :当MCU PowerON之后由 EcuM模块识别唤醒源无效,便会直接走下电流程,最终控制TJA1145进入到Sleep状态;
S3 :在系统正常工作后如果满足休眠条件(如外界没有NM报文),MCU便会控制TJA1145进入到Sleep状态;
S4 :当TJA1145处于Sleep状态下会检测休眠前设定的唤醒源, 如果唤醒源满足条件,TJA1145切换至Standby状态,从而Power ON MCU,最终走向EcuM唤醒源检测验证流程;
TJA1145控制
如上述过程MCU通过SPI总线接口实现了针对TJA1145状态的控制与获取。针对TJA1145的控制过程可分为TJA1145 Operating Mode的控制以及内部CAN Operating Mode两种类型。
TJA1145 Operating Mode
在TJA1145内部存在一系统控制器包含如下五种运行状态机: Normal,Standby,Sleep,Overtemp,Off 状态。接下来将针对这五种状态进行一一讲解每个状态的基本特征以及相应的SPI控制指令。
-
Normal: 该模式下TJA1145处于全功能模式下,所有功能均可用,可通过 MC=111从Standby或者Sleep状态切换至Normal状态;
-
Standby: 该模式下TJA1145处于低功耗状态,不过不能够正常收发数据,但是INH引脚可以始终保持拉高状态;
如果此时寄存器CWE=1,那么此时receiver会持续监控总线电平状态,如果寄存器CPNC=PNCOK=1,那么就开启了特定帧唤醒,否则就是标准CAN唤醒(010101切换就可唤醒,即所说的任意帧唤醒);
-
当电压满足特定下限时便会自动从Off状态切换至Standby状态;
-
当监测到温度没有再次发生过温便会自动从Overtemp状态切换至Standby状态;
-
在Sleep状态下检测下唤醒源便会自动切换至Standby状态;
-
通过SPI指令MC=100将状态从Normal或者Sleep状态切换至Standby状态;
-
在Normal状态下发送指令MC=001准备切换至Sleep状态,但此时存在唤醒源或者所有的唤醒源检测全部关闭,该特性从一定程度上避免了死锁;
-
Sleep: 该模式下TJA1145处于最低功耗状态下,且不能正常收发数据,同时INH引脚处于高阻状态,电源供电一般会通过该引脚进行拉低关闭输出。同时其状态变化存在如下几种可能:
-
一个有效唤醒源或者中断事件( 除去SPIF事件 )或者 SPI指令(SPI通讯速率不能过高) 则可以唤醒TJA1145从Sleep状态切换至Standby状态;
-
在Normal或者Standby状态下通过发送MC=001便可以进入到Sleep状态,同步须确保至少存在一个唤醒源使能(如CAN唤醒或者Wake pin唤醒)且没有pending状态下的唤醒源;
-
如果VCC或者VIO持续一段事件低于某个阈值,那么该低电压事件将会强制让TJA1145进入到Sleep状态,与此同时所有的Peding的唤醒源将会被清除,CWE=1以及WPFE=WPRE=1使能同时特定帧唤醒功能将会被Disable(CPNC=0);
该强制进入到Sleep状态可通过TJA1145主状态寄存器(03h)中的FSMS状态位来获取,如果FSMS为1表示最近一次进入到Sleep状态是由于低电压进入到Sleep状态,否则是通过SPI指令完成的状态切换。
-
**Overtemp: ** 该状态是由于TJA1145放置温度过高导致被损坏的一个功能,一旦在Normal状态下温度超出一定阈值就会自动切换至OverTemp保护状态;
-
为了放置数据的丢失,TJA1145在温度超过预警阈值时会主动触发一个Warning,该Warning发生时就会触发OTWS置位,中断产生(即OTW=1)如果OTWE使能的前提下;
-
在该模式下,CAN收发器将不能正常工作,CAN pin脚始终处于高阻状态,唤醒源将不会被检测,但是如果存在Pending的唤醒源,那么RXD引脚就会被拉低;
-
当温度低于特定阈值时,那么该状态便会自动切换至Standby状态;
-
如果Bat电压引脚低于某个特定阈值,则会自动从该状态切换至OFF状态;
-
Off: 在该状态下电压由于低于特定阈值导致供电不足,当Bat首次连接时这是TJA1145的初始状态, 只要Bat电压低于某特定阈值,那么TJA1145将会从任意状态直接切换至Off状态 。在Off状态下,CAN pin脚以及INH引脚始终处于高阻状态;
当电压高于某个特定阈值时,TJA1145便会重新启动触发初始化过程,从而经历特定时候后进入到Standby状态;
As shown in Figure 7 below, it shows the relationship between TJA1145 Operation Mode and SPI communication, INH pin, internal CAN module status and RXD pin. The following points are particularly noteworthy:
-
In the Standby state, the INH pin can be pulled high to control the power input of all levels of the MCU, but CAN cannot send and receive communications normally;
-
In the Normal state, SPI can communicate normally, and the INH pin is pulled high. The status of the CAN module depends on the CMC value. Normal communication can only be enabled in the Active state, and normal sending and receiving can only be enabled when CMC=01/10/11;
-
In the Sleep state, the INH pin is in a high-impedance state. At this time, the MCU power supply at all levels can be turned off, and the CAN is always in the Offline state, unable to send and receive communications normally;
-
In the Off state and Overtemp state, SPI cannot communicate normally. In the Sleep state, it is only possible when the VIO power supply is normal, and the communication rate cannot be too high;
-
Wake-up events are only detected in the Standby and Sleep states, that is, the detection of wake-up events can only be turned on when the CAN is in Offline mode;
Can Operating Mode
The CAN transceiver integrated inside the TJA1145 has four states: Active, Listen-Only, Offline , and Offile Bias states. There are two basic combinations:
-
When TJA1145 is in Normal state, the CAN transceiver status depends on the CMC value, such as entering Offline or Active or Listen-only, etc.;
-
When TJA1145 is in Standby or Sleep state, the CAN transceiver is always in Offline state;
CAN Active Mode
-
The CAN transceiver can send or receive data normally in this mode;
-
When CMC=0x01 , the CAN transceiver is in the Active state, and VCC low voltage detection is enabled. If VCC voltage appears, it will directly switch to CAN Offline or Offline Bias state;
-
When CMC=0x10 , the CAN transceiver is in the Active state, and VCC voltage detection is suppressed. If the VCC voltage is abnormal, it will not affect the normal switching of CAN Active; ( In actual applications, it is preferred to uniformly configure CMC=0x10 to reduce The status keeps switching repeatedly )
CAN Listen-only Mode
-
In this mode, the CAN transmitter is turned off. When the TJA1145 is in the Normal state and CMC=0x11, the CAN transceiver status will be in the Listen-only state ;
-
In this mode, if the TJA1145 is in the Normal state and CMC=0x1, and the VCC voltage is lower than 90%, it will always be in this Listen-Only state;
CAN Offline and Offline Bias Mode
-
In CAN Offline mode, the CAN transceiver will detect the CAN bus to see if there is a wake-up event. At the same time, CWE=1, CAN H and CAN L are always biased to ground;
-
In CAN Offline Bias Mode, it will also detect whether there is a wake-up event on the CAN bus, but CAN H and CAN L will be biased by 2.5V. When there is no activity on the event bus for more than a period, it will return to CAN Offline mode;
-
When TJA1145 switches to Standby or Sleep state, it will directly switch to this state;
-
When the TJA1145 status is Normal and CMC=0x0, the status will be switched to CAN Offline mode;
-
When the TJA1145 status is Normal and CMC=01 and VCC<90%, the status will also be switched to CAN Offline mode;
CAN Off Mode
-
When the TJA1145 state is Off state or Overtemp state;
-
When the Bat voltage is lower than a specific threshold voltage of the CAN receiver, when the BAT voltage rises to a specific threshold, it will enter the CAN Offline mode;
Common register configuration instructions
When using TJA1145 normally, whether it is the initialization process or normal control, we need to control the common TJA1145 registers. Therefore, Xiao T lists the common registers and related functions based on the actual needs of the project, as shown in Figure 9 below. Shown:
TJA1145 Precautions
-
When using TJA1145, if you need to use its CAN FD Passive function ( register 0x2F sets CFDC=1 ), you need to select model TJA1145/FD to have it;
-
TJA1145 only supports specific frame wake-up in CAN frame format by default ;
-
If the VCC/VIO voltage undervoltage monitoring is enabled, if it occurs during the slow rise and fall process, the TJA1145 state will be directly switched to the sleep state. Therefore, CMC=0x10 is generally preferred to suppress the voltage undervoltage detection.
Sharing is not easy, if you have learned something , thank you. Click [????] + [Watching]