PDA

View Full Version : QSPI chip select question



Born
Apr 10th, 2016, 11:09 PM
Hi all,

I have trying QSPI with iLLD library 1.0.0.0.7. I want using QSPI0 with manually driven CS pin. Here is SPI the initialization code part:


//************************************************** ******************************
// Function Name : init_SPI
// Author :
// Date :
// Parameters : NONE
// Returns : NONE
// Notes : Initializes the SPI Interface
//************************************************** ******************************
void init_SPI(void)
{
uint32 i;

/* disable interrupts */
boolean interruptState = IfxCpu_disableInterrupts();


IfxQspi_SpiMaster_Config spiMasterConfig;
IfxQspi_SpiMaster_ChannelConfig spiMasterChannelConfig;

{
/* create module config */
IfxQspi_SpiMaster_initModuleConfig(&spiMasterConfig, &MODULE_QSPI0);



/* set the maximum baudrate */
spiMasterConfig.base.maximumBaudrate = 10000000;


/* ISR priorities and interrupt target */
spiMasterConfig.base.txPriority = ISR_PRIORITY_QSPI0_TX;
spiMasterConfig.base.rxPriority = ISR_PRIORITY_QSPI0_RX;
spiMasterConfig.base.erPriority = ISR_PRIORITY_QSPI0_ER;
spiMasterConfig.base.isrProvider = (IfxSrc_Tos)IfxCpu_getCoreIndex();



/* pin configuration */
const IfxQspi_SpiMaster_Pins pins = {&IfxQspi0_SCLK_P20_11_OUT, /* SCLK */
IfxPort_OutputMode_pushPull,
&IfxQspi0_MTSR_P20_14_OUT, /* MOSI */
IfxPort_OutputMode_pushPull,
&IfxQspi0_MRSTA_P20_12_IN, IfxPort_InputMode_pullDown, /* MISO */
IfxPort_PadDriver_cmosAutomotiveSpeed3 /* pad driver mode */
};
spiMasterConfig.pins = &pins;

/* initialize module */
IfxQspi_SpiMaster_initModule(&g_QspiCpu.drivers.spiMaster, &spiMasterConfig);
}

{
/* create channel config */
IfxQspi_SpiMaster_initChannelConfig(&spiMasterChannelConfig,
&g_QspiCpu.drivers.spiMaster);

/* set the baudrate for this channel */
spiMasterChannelConfig.base.baudrate = 3000000;

const IfxQspi_SpiMaster_Output slsOutput = {
&IfxQspi0_SLSO9_P20_3_OUT,
//NULL_PTR, // if this option is used then got jump to intrisic code part !!!!!
IfxPort_OutputMode_pushPull,
IfxPort_PadDriver_cmosAutomotiveSpeed1};

spiMasterChannelConfig.sls.output.pin = slsOutput.pin;
spiMasterChannelConfig.sls.output.mode = slsOutput.mode;
spiMasterChannelConfig.sls.output.driver = slsOutput.driver;
spiMasterChannelConfig.base.mode.autoCS = 0; // HERE I SET AUTO CS DISABLED, BUT CS STAYS ENABLED!!!!!

/* initialize channel */
IfxQspi_SpiMaster_initChannel(&g_QspiCpu.drivers.spiMasterChannel, &spiMasterChannelConfig);
}

/* init tx buffer area */
for (i = 0; i < SPI_BUFFER_SIZE; i++)
g_QspiCpu.qspiBuffer.spi0RxBuffer[i] = (uint8)(0);

IfxCpu_restoreInterrupts(interruptState);

} //end init_SPI

As you see I set up the autoCS disabled but it was not took effect, CS stays automatically driven. Also if I set NULL_PTR for spiMasterChannelConfig.sls.output.pin, then I get intrisic entry, debugger jumps to here :

( file IfxCpu_Inrtinsics_Gnuc.h )


/** Insert DEBUG instruction
*/
IFX_INLINE void __debug(void)
{
__asm__ volatile ("debug" : : : "memory");
}


What the problem could be please ?

Thank you in advance !

Best regards,
Born

vinicius.oliveira
Aug 14th, 2018, 02:19 AM
Hello,

I have the exactly same issue, did you manage to fix this?