DMA_SetCallback hangs

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

DMA_SetCallback hangs

跳至解决方案
2,702 次查看
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 项奖励
回复
1 解答
2,617 次查看
diego_charles
NXP TechSupport
NXP TechSupport

Hello, [email protected]

 

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. 

在原帖中查看解决方案

3 回复数
2,617 次查看
bressan
Contributor III

Thanks Diego,

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

0 项奖励
回复
2,617 次查看
diego_charles
NXP TechSupport
NXP TechSupport

You are welcome, Bernahrd.

Have a great day.

0 项奖励
回复
2,618 次查看
diego_charles
NXP TechSupport
NXP TechSupport

Hello, [email protected]

 

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.