diff --git a/hal/targets/hal/TARGET_Freescale/TARGET_KSDK2_MCUS/TARGET_KL27Z/drivers/fsl_flexio_spi_dma.c b/hal/targets/hal/TARGET_Freescale/TARGET_KSDK2_MCUS/TARGET_KL27Z/drivers/fsl_flexio_spi_dma.c index 157d0eb466c..845aa41a702 100755 --- a/hal/targets/hal/TARGET_Freescale/TARGET_KSDK2_MCUS/TARGET_KL27Z/drivers/fsl_flexio_spi_dma.c +++ b/hal/targets/hal/TARGET_Freescale/TARGET_KSDK2_MCUS/TARGET_KL27Z/drivers/fsl_flexio_spi_dma.c @@ -77,7 +77,7 @@ static void FLEXIO_SPI_DMAConfig(FLEXIO_SPI_Type *base, ******************************************************************************/ /* Dummy data used to send */ -const uint16_t s_dummyData = FLEXIO_SPI_DUMMYDATA; +static const uint16_t s_dummyData = FLEXIO_SPI_DUMMYDATA; /*< @brief user configurable flexio spi handle count. */ #define FLEXIO_SPI_HANDLE_COUNT 2 diff --git a/hal/targets/hal/TARGET_Freescale/TARGET_KSDK2_MCUS/TARGET_KL27Z/drivers/fsl_flexio_spi_dma.h b/hal/targets/hal/TARGET_Freescale/TARGET_KSDK2_MCUS/TARGET_KL27Z/drivers/fsl_flexio_spi_dma.h index e154090b44e..7ebce1e41ec 100755 --- a/hal/targets/hal/TARGET_Freescale/TARGET_KSDK2_MCUS/TARGET_KL27Z/drivers/fsl_flexio_spi_dma.h +++ b/hal/targets/hal/TARGET_Freescale/TARGET_KSDK2_MCUS/TARGET_KL27Z/drivers/fsl_flexio_spi_dma.h @@ -38,7 +38,6 @@ * @{ */ -/*! @file */ /******************************************************************************* * Definitions diff --git a/hal/targets/hal/TARGET_Freescale/TARGET_KSDK2_MCUS/TARGET_KL27Z/drivers/fsl_spi_dma.c b/hal/targets/hal/TARGET_Freescale/TARGET_KSDK2_MCUS/TARGET_KL27Z/drivers/fsl_spi_dma.c index b7b85454cf0..cdaddcc7999 100755 --- a/hal/targets/hal/TARGET_Freescale/TARGET_KSDK2_MCUS/TARGET_KL27Z/drivers/fsl_spi_dma.c +++ b/hal/targets/hal/TARGET_Freescale/TARGET_KSDK2_MCUS/TARGET_KL27Z/drivers/fsl_spi_dma.c @@ -80,7 +80,7 @@ static void SPI_RxDMACallback(dma_handle_t *handle, void *userData); ******************************************************************************/ /* Dummy data used to send */ -const uint8_t s_dummyData = SPI_DUMMYDATA; +static const uint8_t s_dummyData = SPI_DUMMYDATA; /******************************************************************************* * Code @@ -168,7 +168,7 @@ void SPI_MasterTransferCreateHandleDMA(SPI_Type *base, handle->bytesPerFrame = 1U; #endif /* FSL_FEATURE_SPI_16BIT_TRANSFERS */ -#if defined(FSL_FEATURE_SPI_FIFO_SIZE) && (FSL_FEATURE_SPI_FIFO_SIZE > 1) +#if defined(FSL_FEATURE_SPI_HAS_FIFO) && (FSL_FEATURE_SPI_HAS_FIFO) /* If using DMA, disable FIFO, as the FIFO may cause data loss if the data size is not integer times of 2bytes. As SPI cannot set watermark to 0, only can set to 1/2 FIFO size or 3/4 FIFO size. */ @@ -177,7 +177,7 @@ void SPI_MasterTransferCreateHandleDMA(SPI_Type *base, base->C3 &= ~SPI_C3_FIFOMODE_MASK; } -#endif /* FSL_FEATURE_SPI_FIFO_SIZE */ +#endif /* FSL_FEATURE_SPI_HAS_FIFO */ /* Set the non-change attribute for Tx DMA transfer, to improve efficiency */ config.destAddr = SPI_GetDataRegisterAddress(base); @@ -226,6 +226,10 @@ status_t SPI_MasterTransferDMA(SPI_Type *base, spi_dma_handle_t *handle, spi_tra return kStatus_InvalidArgument; } + /* Disable SPI and then enable it, this is used to clear S register*/ + SPI_Enable(base, false); + SPI_Enable(base, true); + /* Configure tx transfer DMA */ config.destAddr = SPI_GetDataRegisterAddress(base); config.enableDestIncrement = false; diff --git a/hal/targets/hal/TARGET_Freescale/TARGET_KSDK2_MCUS/TARGET_KL27Z/drivers/fsl_spi_dma.h b/hal/targets/hal/TARGET_Freescale/TARGET_KSDK2_MCUS/TARGET_KL27Z/drivers/fsl_spi_dma.h index 264d5884900..90c7c93fb65 100755 --- a/hal/targets/hal/TARGET_Freescale/TARGET_KSDK2_MCUS/TARGET_KL27Z/drivers/fsl_spi_dma.h +++ b/hal/targets/hal/TARGET_Freescale/TARGET_KSDK2_MCUS/TARGET_KL27Z/drivers/fsl_spi_dma.h @@ -38,7 +38,6 @@ * @{ */ -/*! @file */ /******************************************************************************* * Definitions