AURIX™ Forum Discussions
text.format{('custom.tabs.no.results')}
The LED0 don not light and i use the device can not receive the message.
//////////////////////////////////////////////////////////
#include "Ifx_Types.h"
#include "IfxCpu.h"
#include "IfxScuWdt.h"
IFX_ALIGN(4) IfxCpu_syncEvent g_cpuSyncEvent = 0;
#include "Ifx_Types.h"
#include "IfxCan_Can.h"
#include "IfxCan.h"
#include "IfxCpu_Irq.h"
#include "IfxPort.h"
#include "Bsp.h"
#define LED0 &MODULE_P13,0
#define LED1 &MODULE_P13,1
#define LED2 &MODULE_P13,2
#define LED3 &MODULE_P13,3
#define MODULE_CAN0_RAM 0xF0200000
#define NODE0_RAM_OFFSET 0x0
//#define NODE1_RAM_OFFSET 0x1000
#define CAN_MESSAGE_TX_ID0 (uint32)0x1234567
#define CAN_MESSAGE_RX_ID1 (uint32)0x1234561
#define CAN_MESSAGE_RX_ID2 (uint32)0x1234562
#define CAN_MESSAGE_RX_ID3 (uint32)0x1234563
#define ISR_PRIORITY_CAN_TX 2 /* Define the CAN TX interrupt priority */
#define ISR_PRIORITY_CAN_RX 1 /* Define the CAN RX interrupt priority */
#define MAXIMUM_CAN_DATA_PAYLOAD 2 /* Define maximum classical CAN payload in 4-byte words */
IFX_CONST IfxCan_Can_Pins Can00_pins = {
&IfxCan_TXD00_P20_8_OUT, IfxPort_OutputMode_pushPull, // CAN00_TX
&IfxCan_RXD00B_P20_7_IN, IfxPort_InputMode_pullUp, // CAN00_RX
IfxPort_PadDriver_cmosAutomotiveSpeed4
};
typedef struct
{
IfxCan_Can_Config canConfig; /* CAN module configuration structure */
IfxCan_Can canModule; /* CAN module handle */
IfxCan_Can_Node can00Node; /* CAN source node handle data structure */
IfxCan_Can_NodeConfig canNodeConfig; /* CAN node configuration structure */
IfxCan_Filter canFilter; /* CAN filter configuration structure */
IfxCan_Message txMsg; /* Transmitted CAN message structure */
IfxCan_Message rxMsg; /* Received CAN message structure */
uint32 txData[MAXIMUM_CAN_DATA_PAYLOAD]; /* Transmitted CAN data array */
uint32 rxData[MAXIMUM_CAN_DATA_PAYLOAD]; /* Received CAN data array */
} McmcanType;
McmcanType g_mcmcan;
IFX_INTERRUPT(canIsrTxHandler, 0, ISR_PRIORITY_CAN_TX);
void canIsrTxHandler(void)
{
/* Clear the "Transmission Completed" interrupt flag */
IfxCan_Node_clearInterruptFlag(g_mcmcan.can00Node.node, IfxCan_Interrupt_transmissionCompleted);
IfxPort_togglePin(LED0); //transmit indicator
}
IFX_INTERRUPT(canIsrRxHandler, 0, ISR_PRIORITY_CAN_RX);
void canIsrRxHandler(void)
{
/* Clear the "Message stored to Dedicated RX Buffer" interrupt flag */
IfxCan_Node_clearInterruptFlag(g_mcmcan.can00Node.node, IfxCan_Interrupt_messageStoredToDedicatedRxBuffer);
/* Clear the "New Data" flag; as long as the "New Data" flag is set, the respective Rx buffer is
* locked against updates from received matching frames.
*/
IfxCan_Node_clearRxBufferNewDataFlag(g_mcmcan.can00Node.node, g_mcmcan.canFilter.rxBufferOffset);
/* Read the received CAN message */
IfxCan_Can_readMessage(&g_mcmcan.can00Node, &g_mcmcan.rxMsg, g_mcmcan.rxData);
/* Check if the received data matches with the transmitted one */
if((g_mcmcan.rxMsg.messageId == CAN_MESSAGE_RX_ID1)
&& (g_mcmcan.rxData[1] == 0xEFCDAB89))
{
if(g_mcmcan.rxData[0] == 0x67452301) { //send 0x
IfxPort_setPinState(LED1, IfxPort_State_low); //LED ON
} else {
IfxPort_setPinState(LED1, IfxPort_State_high); //LED OFF
}
}
if((g_mcmcan.rxMsg.messageId == CAN_MESSAGE_RX_ID2)
&& (g_mcmcan.rxData[1] == 0xEFCDAB89))
{
if(g_mcmcan.rxData[0] == 0x67452302) {
IfxPort_setPinState(LED2, IfxPort_State_low);
} else {
IfxPort_setPinState(LED2, IfxPort_State_high);
}
}
if((g_mcmcan.rxMsg.messageId == CAN_MESSAGE_RX_ID3)
&& (g_mcmcan.rxData[1] == 0xEFCDAB89))
{
if(g_mcmcan.rxData[0] == 0x67452303) {
IfxPort_setPinState(LED3, IfxPort_State_low);
} else {
IfxPort_setPinState(LED3, IfxPort_State_high);
}
}
}
void initCAN0(void)
{
/*******CAN module configuration and initialization*******/
IfxCan_Can_initModuleConfig(&g_mcmcan.canConfig, &MODULE_CAN0);
IfxCan_Can_initModule(&g_mcmcan.canModule, &g_mcmcan.canConfig);
/*******CAN00 node configuration and initialization*******/
IfxCan_Can_initNodeConfig(&g_mcmcan.canNodeConfig, &g_mcmcan.canModule);
g_mcmcan.canNodeConfig.nodeId = IfxCan_NodeId_0;
g_mcmcan.canNodeConfig.clockSource = IfxCan_ClockSource_both;
g_mcmcan.canNodeConfig.frame.type = IfxCan_FrameType_transmitAndReceive;
g_mcmcan.canNodeConfig.frame.mode = IfxCan_FrameMode_standard; //Classic CAN
g_mcmcan.canNodeConfig.txConfig.txMode = IfxCan_TxMode_dedicatedBuffers;
g_mcmcan.canNodeConfig.txConfig.dedicatedTxBuffersNumber = 255;
g_mcmcan.canNodeConfig.txConfig.txBufferDataFieldSize = IfxCan_DataFieldSize_8;
g_mcmcan.canNodeConfig.rxConfig.rxMode = IfxCan_RxMode_dedicatedBuffers;
g_mcmcan.canNodeConfig.rxConfig.rxBufferDataFieldSize = IfxCan_DataFieldSize_8;
g_mcmcan.canNodeConfig.filterConfig.extendedListSize = 255; //Extended Frame
g_mcmcan.canNodeConfig.filterConfig.messageIdLength = IfxCan_MessageIdLength_extended;
g_mcmcan.canNodeConfig.messageRAM.extendedFilterListStartAddress = 0x100; //Extended Frame
g_mcmcan.canNodeConfig.messageRAM.rxBuffersStartAddress = 0x200;
g_mcmcan.canNodeConfig.messageRAM.txBuffersStartAddress = 0x400;
g_mcmcan.canNodeConfig.messageRAM.baseAddress = MODULE_CAN0_RAM + NODE0_RAM_OFFSET;
g_mcmcan.canNodeConfig.baudRate.baudrate = 500000; //500KBaud
//transmit interrupt
g_mcmcan.canNodeConfig.interruptConfig.transmissionCompletedEnabled = TRUE;
g_mcmcan.canNodeConfig.interruptConfig.traco.priority = ISR_PRIORITY_CAN_TX;
g_mcmcan.canNodeConfig.interruptConfig.traco.interruptLine = IfxCan_InterruptLine_0;
g_mcmcan.canNodeConfig.interruptConfig.traco.typeOfService = IfxSrc_Tos_cpu0;
//receive interrupt
g_mcmcan.canNodeConfig.interruptConfig.messageStoredToDedicatedRxBufferEnabled = TRUE;
g_mcmcan.canNodeConfig.interruptConfig.reint.priority = ISR_PRIORITY_CAN_RX;
g_mcmcan.canNodeConfig.interruptConfig.reint.interruptLine = IfxCan_InterruptLine_1;
g_mcmcan.canNodeConfig.interruptConfig.reint.typeOfService = IfxSrc_Tos_cpu0;
//binding pin
g_mcmcan.canNodeConfig.pins = &Can00_pins;
IfxCan_Can_initNode(&g_mcmcan.can00Node, &g_mcmcan.canNodeConfig);
/*******CAN filter configuration and initialization*******/
g_mcmcan.canFilter.number = 0;
g_mcmcan.canFilter.elementConfiguration = IfxCan_FilterElementConfiguration_storeInRxBuffer;
g_mcmcan.canFilter.id1 = CAN_MESSAGE_RX_ID1;
g_mcmcan.canFilter.rxBufferOffset = IfxCan_RxBufferId_0;
//IfxCan_Can_setStandardFilter(&g_mcmcan.can00Node, &g_mcmcan.canFilter);
IfxCan_Can_setExtendedFilter(&g_mcmcan.can00Node, &g_mcmcan.canFilter);
g_mcmcan.canFilter.number = 1;
g_mcmcan.canFilter.elementConfiguration = IfxCan_FilterElementConfiguration_storeInRxBuffer;
g_mcmcan.canFilter.id1 = CAN_MESSAGE_RX_ID2;
//g_mcmcan.canFilter.id2 = CAN_MESSAGE_RX_ID2;
g_mcmcan.canFilter.rxBufferOffset = IfxCan_RxBufferId_0;
//IfxCan_Can_setStandardFilter(&g_mcmcan.can00Node, &g_mcmcan.canFilter);
IfxCan_Can_setExtendedFilter(&g_mcmcan.can00Node, &g_mcmcan.canFilter);
g_mcmcan.canFilter.number = 2;
g_mcmcan.canFilter.elementConfiguration = IfxCan_FilterElementConfiguration_storeInRxBuffer;
g_mcmcan.canFilter.id1 = CAN_MESSAGE_RX_ID3;
//g_mcmcan.canFilter.id2 = CAN_MESSAGE_RX_ID3;
g_mcmcan.canFilter.rxBufferOffset = IfxCan_RxBufferId_0;
//IfxCan_Can_setStandardFilter(&g_mcmcan.can00Node, &g_mcmcan.canFilter);
IfxCan_Can_setExtendedFilter(&g_mcmcan.can00Node, &g_mcmcan.canFilter);
}
void initLED(void)
{
IfxPort_setPinMode(LED0, IfxPort_Mode_outputPushPullGeneral); /* Initialize LED port pin */
IfxPort_setPinMode(LED1, IfxPort_Mode_outputPushPullGeneral);
IfxPort_setPinMode(LED2, IfxPort_Mode_outputPushPullGeneral);
IfxPort_setPinMode(LED3, IfxPort_Mode_outputPushPullGeneral);
IfxPort_setPinState(LED0, IfxPort_State_high); /* Turn off LED (LED is low-level active) */
IfxPort_setPinState(LED1, IfxPort_State_high);
IfxPort_setPinState(LED2, IfxPort_State_high);
IfxPort_setPinState(LED3, IfxPort_State_high);
}
void core0_main(void)
{
IfxCpu_enableInterrupts();
/* !!WATCHDOG0 AND SAFETY WATCHDOG ARE DISABLED HERE!!
* Enable the watchdogs and service them periodically if it is required
*/
IfxScuWdt_disableCpuWatchdog(IfxScuWdt_getCpuWatchdogPassword());
IfxScuWdt_disableSafetyWatchdog(IfxScuWdt_getSafetyWatchdogPassword());
/* Wait for CPU sync event */
IfxCpu_emitEvent(&g_cpuSyncEvent);
IfxCpu_waitEvent(&g_cpuSyncEvent, 1);
initLED();
initTime();
initCAN0();
IfxCan_Can_initMessage(&g_mcmcan.txMsg);
g_mcmcan.txMsg.messageId = CAN_MESSAGE_TX_ID0;
g_mcmcan.txMsg.bufferNumber = 0;
g_mcmcan.txMsg.dataLengthCode = IfxCan_DataLengthCode_8;//8 bytes
g_mcmcan.txMsg.frameMode = IfxCan_FrameMode_standard; //Classic CAN
g_mcmcan.txMsg.messageIdLength=IfxCan_MessageIdLength_extended; //Extended Frame
g_mcmcan.txData[0] = 0x98BADCFE;
g_mcmcan.txData[1] = 0x10325476;
//you will receive: FE DC BA 98 76 54 32 10
while(1)
{
while(IfxCan_Status_notSentBusy ==
IfxCan_Can_sendMessage(&g_mcmcan.can00Node, &g_mcmcan.txMsg, &g_mcmcan.txData[0]) );
waitTime(TimeConst_1s);
}
}
Show Less
In the safety manual of the PMIC TLF35584, there is the following assumption of use
Assumption: [SM_ROT_01]
In applications where the reset output (ROT) is connected to the reset input of the microprocessor, it is assumed
that the primary safety path is activated when the reset signal is asserted.
The microprocessor is in reset mode, what are you expecting from it. The FSP pin is pulled down externally. Aren't the secondary safety path SS1/SS2 activated when the PMIC asserts its output ROT due to over/under voltage detection.
Show LessHi,
We would like to know what is the exact meaning of the VAL field of EVRADCSTAT register. User's Manual says :
This bit indicates if the register is being updated with a new value. Values are updated every EVR cycle.
0B The register is not being updated
1B The register is being updated
When 0, does it mean the ADC measure is not reliable ?
When 1, does it mean the ADC measure is not stable / converging ?
Not clear for us to know when ADCSWDV and ADC13V measure can be safely taken into account.
The User Manual does not say how these measures are done (frequency / trigged by ?). Proably meaningless
Thank you in advance,
Eric Heurtel
Symbio
Show LessHello,
Tricore getting Reset, when gives the port33 control to SCR from Tricore.
Code flow.
1.check the LCK status of Port33.PCSR( this bit value is 0)
2.updating the P33.PCSR register.// getting Reset.
Can you please check and provide feedback.
Show LessHi,
I am using High-Tec Ide for compiling code for TC39X controller, in that Hardware interrupts is not working,
how to map hardware interrupts in linker file
Show Less目前有一塊TC399 Triboard 燒壞重工,除了更換PMIC、MCU可透過memory tool連上並update FW,且使用的FW是從全新的Triboard拷貝下來的FW,有將其放置於其他Triboard上進行驗證過,是可以運行的,但目前重工的板子無法正常運行,有調過boot mode,但都無法正常執行,於是用DAS看了下,發現如下現象,請問為何把原來的FW update 到會遇到 需要Key 去unlock ?
Show Less
We need 300MHz internal clock for AURIX TC364, for that we are using 20MHz external clock with reference to eval board. How to justify whether this 20MHz external clock is sufficient or not?
How to solve the equation -
Show Less
Hello. Aurix Team.
I'm debugging by AurixDevelopmentStudio(ADS) tool and i can't use suspend function.
when i try to suspend program running with suspend button, it is automatically resumed, so i can't debugging.
and breaking point function doesn't works too.
i think i don't touch any ADS program option.
can you help me?
Show Less