AURIX™ Forum Discussions
@Kavya_B sorry to be a pain ...
but
ok so my next grief is filtering ........ only filter 0 works .. see filter code below and the rx interrupt (i've separated the ID's just incase my 'or'ing ' wasn't correct ).
am i missing something fundamental or is the actual data not being copied across .. ??
/* filter for node **/
g_mcmcan.canNodeConfig.filterConfig.messageIdLength = IfxCan_MessageIdLength_standard; // IfxCan_MessageIdLength_standard;
g_mcmcan.canNodeConfig.filterConfig.standardListSize = NUMBER_OF_STND_ID_FILTERS ; // see below
g_mcmcan.canNodeConfig.filterConfig.extendedListSize = 0 ;
g_mcmcan.canNodeConfig.filterConfig.standardFilterForNonMatchingFrames = IfxCan_NonMatchingFrame_reject;
g_mcmcan.canNodeConfig.filterConfig.extendedFilterForNonMatchingFrames = IfxCan_NonMatchingFrame_reject;
g_mcmcan.canNodeConfig.filterConfig.rejectRemoteFramesWithStandardId = TRUE;
g_mcmcan.canNodeConfig.filterConfig.rejectRemoteFramesWithExtendedId = TRUE;
g_mcmcan.canFilter.number = 0;
g_mcmcan.canFilter.elementConfiguration = IfxCan_FilterElementConfiguration_storeInRxBuffer;
g_mcmcan.canFilter.type = IfxCan_FilterType_none ; // IfxCan_FilterType_range; // // this no worky ..
g_mcmcan.canFilter.id1 = (uint32)0x777 ;
g_mcmcan.canFilter.id2 = (uint32)0x0 ;
g_mcmcan.canFilter.rxBufferOffset = IfxCan_RxBufferId_0;
IfxCan_Can_setStandardFilter(&g_mcmcan.canSrcNode, &g_mcmcan.canFilter);
g_mcmcan.canFilter.number = 1;
g_mcmcan.canFilter.elementConfiguration = IfxCan_FilterElementConfiguration_storeInRxBuffer;
g_mcmcan.canFilter.type = IfxCan_FilterType_none ;
g_mcmcan.canFilter.id1 = (uint32)0x666 ; // (uint32)0x666 ;
g_mcmcan.canFilter.id2 = (uint32)0x0 ;
g_mcmcan.canFilter.rxBufferOffset = IfxCan_RxBufferId_1;
IfxCan_Can_setStandardFilter(&g_mcmcan.canSrcNode, &g_mcmcan.canFilter);
and the rx interrupt ..
void canIsrRxHandler(void)
{
/* Clear the "Message stored to Dedicated RX Buffer" interrupt flag */
//IfxCan_Node_clearInterruptFlag(g_mcmcan.canDstNode.node, IfxCan_Interrupt_messageStoredToDedicatedRxBuffer);
IfxCan_Node_clearInterruptFlag(g_mcmcan.canSrcNode.node, IfxCan_Interrupt_messageStoredToDedicatedRxBuffer);
// IfxCan_Node_clearInterruptFlag(g_mcmcan.can00Node.node, IfxCan_Interrupt_messageStoredToDedicatedRxBuffer);
/* Read the received CAN message */
IfxCan_Can_readMessage(&g_mcmcan.canSrcNode, &g_mcmcan.rxMsg, g_mcmcan.rxData);
//IfxCan_Can_readMessage(&g_mcmcan.canDstNode, &g_mcmcan.rxMsg, g_mcmcan.rxData);
//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 == 0x666 ) || (g_mcmcan.rxMsg.messageId == 0x777 ) )
if ( g_mcmcan.rxMsg.messageId == 0x666 )
{
/* Turn on the LED2 to indicate correctness of the received message */
//IfxPort_setPinLow(g_led2.port, g_led2.pinIndex);
IfxPort_togglePin(g_led2.port, g_led2.pinIndex);
}
if ( g_mcmcan.rxMsg.messageId == 0x777 )
{
IfxPort_togglePin(g_led2.port, g_led2.pinIndex);
}
}
i have also tried ..
g_mcmcan.canFilter.number = 0;
g_mcmcan.canFilter.elementConfiguration = IfxCan_FilterElementConfiguration_storeInRxBuffer;
g_mcmcan.canFilter.type = IfxCan_FilterType_range ; // this no worky ..
g_mcmcan.canFilter.id1 = (uint32)0x650 ;
g_mcmcan.canFilter.id2 = (uint32)0x780 ;
g_mcmcan.canFilter.rxBufferOffset = IfxCan_RxBufferId_0;
IfxCan_Can_setStandardFilter(&g_mcmcan.canSrcNode, &g_mcmcan.canFilter);
which doesnt work ..
#confuseed.com. ( i must be missing a setting or a command )
Show Less
你好,
我在创建TC37x Tricore工程和TC37x MCS工程时,Refrences Project是MCS工程,编译出现以下错误:
ltc F014: core mpe:mcs00 specified on commandline not found in LSL file
amk E452: ["makefile" 113/0] target 'TC37x_GTM_MCS_Tricore.elf' returned exit code 1
amk E451: make stopped
请问我应该如何处理,最好是图片展示配置,谢谢
Show LessHi,
I have question related to SSH memory initialization.
The question is: How to check whether the memory of SSH instance is initialized or not initialized in startup software in tc377?
Thanks.
Show LessCAN Transmission is Not working in TC233, I used the code from iLLD example source for CAN Initialization.
I used P14_0 & P14_1 for CAN Tx and Rx pins in TC233
I have share 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_TXD0_P20_8_OUT;
// g_multican.canNodeConfig.rxPin = &IfxMultican_RXD0B_P20_7_IN;
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;
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();
//
// g_multican.canMsgObjConfig.msgObjId = DST_MESSAGE_OBJECT_ID+2;
// g_multican.canMsgObjConfig.messageId = CAN_MESSAGE_ID+2;
//
// IfxMultican_Can_MsgObj_init(&g_multican.canDstMsgObj, &g_multican.canMsgObjConfig);
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 = (IfxMultican_MsgObjId)TX_INTERRUPT_SRC_ID;
g_multican.canMsgObjConfig.messageId = CAN_MESSAGE_ID;
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 transmitCanMessage(void){
const uint32 dataLow = 0xDEADBEEF;
const uint32 dataHigh = 0xBA5EBA11;
/* 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);
/* NOTE
* Need to specify the correct MsgObjID before sending CAN_Message
* -> the RX-ISR function only responds to the MsgID belonging to that MsgObjID
*/
// g_multican.canDstMsgObj.msgObjId = DST_MESSAGE_OBJECT_ID;
/* Initialization of the TX message */
IfxMultican_Message_init(&g_multican.txMsg,
CAN_TX_MCU_BAT_MODE,
dataLow,
dataHigh,
g_multican.canMsgObjConfig.control.messageLen);
/* Send the CAN message with the previously defined TX message content */
IfxMultican_Can_MsgObj_sendMessage(&g_multican.canSrcMsgObj, &g_multican.txMsg);
// while( IfxMultican_Status_notSentBusy ==
// 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);
}
/**********************************************************************************************************************
* \file SPI_DMA.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 "SPI_DMA.h"
#include "IfxPort.h"
#include "ifxQspi_SpiSlave.h"
#include "ifxPort_regdef.h"
#include "stdio.h"
/*********************************************************************************************************************/
/*------------------------------------------------------Macros-------------------------------------------------------*/
/*********************************************************************************************************************/
#define QSPI2_MASTER &MODULE_QSPI2 /* SPI Master Hardware module */
#define QSPI3_SLAVE &MODULE_QSPI3 /* SPI Slave Hardware module */
#define LED_D110 &MODULE_P13,3 /* LED D110 Port, Pin definition */
#define ISR_PRIORITY_QSPI2_TX 1 /* Define the QSPI2 transmit interrupt priority */
#define ISR_PRIORITY_QSPI2_RX 2 /* Define the QSPI2 receive interrupt priority */
#define ISR_PRIORITY_QSPI2_ER 10 /* Define the QSPI2 error interrupt priority */
#define ISR_PRIORITY_QSPI3_TX 3 /* Define the QSPI3 transmit interrupt priority */
#define ISR_PRIORITY_QSPI3_RX 4 /* Define the QSPI3 receive interrupt priority */
#define ISR_PRIORITY_QSPI3_ER 11 /* Define the QSPI3 error interrupt priority */
#define ISR_PRIORITY_DMA_CH1 50 /* Define the DMA channel1 interrupt priority */
#define ISR_PRIORITY_DMA_CH2 51 /* Define the DMA channel2 interrupt priority */
#define ISR_PRIORITY_DMA_CH3 52 /* Define the DMA channel3 interrupt priority */
#define ISR_PRIORITY_DMA_CH4 53 /* Define the DMA channel4 interrupt priority */
#define ISR_PROVIDER_QSPI2 IfxSrc_Tos_cpu0 /* Define the QSPI2 interrupt provider */
#define ISR_PROVIDER_QSPI3 IfxSrc_Tos_cpu0 /* Define the QSPI3 interrupt provider */
#define ISR_PROVIDER_DMA_CH1 IfxSrc_Tos_cpu0 /* Define the DMA Channel1 interrupt provider */
#define ISR_PROVIDER_DMA_CH2 IfxSrc_Tos_cpu0 /* Define the DMA Channel2 interrupt provider */
#define ISR_PROVIDER_DMA_CH3 IfxSrc_Tos_cpu0 /* Define the DMA Channel3 interrupt provider */
#define ISR_PROVIDER_DMA_CH4 IfxSrc_Tos_cpu0 /* Define the DMA Channel4 interrupt provider */
#define MASTER_CHANNEL_BAUDRATE 1000000 /* Master channel baud rate */
/*********************************************************************************************************************/
/*-------------------------------------------------Global variables--------------------------------------------------*/
/*********************************************************************************************************************/
qspiDma g_qspiDma; /* Global handle for QSPI communication */
/*********************************************************************************************************************/
/*------------------------------------------------Function Prototypes------------------------------------------------*/
/*********************************************************************************************************************/
static void initQSPI2Master(void);
static void initQSPI2MasterChannel(void);
static void initQSPI2MasterBuffers(void);
static void initQSPI3Slave(void);
static void initQSPI3SlaveBuffers(void);
static void initQSPI(void);
static void initLED(void);
/*********************************************************************************************************************/
/*---------------------------------------------Function Implementations----------------------------------------------*/
/*********************************************************************************************************************/
IFX_INTERRUPT(QSPI2ErrorISR, 0, ISR_PRIORITY_QSPI2_ER); /* SPI Master Error Interrupt definition */
IFX_INTERRUPT(QSPI3ErrorISR, 0, ISR_PRIORITY_QSPI3_ER); /* SPI Slave Error Interrupt definition */
IFX_INTERRUPT(DMAChn1ISR, 0, ISR_PRIORITY_DMA_CH1); /* DMA Channel 1 Interrupt definition */
IFX_INTERRUPT(DMAChn2ISR, 0, ISR_PRIORITY_DMA_CH2); /* DMA Channel 2 Interrupt definition */
IFX_INTERRUPT(DMAChn3ISR, 0, ISR_PRIORITY_DMA_CH3); /* DMA Channel 3 Interrupt definition */
IFX_INTERRUPT(DMAChn4ISR, 0, ISR_PRIORITY_DMA_CH4); /* DMA Channel 4 Interrupt definition */
/* Handle QSPI2 Error interrupt */
void QSPI2ErrorISR(void)
{
IfxCpu_enableInterrupts();
IfxQspi_SpiMaster_isrError(&g_qspiDma.spiMaster);
}
/* Handle QSPI3 Error interrupt */
void QSPI3ErrorISR(void)
{
IfxCpu_enableInterrupts();
IfxQspi_SpiSlave_isrError(&g_qspiDma.spiSlave);
}
/* Handle DMA Channel 1 interrupt */
void DMAChn1ISR(void)
{
IfxCpu_enableInterrupts();
IfxQspi_SpiMaster_isrDmaTransmit(&g_qspiDma.spiMaster);
}
/* Handle DMA Channel 2 interrupt */
void DMAChn2ISR(void)
{
IfxCpu_enableInterrupts();
IfxQspi_SpiMaster_isrDmaReceive(&g_qspiDma.spiMaster);
}
/* Handle DMA Channel 3 interrupt */
void DMAChn3ISR(void)
{
IfxCpu_enableInterrupts();
IfxQspi_SpiSlave_isrDmaTransmit(&g_qspiDma.spiSlave);
}
/* Handle DMA Channel 4 interrupt */
void DMAChn4ISR(void)
{
IfxCpu_enableInterrupts();
IfxQspi_SpiSlave_isrDmaReceive(&g_qspiDma.spiSlave);
}
/* This function initializes QSPI2 in master mode */
static void initQSPI2Master(void)
{
IfxQspi_SpiMaster_Config spiMasterConfig; /* Define the Master Configuration */
IfxQspi_SpiMaster_initModuleConfig(&spiMasterConfig, QSPI2_MASTER); /* Initialize it with default values */
const IfxQspi_SpiMaster_Pins qspi2Masterpins = {
&IfxQspi2_SCLK_P15_3_OUT, IfxPort_OutputMode_pushPull, /* SCLK Pin (CLK) */
&IfxQspi2_MTSR_P15_5_OUT, IfxPort_OutputMode_pushPull, /* Master Transmit Slave Receive Pin (MOSI) */
&IfxQspi2_MRSTA_P15_4_IN, IfxPort_InputMode_pullDown, /* Master Receive Slave Transmit Pin (MISO) */
IfxPort_PadDriver_cmosAutomotiveSpeed3 /* Pad driver mode */
};
spiMasterConfig.pins = &qspi2Masterpins; /* Assign Master Pins */
spiMasterConfig.dma.useDma = TRUE;
spiMasterConfig.dma.txDmaChannelId = IfxDma_ChannelId_1;
spiMasterConfig.dma.rxDmaChannelId = IfxDma_ChannelId_2;
spiMasterConfig.base.txPriority = ISR_PRIORITY_DMA_CH1;
spiMasterConfig.base.rxPriority = ISR_PRIORITY_DMA_CH2;
spiMasterConfig.base.erPriority = ISR_PRIORITY_QSPI2_ER;
spiMasterConfig.base.isrProvider = ISR_PROVIDER_QSPI2;
/* Initialize the QSPI Master module using the user configuration */
IfxQspi_SpiMaster_initModule(&g_qspiDma.spiMaster, &spiMasterConfig);
}
/* This function initializes QSPI2 channel. */
static void initQSPI2MasterChannel(void)
{
IfxQspi_SpiMaster_ChannelConfig spiMasterChannelConfig; /* Define the Master Channel Configuration */
IfxQspi_SpiMaster_initChannelConfig(&spiMasterChannelConfig, &g_qspiDma.spiMaster); /* Initialize it with default values */
spiMasterChannelConfig.base.baudrate = MASTER_CHANNEL_BAUDRATE; /* Set SCLK frequency to 1 MHz */
const IfxQspi_SpiMaster_Output qspi2SlaveSelectQspi3 = {
&IfxQspi2_SLSO0_P15_2_OUT, IfxPort_OutputMode_pushPull, /* Slave Select Pin (CS) */
IfxPort_PadDriver_cmosAutomotiveSpeed1 /* Pad driver mode */
};
spiMasterChannelConfig.sls.output = qspi2SlaveSelectQspi3;
/* Initialize the QSPI Master channel using the user configuration */
IfxQspi_SpiMaster_initChannel(&g_qspiDma.spiMasterChannel, &spiMasterChannelConfig);
}
/* This function initializes Master SW buffers */
static void initQSPI2MasterBuffers(void)
{
for (uint32 i = 0; i < SPI_BUFFER_SIZE; i++)
{
/* Fill the SPI Master TX Buffer */
g_qspiDma.qspiBuffer.spiMasterTxBuffer[i] = (uint8)(i + 1);
/* Clear the SPI Master RX Buffer */
g_qspiDma.qspiBuffer.spiMasterRxBuffer[i] = 0;
}
}
/* This function initializes QSPI3 in Slave mode */
static void initQSPI3Slave(void)
{
IfxQspi_SpiSlave_Config spiSlaveConfig; /* Define the Slave Configuration */
IfxQspi_SpiSlave_initModuleConfig(&spiSlaveConfig, QSPI3_SLAVE); /* Initialize it with default values */
/* Enable DMA mode*/
spiSlaveConfig.dma.useDma = TRUE;
/* Set SPI slave DMA channels */
spiSlaveConfig.dma.txDmaChannelId = IfxDma_ChannelId_3;
spiSlaveConfig.dma.rxDmaChannelId = IfxDma_ChannelId_4;
/* Configure SPI slave interrupts */
spiSlaveConfig.base.txPriority = ISR_PRIORITY_DMA_CH3;
spiSlaveConfig.base.rxPriority = ISR_PRIORITY_DMA_CH4;
spiSlaveConfig.base.erPriority = ISR_PRIORITY_QSPI2_ER;
spiSlaveConfig.base.isrProvider = ISR_PROVIDER_QSPI2;
const IfxQspi_SpiSlave_Pins qspi3Slavepins = {
&IfxQspi3_SCLKA_P02_7_IN, IfxPort_InputMode_pullDown, /* SCLK Pin (CLK) */
&IfxQspi3_MTSRA_P02_6_IN, IfxPort_InputMode_pullDown, /* Master Transmit Slave Receive Pin (MOSI) */
&IfxQspi3_MRST_P02_5_OUT, IfxPort_OutputMode_pushPull, /* Master Receive Slave Transmit Pin (MISO) */
&IfxQspi3_SLSIA_P02_4_IN, IfxPort_InputMode_pullDown, /* Slave Select Pin (CS) */
IfxPort_PadDriver_cmosAutomotiveSpeed3 /* Pad driver mode */
};
/* Assign Slave Pins */
spiSlaveConfig.pins = &qspi3Slavepins;
/* Initialize QSPI Slave module */
IfxQspi_SpiSlave_initModule(&g_qspiDma.spiSlave, &spiSlaveConfig);
}
/* Initialize Slave SW buffers */
static void initQSPI3SlaveBuffers(void)
{
for (uint32 i = 0; i < SPI_BUFFER_SIZE; i++)
{
/* Fill the SPI Slave TX Buffer */
g_qspiDma.qspiBuffer.spiSlaveTxBuffer[i] = (uint8)(i + 0x64);
/* Clear the SPI Slave RX Buffer */
g_qspiDma.qspiBuffer.spiSlaveRxBuffer[i] = 0;
}
}
/* This function initializes the LED */
static void initLED(void)
{
/* Set the port pin 13.3 (to which the LED D110 is connected) to output push-pull mode */
IfxPort_setPinModeOutput(LED_D110, IfxPort_OutputMode_pushPull, IfxPort_OutputIdx_general);
/* Turn off the LED (LED is low-level active) */
IfxPort_setPinHigh(LED_D110);
}
/* This function initializes the QSPI modules */
static void initQSPI(void)
{
/* Firstly initialize the Slave */
initQSPI3Slave();
initQSPI3SlaveBuffers();
/* Secondly initialize the Master */
initQSPI2Master();
initQSPI2MasterChannel();
initQSPI2MasterBuffers();
}
/* This function initializes the SPI and the LED called from Cpu0_Main */
void initPeripherals(void)
{
initLED();
initQSPI();
}
/* This function ensures the QSPI communication between Master and Slave and checks whether
* the data transfer was correct or not
*/
void transferData(void)
{
uint32 i;
uint32 error = 0;
/* Enable SPI Slave for communication */
IfxQspi_SpiSlave_exchange(&g_qspiDma.spiSlave, &g_qspiDma.qspiBuffer.spiSlaveTxBuffer[0],
&g_qspiDma.qspiBuffer.spiSlaveRxBuffer[0], SPI_BUFFER_SIZE);
/* Start SPI Master communication */
IfxQspi_SpiMaster_exchange(&g_qspiDma.spiMasterChannel, &g_qspiDma.qspiBuffer.spiMasterTxBuffer[0],
&g_qspiDma.qspiBuffer.spiMasterRxBuffer[0], SPI_BUFFER_SIZE);
/* Wait until the slave received all data */
while (IfxQspi_SpiSlave_getStatus(&g_qspiDma.spiSlave) == SpiIf_Status_ok)
{
}
/* Compare exchanged data */
for(i = 0; i < SPI_BUFFER_SIZE; i++)
{
if(g_qspiDma.qspiBuffer.spiSlaveRxBuffer[i] != g_qspiDma.qspiBuffer.spiMasterTxBuffer[i])
{
error++;
}
if(g_qspiDma.qspiBuffer.spiMasterRxBuffer[i] != g_qspiDma.qspiBuffer.spiSlaveTxBuffer[i])
{
error++;
}
}
/* Switch on the LED D110 in case of no errors (LED is low-level active) */
if(error == 0)
{
IfxPort_setPinLow(LED_D110);
}
}
#define Master_SPI_CS &MODULE_P15, 2
uint32 SPI_FLASH_ReadID(void)
{
uint16 id;
g_qspiDma.qspiBuffer.spiMasterTxBuffer[0] = (uint32)(0x90);
g_qspiDma.qspiBuffer.spiMasterTxBuffer[1] = (uint32)(0x00);
g_qspiDma.qspiBuffer.spiMasterTxBuffer[2] = (uint32)(0x00);
g_qspiDma.qspiBuffer.spiMasterTxBuffer[3] = (uint32)(0x00);
g_qspiDma.qspiBuffer.spiMasterTxBuffer[4] = (uint32)(0xFF);
g_qspiDma.qspiBuffer.spiMasterTxBuffer[5] = (uint32)(0xFF);
uint8 MID;
uint16 DID;
IfxPort_setPinLow(Master_SPI_CS);
IfxQspi_SpiMaster_exchange(&g_qspiDma.spiMasterChannel, &g_qspiDma.qspiBuffer.spiMasterTxBuffer,
&g_qspiDma.qspiBuffer.spiMasterRxBuffer, 6);
while (IfxQspi_SpiMaster_getStatus(&g_qspiDma.spiMaster) == SpiIf_Status_busy)
{
}
IfxPort_setPinHigh(Master_SPI_CS);
DID=(uint32)g_qspiDma.qspiBuffer.spiMasterRxBuffer[0];
return DID;
printf("%x",DID);
}
How many extended CAN filters can be added in the TC332? I'm using IfxCan_Can_setExtendedFilter(&can00Node, &canFilter) for filter configuration.
Show Less
Even in the AURIX3G, is it possble to use Linux OS?
If there is the information of MMU form AURIX, please share the chapter of manual.
https://www.embedded.com/ces-2022-infineon-has-new-aurix-28nm-mcu-and-airoc-ble-soc/
Show LessHI,
I'm trying to use Allegro 33115 angle sensor
and I'm using AURIX TC367
current problem is
whatever MOSI signal I sent, Recieving MISO Signal is always weird
refered to datasheet, I setted SPI Mode 3, with 32bit datawidth
here's my SPI signal
I will be very grateful if any of you can help me
thank you
Show Less
Hello everyone!
I'm trying to implement a solution to flash a .hex file in the TC397 microcontroller over CAN communication.
The MCU is receiving chunks of information and should flash it as it receives. I'm following the Flash example but I'm not sure to which location of the PFLASH I should write into. If I try to flash on 0xA0000000, the code just stops (I'm assuming that's because I'm running it from there) and from 0x80000000 nothing happens. At the moment I'm still not using A/B swap.
Is there any example or something similar to the process?
Thank you.
Hi,
I want to send data in between two infineon 387 boards. Is it possible to provide sample code?