Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HAL][FMAC] Implement missing DMA stop #12

Closed
wants to merge 4 commits into from

Conversation

hobby-pub
Copy link

Opened Issue
HAL_FMAC_FilterStop does not terminate DMA transfer

Describe the bug
A wrong behavior of subsequent HAL_FMAC_FilterStart() -> HAL_FMAC_FilterStop() -> HAL_FMAC_FilterStart().

How To Reproduce

  1. FMAC is configured as FIR with output buffer access mode DMA.
  2. The software periodically starts and stops FMAC, by calling HAL_FMAC_FilterStart() / HAL_FMAC_FilterStop().
  3. The second call of HAL_FMAC_FilterStart() fails with DMA related HAL error.

Additional context
Follow the issue debugging, DMA transfer starts from within HAL_FMAC_FilterStart().
However, complementary DMA stop is missing in HAL_FMAC_FilterStop().

@ALABSTM ALABSTM added bug Something isn't working hal HAL-LL driver-related issue or pull-request. labels Mar 25, 2024
@ALABSTM ALABSTM linked an issue Mar 25, 2024 that may be closed by this pull request
@ALABSTM
Copy link
Contributor

ALABSTM commented Mar 25, 2024

Hi @hobby-pub,

Than you for this contribution. We will process it soon enough hopefully. By the way, thank you very much for the well formatted commit message.

With regards,

@TOUNSTM
Copy link
Contributor

TOUNSTM commented Mar 27, 2024

Hello @hobby-pub,

Thank you for your report. We have tried to reproduce the problem you described, without success. Could you please share the entire project you used to reproduce the problem to allow for a better analysis.

Best regards,

@TOUNSTM TOUNSTM added the needs clarification Needs clarification or input from user label Mar 27, 2024
@hobby-pub
Copy link
Author

hobby-pub commented Mar 27, 2024 via email

@TOUNSTM
Copy link
Contributor

TOUNSTM commented Mar 27, 2024

Hello @hobby-pub,

To attach a file to your P-R, please drag-and-drop it into the comment box or you can click on the bar at the bottom of the comment box to add it from your computer and then wait for the upload process to finish.

With regards,

@hobby-pub
Copy link
Author

hobby-pub commented Mar 27, 2024

Hello @TOUNSTM,

Attached the simple test example. Please note, that a lot of initializations are missing.

fmac_test.txt

@TOUNSTM
Copy link
Contributor

TOUNSTM commented Apr 2, 2024

ST Internal Reference: 177976

@TOUNSTM TOUNSTM added internal bug tracker Issue confirmed and reported into a ticket in the internal bug tracking system and removed needs clarification Needs clarification or input from user labels Apr 2, 2024
@TOUNSTM
Copy link
Contributor

TOUNSTM commented Apr 5, 2024

Hello @hobby-pub,

Upon further investigation, our development team have encountered a behavior that mirrors the issue described. It appears that during the second invocation of FilterStart, the DMAOut handle remains in a HAL_DMA_STATE_BUSY state. This is the underlying cause of the DMA error, as DMAOut must be in a HAL_DMA_STATE_READY state to initiate properly. I need further clarification from you for a better analysis:

  1. Can you confirm whether you have observed the same state when the DMA error occurs (DMAOut State == HAL_DMA_STATE_BUSY)?
  2. Is Stopping the filter before the end of calculus is an expected/authorized behavior by the program ?

There are two possible explanations for the HAL_DMA_BUSY state:

  1. Premature FilterStop: If FilterStop is called too early, and then all expected calculus are not completed on time. This reveal, perhaps, a timing issue in the program ?
  2. FMAC Configuration: The FMAC may not be configured correctly for the calculations required ?

However, It's also important to note that there is a missing step in the driver to halt the DMA in/out processes.

Thank you for your contribution.
With regards,

@TOUNSTM TOUNSTM added the needs clarification Needs clarification or input from user label Apr 5, 2024
@hobby-pub
Copy link
Author

hobby-pub commented Apr 5, 2024

Hello, @TOUNSTM,

Please, see my answers below.

  1. Can you confirm whether you have observed the same state when the DMA error occurs (DMAOut State == HAL_DMA_STATE_BUSY)?
    Yes, as far as I remember.
  1. Is Stopping the filter before the end of calculus is an expected/authorized behavior by the program ?
    Yes, the program stops filter asynchronously regardless of the calculation state, and this is by design.

There are two more notes:

  1. It looks that HAL_DMA_Abort_IT() is the correct, complementary HAL function to stop DMA, and not HAL_DMA_Abort() which I committed in the patch.
  2. I did not use neither tested the input buffer in DMA mode.

Best regards,

@hobby-pub
Copy link
Author

Hello @ALABSTM, @TOUNSTM,

Thank you for reviewing the patch(s).
I wonder is there any progress with HAL FMAC bug?

Kindly regards,

@TOUNSTM
Copy link
Contributor

TOUNSTM commented Oct 16, 2024

Fixed in d69997c

@TOUNSTM TOUNSTM closed this Oct 16, 2024
@TOUNSTM TOUNSTM removed the needs clarification Needs clarification or input from user label Oct 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working hal HAL-LL driver-related issue or pull-request. internal bug tracker Issue confirmed and reported into a ticket in the internal bug tracking system
Projects
Development

Successfully merging this pull request may close these issues.

HAL_FMAC_FilterStop does not terminate DMA transfer
3 participants