AnsweredAssumed Answered

FRDMK64 SPI INTERRUPT ISSUE

Question asked by sudhakar p on Nov 20, 2015
Latest reply on Nov 30, 2015 by Jorge_Gonzalez

HI,

     I am using FRDMK64f120 controller, KDS2.0 and KSDK 1.1.0 example . I Tried SPI driver example code. in this one i dnt need interrupt so i commented following line

     int32_t IRQNumber = g_dspiIrqId[SPI_INSTANCE];

      _int_install_isr(IRQNumber, (INT_ISR_FPTR)DSPI_DRV_MasterIRQHandler, (void*)SPI_INSTANCE);

after that its not communicating with my AT45DB161 why..?

if i enable interrupt only its working fine. what is the reason?

 

MY REQUIREMENT:

     what ever data coming from UART i want to write into external data flash. so for that i am calling external data flash write function inside  void uartUser_RxCallback(uint32_t instance, void * param). function. that time its hanging may be i thing its related to interrupt only give some solution.

 

my spi initialization code:

 

dspi_master_user_config_t userConfig;

userConfig.isChipSelectContinuous = true;

userConfig.isSckContinuous = false;

userConfig.pcsPolarity = kDspiPcs_ActiveLow;

userConfig.whichCtar = kDspiCtar1;//kDspiCtar0;

userConfig.whichPcs = kDspiPcs1;//kDspiPcs0;

 

//* Init the DSPI module

dspi_master_state_t dspiMasterState;

dspi_status_t status = DSPI_DRV_MasterInit(SPI_INSTANCE, &dspiMasterState, &userConfig);

 

//* Define bus configuration

dspi_device_t spiDevice;

spiDevice.dataBusConfig.bitsPerFrame = 8;

spiDevice.dataBusConfig.clkPhase = kDspiClockPhase_SecondEdge;//kDspiClockPhase_SecondEdge

spiDevice.dataBusConfig.clkPolarity = kDspiClockPolarity_ActiveLow;//kDspiClockPolarity_ActiveLow

spiDevice.dataBusConfig.direction = kDspiMsbFirst;

spiDevice.bitsPerSec = 60000000;

 

//* Configure the SPI bus

uint32_t calculatedBaudRate;

status = DSPI_DRV_MasterConfigureBus(SPI_INSTANCE, &spiDevice, &calculatedBaudRate);

 

/* SPI use interrupt, must be installed in MQX and file fsl_dspi_irq.c must not be included in project */

// int32_t IRQNumber = g_dspiIrqId[SPI_INSTANCE];               //COMMENTED

// _int_install_isr(IRQNumber, (INT_ISR_FPTR)DSPI_DRV_MasterIRQHandler, (void*)SPI_INSTANCE); //COMMENTED

 

PLEASE GIVE SOME SOLUTION.  I Can use with interrupt also but when i call spi related function inside void uartUser_RxCallback(uint32_t instance, void * param)

function its hanging. i dnt know why. may be i thing uartUser_RxCallback function also interrupt.

 

regards,

sudhakar p

Outcomes