The interrupt is not returning after exiting

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

The interrupt is not returning after exiting

跳至解决方案
2,099 次查看
luizsantana
Contributor I

I am working with an imx.rt1020.I am using a DMA interrupt to handle microphone and another to handle a speaker, while it is connected to the computer. After a few code changes, it stopped responding as expected. When I make any change to the code such as adding a nop it resume working properly.

So, I use the trace tool to identify what was happening and I notice that the interrupt have the same duration but it is not returning to the main and it stays util it hits a new interruption. The last is the time past since the last event in microseconds. 

luizsantana_0-1663879828392.png

luizsantana_1-1663879886393.png

When I change something in the code, such as changing a pin state or just add a nop it "fix" the behavior.

luizsantana_2-1663879976929.png

I want to know what is holding the program.

If someone can help me identify what is happening.

标签 (1)
0 项奖励
回复
1 解答
1,945 次查看
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi,

Could you try to place eDMA TCD related setting data&code at Non-cachable memory range?

The cache usage could be a root cause.

Mike

 

 

 

在原帖中查看解决方案

0 项奖励
回复
8 回复数
2,066 次查看
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi,

I am not sure if customer is using MCUXpresso SDK software package for RT1020 product.

There with below comment about clear eDMA TCD DONE bit before exit interrupt handling routine:

Hui_Ma_0-1664331653260.png

Wish it helps.

best regards,

Mike

0 项奖励
回复
2,045 次查看
luizsantana
Contributor I

I'm using the SDK version 2.11.0. I didn´t change this part of the SDK, but I created a function in the adapter_sai to call the call the function SAI_TransferSendLoopEDMA and another to call SAI_TransferReceiveLoopEDMA to initiate the communication in loop since the original fsl_adapter_sai.c doesn't support this call. Can this affect the code behavior?

Additionally, I notice that when the problem occours the flash rate communication increases significantly.

0 项奖励
回复
2,027 次查看
luizsantana
Contributor I

This is the sample of the code I added in the fsl_adapter_sai.c.

 

hal_audio_status_t HAL_AudioTransferSendLoopNonBlocking(hal_audio_handle_t handle, hal_audio_transfer_t *xfer)
{
    sai_transfer_t transfer;
    hal_audio_state_t *audioHandle;

    assert(handle);

    audioHandle = (hal_audio_state_t *)handle;

    transfer.data     = (uint8_t *)xfer->data;
    transfer.dataSize = xfer->dataSize;

#if (defined(FSL_FEATURE_SOC_EDMA_COUNT) && (FSL_FEATURE_SOC_EDMA_COUNT > 0U))
    return HAL_AudioGetStatus(
        SAI_TransferSendLoopEDMA(s_i2sBases[audioHandle->instance], &audioHandle->xferDmaHandle, &transfer, 1));
#else
#endif
}

hal_audio_status_t HAL_AudioTransferReceiveLoopNonBlocking(hal_audio_handle_t handle, hal_audio_transfer_t *xfer)
{
    sai_transfer_t transfer;
    hal_audio_state_t *audioHandle;

    assert(handle);

    audioHandle = (hal_audio_state_t *)handle;

    transfer.data     = (uint8_t *)xfer->data;
    transfer.dataSize = xfer->dataSize;

#if (defined(FSL_FEATURE_SOC_EDMA_COUNT) && (FSL_FEATURE_SOC_EDMA_COUNT > 0U))
    return HAL_AudioGetStatus(
        SAI_TransferReceiveLoopEDMA(s_i2sBases[audioHandle->instance], &audioHandle->xferDmaHandle, &transfer, 1));
#else
#endif
}

 

0 项奖励
回复
1,962 次查看
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi,

First of all, sorry for the later reply. I just back from last whole week public holiday in China.

Could you help to update this issue status?

If the issue still be there, could you try to call SAI_TransferSendLoopEDMA() & SAI_TransferReceiveLoopEDMA() functions within the main function?

Wish it helps.

Mike

0 项奖励
回复
1,950 次查看
luizsantana
Contributor I

Hi,

I'm still trying to find the main cause of this issue.

These functions are been called in the main function in the initialization of the system. 

I notice that if I disable the cache during the execution of the system while the problem was happening, this issue stoppped of happening, even with the rest of the program executing slower.

Is it possible to the be occurring a competition for the use of the cache? If this is the case, can I do anything to prevent this from happening?

0 项奖励
回复
1,946 次查看
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi,

Could you try to place eDMA TCD related setting data&code at Non-cachable memory range?

The cache usage could be a root cause.

Mike

 

 

 

0 项奖励
回复
1,918 次查看
luizsantana
Contributor I

Hi,

This picture shows the functions stack inside of the eDMA interrupt. I highlighted the two functions that were not in a non-cacheable memory, when I moved them to a non-cacheable memory the problem stopped.

luizsantana_0-1665745819719.png

Can this be the root cause? Is there a document that explains the cache and how to avoid this kind of problem?

0 项奖励
回复
1,856 次查看
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi,

Thank you for the info.

Please refer my colleague's document <Using NonCached Memory on i.MXRT> for more background info.

Wish it helps.

Mike

0 项奖励
回复