AURIX™ Forum Discussions
I'm encountering a problem with CAN transmission in TC233, and I could really use some assistance in troubleshooting it.
The scenario is as follows: I've utilized code from the iLLD example source for CAN initialization. Initially, I developed code for TC234, where P20_8 and P20_7 pins were configured as CAN TX and CAN RX pins respectively. This code works perfectly fine in TC234.
However, when I attempted to adapt the same code for TC233, making the necessary adjustments such as changing the pins to P14_0 and P14_1 and updating the Node1 settings, the code doesn't function as expected in either TC233 or TC234.
I have shared the code below.
/********************************************************************************************************************
* \file MULTICAN.c
* \copyright Copyright (C) Infineon Technologies AG 2019
*
* Use of this file is subject to the terms of use agreed between (i) you or the company in which ordinary course of
* business you are acting and (ii) Infineon Technologies AG or its licensees. If and as long as no such terms of use
* are agreed, use of this file is subject to following:
*
* Boost Software License - Version 1.0 - August 17th, 2003
*
* Permission is hereby granted, free of charge, to any person or organization obtaining a copy of the software and
* accompanying documentation covered by this license (the "Software") to use, reproduce, display, distribute, execute,
* and transmit the Software, and to prepare derivative works of the Software, and to permit third-parties to whom the
* Software is furnished to do so, all subject to the following:
*
* The copyright notices in the Software and this entire statement, including the above license grant, this restriction
* and the following disclaimer, must be included in all copies of the Software, in whole or in part, and all
* derivative works of the Software, unless such copies or derivative works are solely in the form of
* machine-executable object code generated by a source language processor.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
* WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
* COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*********************************************************************************************************************/
/*********************************************************************************************************************/
/*-----------------------------------------------------Includes------------------------------------------------------*/
/*********************************************************************************************************************/
#include "MULTICAN.h"
#include "string.h"
/*********************************************************************************************************************/
/*-------------------------------------------------Global variables--------------------------------------------------*/
/*********************************************************************************************************************/
AppMulticanType g_multican; /* Global MULTICAN configuration and control structure */
AppLedType g_led; /* Global LED configuration and control structure */
uint32 Battery_Saving_Mode, Low_Power_Mode, Mode,Motor_ON_OFF, MCU_ON_OFF;
/*********************************************************************************************************************/
/*---------------------------------------------Function Implementations----------------------------------------------*/
/*********************************************************************************************************************/
/* Macro to define Interrupt Service Routine.
* This macro:
* - defines linker section as .intvec_tc<vector number>_<interrupt priority>.
* - defines compiler specific attribute for the interrupt functions.
* - defines the Interrupt service routine as ISR function.
*
* IFX_INTERRUPT(isr, vectabNum, priority)
* - isr: Name of the ISR function.
* - vectabNum: Vector table number.
* - priority: Interrupt priority. Refer Usage of Interrupt Macro for more details.
*/
IFX_INTERRUPT(canIsrTxHandler, 0, ISR_PRIORITY_CAN_TX);
//IFX_INTERRUPT(canIsrRxHandler, 0, ISR_PRIORITY_CAN_RX);
IFX_INTERRUPT(canIsrRxHandler, 0, ISR_PRIORITY_CAN_RX);
/* Interrupt Service Routine (ISR) called once the TX interrupt has been generated.
* Turns on the LED1 to indicate successful CAN message transmission.
*/
void canIsrTxHandler(void)
{
/* Just to indicate that the CAN message has been transmitted by turning on LED1 */
// IfxPort_setPinLow(g_led.led1.port, g_led.led1.pinIndex);
IfxPort_togglePin(g_led.led2.port, g_led.led2.pinIndex);
}
void canIsrRxHandler(void)
{
volatile IfxMultican_Status readStatus[10];
memset(readStatus, 0, 10*sizeof(readStatus[0]));
for(int i = 1; i <= 2; i++)
{
Ifx_CAN_MO *hwObj = IfxMultican_MsgObj_getPointer(g_multican.canDstMsgObj.node->mcan, i);
if(hwObj->STAT.B.NEWDAT != 0)
{
IfxPort_togglePin(g_led.led2.port, g_led.led2.pinIndex);
g_multican.canDstMsgObj.msgObjId = i;
readStatus[i-1] = IfxMultican_Can_MsgObj_readMessage(&g_multican.canDstMsgObj, &g_multican.rxMsg);
}
}
}
/* Interrupt Service Routine (ISR) called once the RX interrupt has been generated.
* Compares the content of the received CAN message with the content of the transmitted CAN message
* and in case of success, turns on the LED2 to indicate successful CAN message reception.
*/
/*Function to initialize MULTICAN module, nodes and message objects related for this application use case */
void initMultican(void)
{
IfxMultican_Can_initModuleConfig(&g_multican.canConfig, &MODULE_CAN);
g_multican.canConfig.nodePointer[TX_INTERRUPT_SRC_ID].priority = ISR_PRIORITY_CAN_TX;
g_multican.canConfig.nodePointer[RX_INTERRUPT_SRC_ID].priority = ISR_PRIORITY_CAN_RX;
IfxMultican_Can_initModule(&g_multican.can, &g_multican.canConfig);
IfxMultican_Can_Node_initConfig(&g_multican.canNodeConfig, &g_multican.can);
g_multican.canNodeConfig.txPin = &IfxMultican_TXD1_P14_0_OUT;
g_multican.canNodeConfig.rxPin = &IfxMultican_RXD1B_P14_1_IN;
g_multican.canNodeConfig.loopBackMode = FALSE;
g_multican.canNodeConfig.nodeId = IfxMultican_NodeId_1;
g_multican.canNodeConfig.rxPinMode = IfxPort_InputMode_pullUp;
g_multican.canNodeConfig.txPinMode = IfxPort_OutputMode_pushPull;
// g_multican.canNodeConfig.alertInterrupt.enabled = FALSE;
IfxMultican_Can_Node_init(&g_multican.canSrcNode, &g_multican.canNodeConfig);
//IfxMultican_Can_Node_init(&g_multican.canDstNode, &g_multican.canNodeConfig);
TX_CAN_ID_Init();
RX_CAN_ID_Init();
}
void TX_CAN_ID_Init(void){
IfxMultican_Can_MsgObj_initConfig(&g_multican.canMsgObjConfig, &g_multican.canSrcNode);
/*** The msgObjId for CAN TX must be different from all CAN RX msgObjId ***/
g_multican.canMsgObjConfig.msgObjId = SRC_MESSAGE_OBJECT_ID;
g_multican.canMsgObjConfig.messageId = CAN_MESSAGE_ID; // 0x777
g_multican.canMsgObjConfig.frame = IfxMultican_Frame_transmit;
g_multican.canMsgObjConfig.txInterrupt.enabled = TRUE;
g_multican.canMsgObjConfig.txInterrupt.srcId = TX_INTERRUPT_SRC_ID;
IfxMultican_Can_MsgObj_init(&g_multican.canSrcMsgObj, &g_multican.canMsgObjConfig);
}
void RX_CAN_ID_Init(void){
IfxMultican_Can_MsgObj_initConfig(&g_multican.canMsgObjConfig, &g_multican.canDstNode);
/*** Each Message Object ID is attached with unique CAN ID ***/
g_multican.canMsgObjConfig.msgObjId = DST_MESSAGE_OBJECT_ID;
g_multican.canMsgObjConfig.messageId = 0x333;
g_multican.canMsgObjConfig.frame = IfxMultican_Frame_receive;
g_multican.canMsgObjConfig.rxInterrupt.enabled = TRUE;
g_multican.canMsgObjConfig.rxInterrupt.srcId = RX_INTERRUPT_SRC_ID;
IfxMultican_Can_MsgObj_init(&g_multican.canDstMsgObj, &g_multican.canMsgObjConfig);
g_multican.canMsgObjConfig.msgObjId = DST_MESSAGE_OBJECT_ID+1;
g_multican.canMsgObjConfig.messageId = 0x444;
g_multican.canMsgObjConfig.frame = IfxMultican_Frame_receive;
g_multican.canMsgObjConfig.rxInterrupt.enabled = TRUE;
g_multican.canMsgObjConfig.rxInterrupt.srcId = RX_INTERRUPT_SRC_ID;
IfxMultican_Can_MsgObj_init(&g_multican.canDstMsgObj, &g_multican.canMsgObjConfig);
}
void transmitCanMessage(void){
const uint32 dataLow = 0x11111111;
const uint32 dataHigh = 0x22222222;
/* Invalidation of the RX message */
IfxMultican_Message_init(&g_multican.rxMsg,
INVALID_ID_VALUE,
INVALID_DATA_VALUE,
INVALID_DATA_VALUE,
g_multican.canMsgObjConfig.control.messageLen);
IfxMultican_Message_init(&g_multican.txMsg,
CAN_MESSAGE_ID,
dataLow,
dataHigh,
g_multican.canMsgObjConfig.control.messageLen);
IfxMultican_Can_MsgObj_sendMessage(&g_multican.canSrcMsgObj, &g_multican.txMsg);
}
void initLed(void){
/* ======================================================================
* Configuration of the pins connected to the LEDs:
* ======================================================================
* - define the GPIO port
* - define the GPIO pin that is the connected to the LED
* - define the general GPIO pin usage (no alternate function used)
* - define the pad driver strength
* ======================================================================
*/
g_led.led1.port = &MODULE_P13;
g_led.led1.pinIndex = 0;
g_led.led1.mode = IfxPort_OutputIdx_general;
g_led.led1.padDriver = IfxPort_PadDriver_cmosAutomotiveSpeed1;
g_led.led2.port = &MODULE_P13;
g_led.led2.pinIndex = 1;
g_led.led2.mode = IfxPort_OutputIdx_general;
g_led.led2.padDriver = IfxPort_PadDriver_cmosAutomotiveSpeed1;
/* Initialize the pins connected to LEDs to level "HIGH"; will keep the LEDs turned off as default state */
IfxPort_setPinHigh(g_led.led1.port, g_led.led1.pinIndex);
IfxPort_setPinHigh(g_led.led2.port, g_led.led2.pinIndex);
/* Set the pin input/output mode for both pins connected to the LEDs */
IfxPort_setPinModeOutput(g_led.led1.port, g_led.led1.pinIndex, IfxPort_OutputMode_pushPull, g_led.led1.mode);
IfxPort_setPinModeOutput(g_led.led2.port, g_led.led2.pinIndex, IfxPort_OutputMode_pushPull, g_led.led2.mode);
/* Set the pad driver mode for both pins connected to the LEDs */
IfxPort_setPinPadDriver(g_led.led1.port, g_led.led1.pinIndex, g_led.led1.padDriver);
IfxPort_setPinPadDriver(g_led.led2.port, g_led.led2.pinIndex, g_led.led2.padDriver);
}
Show Less
Hi,
Above example was very helpful to do board to board CAN communication using CAN0, node0 to CAN0, node0
using pins
Example_Pins.txPin= &IfxCan_TXD00_P20_8_OUT;
Example_Pins.rxPin= &IfxCan_RXD00B_P20_7_IN;
I was trying to use CAN0, node1 to CAN0, node1 using following pins
Example_Pins.txPin= &IfxCan_TXD01_P14_0_OUT;
Example_Pins.rxPin= &IfxCan_RXD01B_P14_1_IN;
I changed the line
g_mcmcan.canNodeConfig.nodeId = IfxCan_NodeId_0;
to
g_mcmcan.canNodeConfig.nodeId = IfxCan_NodeId_1;
But CAN is not working for CAN0, Node1 to CAN0, node-1.
Will be helpful if can get any suggestions.
Show Less
Hello together,
I'm writing a Task scheduler and stuck with some problems after the context switch.
After restoring the context for the next Task:
__builtin_tricore_mtcr_by_name("pcxi", lower_context);
__builtin_tricore_isync();
ULONG psw = __builtin_tricore_mfcr_by_name("psw");
psw &= ~(PSW_CDE_MASK);
__builtin_tricore_mtcr_by_name("psw", psw);
__builtin_tricore_isync();
__asm("rslcx");
__asm("rfe");
the "rfe" calls the correct Task function. But the "rfe" will not set new return address in A[11] register. It is 0. When the Task function ends with "ret16" the µC runs in a trap.
Missed I something in the preparation of the context switch?
What is the correct behavior of A[11] after the context switch/"rfe"?
Thanks!
BR
Christoph
Show Less
你好
目前使用"UART_VCOM_1_KIT_TC397_TFT"範例在Triboard TC397上進行測試。
開啟兩組ASCLIN 模組0跟模組4並且在中斷設置中有更改相對應的向量表數值,進行以下交互測試:
1. CPU0_Main.c內執行兩組ASCLIN初始化、只有調整"中斷向量表數值(0)"跟進行輸出"Hello World!" ==> 可以正常顯示
2. CPU1_Main.c內執行兩組ASCLIN初始化、只有調整"中斷向量表數值(1)"跟進行輸出"Hello World!" ==> 無法顯示
3. CPU2_Main.c內執行兩組ASCLIN初始化、只有調整"中斷向量表數值(2)"跟進行輸出"Hello World!" ==> 可以正常顯示
4. CPU3_Main.c內執行兩組ASCLIN初始化、只有調整"中斷向量表數值(3)"跟進行輸出"Hello World!" ==> 可以正常顯示
想請問為何在CPU1_Main.c會有此問題?
#AURIX
#Tricore
Show Less
Hi, experts.
When debugging Infineon example "Flash_Programming_1_KIT_TC334_LK ", I found that when I used the default parameters, Flash can be erased normally, but when I changed the initial address of erase from 0xA00E0000 to 0x80080020, I found that the erase seemed to fail. when I changed the initial address of erase from 0xA00E0000 to 0x80080020, I found that the erase seemed to fail, I think it may be caused by the macro definition "#define RELOCATION_START_ADDR (0x70100000U) ", please tell me what this macro definition means, and how to solve the problem here, thank you!
smartconx_target@Q!w2e3r4t5y6u7i8o9p0||/t5/AURIX/The-Infineon-example-quot-Flash-Programming-1-KIT-TC334-LK-quot-failed-to-erase/td-p/723792
Show Less我在TC387上移植英飞凌ADS例程中的FreeRTOS+Lwip,移植成功后调试模式ETH能够通信,但是在冷启动后,ETH是不通的, 但是如果我在IfxGeth_Eth_WaitTransmitBuffer()中增加系统复位的功能,在冷启动并在系统复位后,ETH又能够通信,这个是因为什么原因引起的?
1. 调试模式,能够发出到DOIP报文
2.冷启动后,是不能发出DOIP报文
3. 在下面函数中如果tx为NULL,则启动系统复位
Show Less
我现在有6路pwm波,A、B、E、F、G、H,这六路pwm需要同时调频移相,我的B、E需要基于A移向,F需要基于E移相,G和H需要基于E移相,但是GTM-TOM模块pwm同时输出并满足移相有两种情况,一种是都基于A去移相,一种是基于前一个通道去移相,一旦我使用第一种,我的F基于A移相就会超过50%,这将导致PWM出现一个周期的高电平的波形,如果使用第二种我又无法满足我的移相标准,请问是否可以混合使用这两种模式,怎么使用?
祝好!
Show Less[HTML]CPU code execution is switched from Flash to PSPR RAM. Flash modules are
deactivated via FCON register.[/HTML]
There are no information about PSPR RAM register or how to switch this execution.
How can i do it ?
I work on Tc222L Show Less
Hi.
I'm a student. I have a PCB with the SAK-TC214L-8F133 chip on it. I would like to be able to connect to it using Memtool. I see Memtool supports this layout. I have a USB-UART converter.
How should I connect from the hardware side? Connect TxD from the converter to P14.1 (ASCLIN0_RXA) and RxD to P14.0 (ASCLIN0_TX)? I did that, but Memtool does not detect the chip. Do I need to short any configuration pins to VCC/GND?
I will be grateful for your help.
1.0 On March 19th Infineon Technical Community hosted a conference with the theme "Infineon AURIX ™ TC3xx Automotive Grade Microcontrollers and Typical Modules Tips and Utilization ( CAN-FD, SMU, ADC )" online seminar, details are as follows
If you missed that live broadcast, don't worry, you can click this link to watch it back: AURIX ™ TC3 special live broadcast, detailing automotive-grade microcontrollers and typical module skills and applications
The link to the live class and materials can be downloaded in the attachment
2.0 The broadcast had a total of 206 questions because of the large number of participants, and some of the more representative questions are selected here for a unified response:
- Question: Is the emergency stop output controlled by SMU_CORE? Or is it triggered directly by a fault signal
Answer: It is set by SMU in advance, and the emergency stop will be triggered when the corresponding alarm appears
- Question: Is it possible to reuse the ecology of the upcoming AURIX TC4x series with the TC3x series? Is it possible to describe the porting difficulty?
Answer: some can be reused. The porting difficulty varies from package to package. Specifically look at the TC4xx_COM/TC4xx_STD options.
- Question: What are the main difficulties in the development of high-end automotive MCUs compared to consumer ECUs, and why does it seem like the process is so far behind?
Answer: Based on functional safety design and automotive application oriented design robustness requirements considerations. It will be less aggressive than consumer grade
- Q: Does the FSP pin support the emergency stop function? What is the significance?
Answer: FSP and Emergency Stop can be triggered at the same time, both to report the fault to the external DEVICE and to turn the port output off.
- Question: In which vehicles are the TC3xx series microcontrollers already widely used?
Answer: BYD, Geely, Changan, etc., many new forces are useful
- Question: Doesn't TTCAN and CAN collision and arbitration both send data by preempting the bus? What is the difference based on event or time?
Answer: TTCAN depends on the specific standard definition, since it is timed and there is no arbitration
- Question: For airbag systems, how does the AURIX ™ TC3xx enable fast and accurate trigger decisions?
Answer: This is dependent on the system integrator's design. Once the sensor detects an abnormal acceleration, the actuator is triggered to activate the airbag to eject.
- Question: What is the significance of receiving a prioritized message when there is only one message per moment on the CAN bus?
Answer: We follow the definition of FIFO BUFFTER to understand the specific receipt of how to deal with, the customer according to the ID and content of their own arrangements
Due to space constraints, the full version of the Q &A can also be viewed in the attached Excel
Some questions are too complex to be answered simply, so it is recommended that you can click the green button "Ask a Question" in the upper right corner (if you can't see it, it is recommended that you narrow your browser to 80-90%)
A guide for newbies to ask questions can be found at: Required Reading | Beginner's Guide
3.0 The speakers for this broadcast are senior engineers (CAE) responsible for Infineon's microcontroller Aurix board.
The following is a selection of typical Aurix technical community questions and answers from engineers
@DI_Wang
How to calculate the sample rate for CAN communication?
TC38x CAN01 RX Works abnormally
TC397 CAN most send 30 frames per cycle
MCU: @Jeremy
SMU_Reset_Alarm_1_KIT_TC397_TFT ERROR
EVADC: @Kunqiao_L
Can we do Parallel conversion together for primary and secondary cluster?
smartconx_target@Q!w2e3r4t5y6u7i8o9p0||/t5/AURIX/AURIX-TC3xx-%E9%AB%98%E9%A2%91%E9%97%AE%E7%AD%94%E9%9B%86%E9%94%A6-%E9%99%8420240319%E7%9B%B4%E6%92%AD%E9%97%AE%E9%A2%98%E9%83%A8%E5%88%86%E5%9B%9E%E7%AD%94/td-p/723508
Show Less