DMA_SetCallback hangs

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

DMA_SetCallback hangs

Jump to solution
766 Views
bressan
Contributor III

MCUXpresso with LPCXpresso55S69

configured: spi with dma. TX only

in File: fsl_spi_dma.c, function SPI_MasterTransferCreateHandleDMA()
line 197: DMA_SetCallback(handle->rxHandle, SPI_RxDMACallback, &s_dmaPrivateHandle[instance]);

here the debugger hangs, because DMA_SetCallback expects callback !=0
If RX is not wanted, this callback is set =0

Shouldn't the file content be like :

if(handle->rxHandle){

   DMA_SetCallback(handle->rxHandle, SPI_RxDMACallback, &s_dmaPrivateHandle[instance]);

}

?

0 Kudos
1 Solution
681 Views
diego_charles
NXP TechSupport
NXP TechSupport

Hello, bressan@stepover.de

 

After I did a call of the function  SPI_MasterTransferCreateHandleDMA() like this:

SPI_MasterTransferCreateHandleDMA(EXAMPLE_SPI_MASTER, &masterHandle, SPI_MasterUserCallback, NULL, &masterTxHandle,
NULL);// &masterRxHandle as zero. 

I  can tell that your solution is valid to avoid the problem with DMA_Setcallback.()

But, since the driver is designed to use rxHandle and txHandle you will need to use both.

 The rxHandle must be created because it is required on functions as SPI_MasterTransferDMA() and SPI_MasterTransferAbortDMA.(). Otherwise, you will need to implement further changes in the driver to avoid problems.

I don't know if you are using an SDK example. if the answer is no. The spi_dma_b2b_transfer_master example can help you with your work as a reference.

Please, let me know if I can help you further!

 Best regards, Diego. 

View solution in original post

3 Replies
681 Views
bressan
Contributor III

Thanks Diego,

I wrote my own SPI-DMA handler for SPI TX only.

0 Kudos
681 Views
diego_charles
NXP TechSupport
NXP TechSupport

You are welcome, Bernahrd.

Have a great day.

0 Kudos
682 Views
diego_charles
NXP TechSupport
NXP TechSupport

Hello, bressan@stepover.de

 

After I did a call of the function  SPI_MasterTransferCreateHandleDMA() like this:

SPI_MasterTransferCreateHandleDMA(EXAMPLE_SPI_MASTER, &masterHandle, SPI_MasterUserCallback, NULL, &masterTxHandle,
NULL);// &masterRxHandle as zero. 

I  can tell that your solution is valid to avoid the problem with DMA_Setcallback.()

But, since the driver is designed to use rxHandle and txHandle you will need to use both.

 The rxHandle must be created because it is required on functions as SPI_MasterTransferDMA() and SPI_MasterTransferAbortDMA.(). Otherwise, you will need to implement further changes in the driver to avoid problems.

I don't know if you are using an SDK example. if the answer is no. The spi_dma_b2b_transfer_master example can help you with your work as a reference.

Please, let me know if I can help you further!

 Best regards, Diego.