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
Hello sudhakar p:
The KSDK DSPI driver is based on interrupts. If you want to use it in polling mode you need to use the HAL layer instead. I recommend you to install the latest KSDK v1.3 and there is an example for DSPI in polling mode in the next path:
C:\Freescale\KSDK_1.3.0\examples\frdmk64f\driver_examples\dspi\dspi_polling
Regards!
Jorge Gonzalez