Page 1 of 1

QSPI/DMA module AURIX

Posted: Tue Oct 11, 2016 9:10 am
by HanStep
Hi,

I try to use the QSPI module on AURIX TC277 with ERIKA. The communication should be performed in cooperation with the DMA.
For the configuration I am using low level drivers of Infineon (iLLD).
I implemented the necessary interrupts in the oil file as shown below. My problem is that the interrupt routines never get called, even though
the interrupt flags of the used DMA channels were set. Therefore no signals are on the bus.

Code: Select all

CPU test_application {

OS EE {
	EE_OPT = "EE_DEBUG";
	EE_OPT = "EE_SAVE_TEMP_FILES";
	EE_OPT = "EE_ICACHE_ENABLED";
	EE_OPT = "EE_DCACHE_ENABLED";

	SERVICE_PROTECTION = TRUE;
	MEMORY_PROTECTION = TRUE;
	STACKMONITORING = TRUE;

	REMOTENOTIFICATION = USE_RPC; 

	CPU_DATA = TRICORE { 
		CPU_CLOCK = 200.0;
		APP_SRC = "master.c";
		APP_SRC = "TestQSPImaster.c";
	        MULTI_STACK = TRUE;
		COMPILER_TYPE = GNU {
			EXPORT_FILE = "export_master.exp";
		};
	};


	MCU_DATA = TRICORE {
		MODEL = TC27x;
	};

	STATUS = EXTENDED;
	STARTUPHOOK = TRUE;
	SHUTDOWNHOOK = TRUE;
	PROTECTIONHOOK = TRUE;

	USEREMOTETASK = ALWAYS; //remote support for tasks (ActivateTask())

	KERNEL_TYPE = BCC1;
};

	TASK Task10ms {
		PRIORITY = 7;
		AUTOSTART = FALSE;
		STACK = PRIVATE {
			SYS_SIZE = 512;
		};
		ACTIVATION = 1;
		SCHEDULE = NON;	
	};

	ISR ISR_Qspi_Dma_Tx_Handler {
		CATEGORY = 2;
		PRIORITY = 10;
		HANDLER = "ISR_Qspi_Dma_Tx_Handler";  
	};
  
	ISR ISR_Qspi_Dma_Rx_Handler {
		CATEGORY = 2;
		PRIORITY = 11;
		HANDLER = "ISR_Qspi_Dma_Rx_Handler";  
	};
  
	ISR ISR_Qspi_Dma_Error_Handler {
		CATEGORY = 2;
		PRIORITY = 12;
		HANDLER = "ISR_Qspi_Dma_Error_Handler";  
	};
		
	ALARM Alarm1 { 
		COUNTER = SystemTimer;
		ACTION = ACTIVATETASK{
			TASK = Task10ms;
		};
		AUTOSTART = TRUE {
			ALARMTIME = 1;
			CYCLETIME = 10;
		};
	};

	COUNTER SystemTimer { 
		MINCYCLE = 1;
		MAXALLOWEDVALUE = 2147483647;			
		TICKSPERBASE = 1;
		TYPE = HARDWARE {
			DEVICE = "STM_SR0";
			SYSTEM_TIMER = TRUE;
			PRIORITY = 2;
		};
		SECONDSPERTICK = 0.001;
	};  

	APPLICATION App_Master {	
		TRUSTED = TRUE;
		TASK = Task10ms;
		ALARM = Alarm1;
		ALARM = Alarm2;
        	ISR = ISR_Qspi_Dma_Tx_Handler;
	        ISR = ISR_Qspi_Dma_Rx_Handler;
	        ISR = ISR_Qspi_Dma_Error_Handler;
		SHARED_STACK_SIZE = 256;
		IRQ_STACK_SIZE = 256;
	};
};

Code: Select all

#define PRIO_DMA_CH1   10
#define PRIO_DMA_CH2   11
#define PRIO_QSPI_ER   12

uint32 TxIsrCnt=0;
uint32 RxIsrCnt=0;
uint32 ErrIsrCnt=0;

void ISR_Qspi_Dma_Tx_Handler()
{
  TxIsrCnt++;
}
void ISR_Qspi_Dma_Rx_Handler()
{
  RxIsrCnt++;
}
void ISR_Qspi_Dma_Error_Handler()
{
  ErrIsrCnt++;
}

void InitQSPImaster()
{
  ...

  spiMasterConfig.base.mode             = SpiIf_Mode_master;
  spiMasterConfig.base.maximumBaudrate  = 10000000;

  spiMasterConfig.base.txPriority       = PRIO_DMA_CH1;
  spiMasterConfig.base.rxPriority       = PRIO_DMA_CH2;
  spiMasterConfig.base.erPriority       = PRIO_QSPI_ER;
  // dma configuration.
  spiMasterConfig.dma.txDmaChannelId = Dma_ChannelId_10;
  spiMasterConfig.dma.rxDmaChannelId = Dma_ChannelId_11;
  spiMasterConfig.dma.useDma = 1;

  // init module and enable the service request nodes
  SpiMaster_initModule(&spiMaster, &spiMasterConfig);
  
   ...

  /* QSPI is ready for use now!!! */
}
In a test project with the same configuration, but without OS, the interrupts get triggered as expected and signals were generated (captured with oscilloscope).
So I guess, my ERIKA configuration is wrong or I forgot something.

Could you please give me a hint?

By the way, do you have some own low level drivers supporting AURIX architecture?

Best regards,
Stephan

Re: QSPI/DMA module AURIX

Posted: Tue Oct 11, 2016 10:32 am
by e.guidieri
Hi

I have no idea how the interrupt vector i supposed to be handled to work with iLLD drivers and from the code you posted I cannot understand it, maybe if you could post all the initialization code for the working application without ERIKA I could figure it out.

When we did the porting on TriCore we had no access to Infineon code. I heard that Infineon, after the ERIKA's porting realese, did some demo with ERIKA plus their code but they never realesed them to us.

So the best you can do is ask them to give you the examples of what they did.

Actually the only low level driver we implemented is a STM drivers for System tick, time measurements and delays; You can find it in ${ERIKA_FILES}/pkg/mcu/infineon_common_tc2Yx/src/ee_tc2Yx_system.c

Errico

Re: QSPI/DMA module AURIX

Posted: Tue Oct 11, 2016 12:03 pm
by paolo.gai
As a side note, there will be ERIKA3 drivers for AURIX, but it will be likely during next year.

Ciao,

PJ

Re: QSPI/DMA module AURIX

Posted: Wed Oct 12, 2016 8:58 am
by HanStep
Thanks for your prompt responses.

Due to the non-disclosure agreement I had to sign, I am not allowed to post this code.
So I will try to contact Infineon.

Sounds good! I'm looking forward to the release of ERIKA 3.

Best regards,
Stephan

Re: QSPI/DMA module AURIX

Posted: Wed Oct 12, 2016 10:22 am
by e.guidieri
Hi

search in your working code code all the calls to IfxCpu_Irq_installInterruptHandler or, if you cannot find them, at runtime with a debugger inspect IfxCpu_Irq_swIntVector. Those are the handlers that the drivers suppose to be registered, configure the OIL accordinng to these informations.

Errico