AURIX™ Forum Discussions
text.format{('custom.tabs.no.results')}
HIGHTEC 4.9.3 free version, using iLLD_1_0_1_17_0 to create the project, compiling prompted that the function _init() could not be found. Where is this function located? BSW/BaseSw/Infra/Ssw/TC38A/Tricore/Ifx_Ssw_Infra.c:207: error: undefined reference to `_init'
Attached are the works created.
smartconx_target@Q!w2e3r4t5y6u7i8o9p0||/t5/AURIX/iLLD-1-0-1-17-0-TC3xx-%E4%BD%BF%E7%94%A8%E9%97%AE%E9%A2%98/td-p/740700
Show LessHi,
I can write 8 bytes of data in DFLASH memory using page address. I need to write a single byte of data at any memory address.
Is it possible to write a single byte of data at any memory address location?
Thanks
Show LessI'm trying to get up to speed with the ShieldBuddy board (TC275) using AURIX Development studio v 1.9.20 and I'm getting an error when I try to debug the default 'Hello World' application.
When I start the debugger I get this error dialog:
Error creating session
The debug instrument IO could not be initialized.
The GDI debug instrument provided the following error message.
Could not open Access HW
The complete console output is below.
Do I need debug hardware dongle? I expected that it would use the USB that is connected between the board and the PC. The "getting started" document describes the Arduino IDE and not the AURIX Development Studio. Any help would be appreciated.
Thanks,
Greg
Using Debug Target Configuration:
Target: Generic Infineon AURIX Board
Selected CPU type: tc27xd
Register file: C:/Infineon/AURIX-Studio-1.9.20/plugins/com.tasking.ctc.debug.win32.x86_64_1.12.14.0/ctc/include/sfr/regtc27xd.xml
Communication: Universal Debug Access Server
Debug Instrument Module: gdi2mcdtc
Using Flash Configuration:
Monitor : C:\Infineon\AURIX-Studio-1.9.20\plugins\com.tasking.ctc.debug.win32.x86_64_1.12.14.0\ctc\etc\ftc27x.sre
Workspace address : 0x70000000
Number of devices : 5
Sector buffer size : 8192
Device 0:
Address : 0xA0000000,0x80000000
Vendor : Infineon
Chip : TC2_4560k
Subname : Program Flash 0
Width : 32
Size : 2097152
Number of chips : 1
Unused address lines : 0
Device 1:
Address : 0xA0200000,0x80200000
Vendor : Infineon
Chip : TC2_4560k
Subname : Program Flash 1
Width : 32
Size : 2097152
Number of chips : 1
Unused address lines : 0
Device 2:
Address : 0xAF000000
Vendor : Infineon
Chip : TC2_4560k
Subname : Data Flash Bank 0a
Width : 32
Size : 393216
Number of chips : 1
Unused address lines : 0
Device 3:
Address : 0xAF100000
Vendor : Infineon
Chip : TC2_4560k
Subname : Data Flash Bank 0b
Width : 32
Size : 16384
Number of chips : 1
Unused address lines : 0
Device 4:
Address : 0xAF110000
Vendor : Infineon
Chip : TC2_4560k
Subname : Data Flash Bank 1
Width : 32
Size : 65536
Number of chips : 1
Unused address lines : 0
Configuration: TC27xD
Starting Debugger...
The debug instrument IO could not be initialized.
The GDI debug instrument provided the following error message.
Could not open Access HW
1. We are aware about UCB DBG to lock debug interface using 256 bit Password and unlock it.
2. We would like to know if Aurix TC32LP has the mechanism to lock JTAG permanentely ? Here we may not need to unlock it once locked. May be some kind of bit in registers which triggers permanent locking of JTAG debug interface.
Currently, we are checking out if there is any possibility to permanently lock JTAG.
From user manual, I did understand that to do a JTAG lock with PSW protection we need to update PROCONDBG register, then, after reset, the new values will be applied from UCB_DBG_ORIGIN and UCB_DBG_COPY and JTAG will not be accessible anymore.
This registers, UCB_DBG_ORIGIN and UCB_DBG_COPY, are located at addresses 0xAF402400 and 0xAF403400 for TC32LP.
In PROCONDBG register we are disabling access to JTAG by setting DBGIFLCK to 1. By doing so JTAG will be disabled at next reset.
Currently, we are using UDS services to provide a password and to lock/unlock JTAG access. So, in this way if we accidentally lock it we’ll be able to unlock it.
What we’d like to know if it is possible to lock JTAG interface permanently without any way of unlocking it no matter what way. Is there this kind of possibility to do so?
Show LessBefore installing HighTech, I could connect to the development board normally using Memtool+MiniWigger debugger, but after installing Hightech, I found that the debugger could not be connected, and the device could not be recognized normally in "Device Manager >Universal Serial Bus Controller ".
smartconx_target@Q!w2e3r4t5y6u7i8o9p0||/t5/AURIX/%E5%AE%89%E8%A3%85HighTech%E8%BD%AF%E4%BB%B6%E5%90%8E-%E5%AF%BC%E8%87%B4%E8%AF%86%E5%88%AB%E4%B8%8D%E5%88%B0MiniWigger%E8%B0%83%E8%AF%95%E5%99%A8/td-p/740200
Show Less/**********************************************************************************************************************
* \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 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 the 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
* and transmit the Software, and to prepare derivative works of the Software, and to permit third-parties to whom the Software belongs.
* 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
* :: compact, tort or otherwise, arisings 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 ( static void initQSPI2Master ( );
static void initQSPI2MasterChannel ( void ).
static void initQSPI2MasterBuffers ( void );
static void initQSPI3Slave ( static void initQSPI3Slave ( );
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 */
IfxQspi_SpiMaster_Pins IfxQspi_SpiMaster_Pins qspi2Masterpins = {
&IfxQspi2_SCLK_P15_3_OUT, IfxPort_OutputMode_pushPull, IfxPort_OutputMode_pushPull IfxPort_OutputMode_pushPull IfxQspi2_SCLK_P15_3_OUT /* SCLK Pin (CLK) */
&IfxQspi2_MTSR_P15_5_OUT, IfxPort_OutputMode_pushPull IfxQspi2_MTSR_P15_5_OUT /* Master Transmit Slave Receive Pin (MOSI) */
&IfxQspi2_MRSTA_P15_4_IN, IfxPort_InputMode_pullDown, IfxPort_InputMode_pullDown IfxPort_InputMode_pullDown IfxQspi2_MRSTA_P15_4_IN /* 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 IfxDma_ChannelId_1
spiMasterConfig. dma . rxDmaChannelId = IfxDma_ChannelId_2 IfxDma_ChannelId_2
spiMasterConfig. base . txPriority = ISR_PRIORITY_DMA_CH1.
spiMasterConfig. base . rxPriority = ISR_PRIORITY_DMA_CH2.
spiMasterConfig. base . spiMasterConfig. base . = 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 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 */. /* Set SCLK frequency to 1 MHz */
IfxQspi_SpiMaster_Output IfxQspi_SpiMaster_Output qspi2SlaveSelectQspi3 = {
&IfxQspi2_SLSO0_P15_2_OUT, IfxPort_OutputMode_pushPull 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 IfxDma_ChannelId_3
spiSlaveConfig. dma . rxDmaChannelId = IfxDma_ChannelId_4 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.
IfxQspi_SpiSlave_Pins IfxQspi_SpiSlave_Pins qspi3Slavepins = {
&IfxQspi3_SCLKA_P02_7_IN, IfxPort_InputMode_pullDown, IfxPort_InputMode_pullDown IfxPort_InputMode_pullDown IfxQspi3_SCLKA_P02_7_IN /* SCLK Pin (CLK) */
&IfxQspi3_MTSRA_P02_6_IN, IfxPort_InputMode_pullDown, IfxPort_InputMode_pullDown IfxPort_InputMode_pullDown IfxQspi3_MTSRA_P02_6_IN /* Master Transmit Slave Receive Pin (MOSI) */
&IfxQspi3_MRST_P02_5_OUT, IfxPort_OutputMode_pushPull, IfxPort_OutputMode_pushPull IfxPort_OutputMode_pushPull IfxPort_OutputMode_pushPull /* Master Receive Slave Transmit Pin (MISO) */
&IfxQspi3_SLSIA_P02_4_IN, IfxPort_InputMode_pullDown, IfxPort_InputMode_pullDown IfxPort_InputMode_pullDown IfxQspi3_SLSIA_P02_4_IN /* 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_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(); initQSPI3Slave().
initQSPI3SlaveBuffers(); initQSPI3SlaveBuffers().
/* Secondly initialize the Master */
initQSPI2Master(); initQSPI2Master(); initQSPI2Master().
initQSPI2MasterChannel(); initQSPI2MasterChannel().
initQSPI2MasterBuffers(); 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
SPI_FLASH_ReadID SPI_FLASH_ReadID ( uint32 SPI_FLASH_ReadID )
{
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 , 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);
}
smartconx_target@Q!w2e3r4t5y6u7i8o9p0||/t5/AURIX/TC397%E4%BD%BF%E7%94%A8spi%E8%AF%BB%E5%8F%96w25q%E7%9A%84id-%E4%BD%86%E6%9C%80%E7%BB%88%E7%9A%84rxbuff%E9%83%BD%E6%98%AF0-%E4%BD%BF%E7%94%A8%E7%9A%84%E6%97%B6397%E6%9C%80%E5%BC%80%E5%A7%8B%E7%9A%84demo-%E5%B0%B1%E5%A2%9E%E5%8A%A0%E4%BA%86%E4%B8%80%E4%B8%AA%E8%AF%BB%E5%8F%96%E5%87%BD%E6%95%B0-%E6%B2%A1%E4%BD%BF%E7%94%A8tansfer-%E7%A8%8B%E5%BA%8F%E5%A6%82%E5%A6%82%E4%B8%8B/td-p/721562
Show LessI configure the SPU to do 256-point range FFT with input data from RIF, and then compare FFT result between SPU and other FFT library (Python numpy.fft).
For some input data as in picture below, upper plot is time domain signal of small noise fluctuation, ADC value varies from 1750 to 2000. The lower plot is FFT result from SPU and numpy.fft, and they aligns with each other so well that we can only see one green line. (except for one point at bin 0).
This shows the whole setup and SPU configuration is somewhat correct.
However, for input data with larger fluctuation as in following picture (noise + 100kHz sine wave with ADC value varies from 1920 to 2120), the FFT difference between SPU (red line) and numpy.fft (green line) is huge. SPU result shows much higher noise floor.
Moreover, if I further increase the input amplitude as in following picture (ADC value varies from 1400 to 2600), surprisingly SPU results' noise floor reduced, but 100kHz frequency's amplitude also reduced, and some artifact frequency component showed up.
Here is my SPU configuration:
/* INPUT SOURCE */
cfg->input.dataSource = IfxSpu_DataSource_rif0;
cfg->input.rif.numAntennae = IfxSpu_Num_Antennae_2;
cfg->input.rif.dataFormat = IfxSpu_InputDataFormat_real;
cfg->input.rif.dataType = IfxSpu_InputDataType_unsigned;
cfg->input.rif.sampleCount = 256;
cfg->input.rif.numRamps = 256;
IfxSpu_setupInput(slot, &cfg->input);
/* BIN-REJECTION */
cfg->binrej.mode = IfxSpu_BinRejection_Mode_reject;
cfg->binrej.numAllowedBins = 128;
cfg->binrej.thresholdEnabled = FALSE;
cfg->binrej.thresholdValue = 0xFFFFu;
IfxSpu_setupBinRejection(slot, &cfg->binrej);
IfxSpu_PassId passId = IfxSpu_PassId_0;
IfxSpu_PassConfig *pcfg = &cfg->pass[passId];
/* MATH 1 */
pcfg->math1.loaderExponent = 5;
pcfg->math1.numDropFirstSamples = 0;
pcfg->math1.numDropLastSamples = 0;
pcfg->math1.numPadFrontSamples = 0;
pcfg->math1.window.enabled = FALSE;
pcfg->math1.window.dataFormat = IfxSpu_WindowDataFormat_real16;
pcfg->math1.window.baseAddress = IFX_OFFSETOF(SPU_Cmem0_Map_t, rWndw);
for (antNr = 0; antNr < RADAR_NUM_RX; antNr++)
{
pcfg->math1.window.antennaOffsets[antNr] = 0;
}
pcfg->math1.phaseShift = IfxSpu_PhaseShift_0;
IfxSpu_setupMath1(slot, passId, &pcfg->math1);
/* FFT ENGINE UNLOADER */
pcfg->fft.enabled = TRUE;
pcfg->fft.inversed = FALSE;
pcfg->fft.size = IfxSpu_getSizeCode(RADAR_FFT1_LEN);
pcfg->fft.dataFormat = IfxSpu_FftDataFormat_complex32Bit;
pcfg->fft.exponent = 0;
pcfg->fft.forceToReal = FALSE;
IfxSpu_setupFft(slot, passId, &pcfg->fft);
/* FFT OUTPUT */
pcfg->fftOut.enabled = TRUE;
pcfg->fftOut.baseAddress = IFX_OFFSETOF(SPU_Emem_Map_t, fft_range);
pcfg->fftOut.format = IfxSpu_ODP_Format_complexHalfFloat;
pcfg->fftOut.exponent = 16;
pcfg->fftOut.inPlace = FALSE;
IfxSpu_setupFftOutput(slot, passId, &pcfg->fftOut);
I tried changing math1.loaderExponent from 0 to 18, it only changes the scale of FFT result, and do not solve the problem.
I also tried changing fftOut.exponent, but it does not have any effect.
Please help.
Thank you very much.
Show Less