Skip to main content
Morty Morty
Associate III
October 10, 2017
Question

BUG: HAL_DMA_PollForTransfer: Type of CompleteLevel should be HAL_DMA_LevelCompleteTypeDef.

  • October 10, 2017
  • 17 replies
  • 2027 views
Posted on October 10, 2017 at 16:07

The title says it all.

#bug

Note: this post was migrated and contained many threaded conversations, some content may be missing.
This topic has been closed for replies.

17 replies

Nesrine M_O
Associate
October 11, 2017
Posted on October 11, 2017 at 15:44

Hi

moritz.struebe

,

The title says it all.

  1. What are you using as STM32 product?
  2. Could you precise in which HAL library you have found the issue. So, we can verify it.

-Nesrine-

Tesla DeLorean
Guru
October 11, 2017
Posted on October 11, 2017 at 18:11

Post history suggests STM32Cube_FW_F3_V1.9.0

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
Morty Morty
Associate III
October 12, 2017
Posted on October 12, 2017 at 08:43

Yep that's right. But I'm getting so fed up with the quality of the code that I'm getting less and less motivated to write decent bug reports[1]. Especially as I'm only working with this code for a few weeks now. And how many lines are there that contain the words HAL_DMA_PollForTransfer and CompleteLevel. Oh wait - first level support, right? regexp is a magic.

[1] Just found out, that the SPI-HAL might busy wait for up to 100ms

:(

in an interrupt

:(

.  Seriously, ST?
Nesrine M_O
Associate
October 13, 2017
Posted on October 13, 2017 at 12:53

Hi

,
  • inHAL_DMA_PollForTransfer function the Type of CompleteLevel should be HAL_DMA_LevelCompleteTypeDef, this issue is reported internally to our team for check.

  • [1] Just found out, that the SPI-HAL might busy wait for up to 100msin an interrupt. Seriously, ST?

    Could you please add further details about this issue,So, we can verify it.

    You are talking about the HAL_SPI_Abort_IT function ,right?

    HAL_StatusTypeDef HAL_SPI_Abort_IT(SPI_HandleTypeDef *hspi){ HAL_StatusTypeDef errorcode; uint32_t abortcplt ; __IO uint32_t count, resetcount; /* Initialized local variable */ errorcode = HAL_OK; abortcplt = 1U; resetcount = SPI_DEFAULT_TIMEOUT * (SystemCoreClock / 24U / 1000U); count = resetcount; /* Change Rx and Tx Irq Handler to Disable TXEIE, RXNEIE and ERRIE interrupts */ if (HAL_IS_BIT_SET(hspi->Instance->CR2, SPI_CR2_TXEIE)) { hspi->TxISR = SPI_AbortTx_ISR; /* Wait HAL_SPI_STATE_ABORT state */ do { if (count-- == 0U) { SET_BIT(hspi->ErrorCode, HAL_SPI_ERROR_ABORT); break; } } while (hspi->State != HAL_SPI_STATE_ABORT); /* Reset Timeout Counter */ count = resetcount; }�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?

    -Nesrine-

Morty Morty
Associate III
October 13, 2017
Posted on October 13, 2017 at 15:51

ELMHIRI.Syrine

‌: That function is a good example for bad code (resetcount is derived from SystemCoreClock, but the loop is not related to the clock at all and there is a good chance that the code hangs in the while loop forever if something is wrong with interrupts), but it is normally not called from an interrupt context.

The code path I'm referring to is:

(Interrupt context)->SPI_DMATransmitReceiveCplt()->SPI_EndRxTxTransaction() with three chances of waiting up to 100ms.

P.s: Wanna pay me for a code review? It seems like any code I'm looking at contains some issues in one way or the other.

AvaTar
Senior III
October 13, 2017
Posted on October 13, 2017 at 18:14

As a saying goes: 'Never look a gift horse in the mouth.' In my native language, that proverb even rhymes.

That doesn't mean to bet on that horse when much depends on it.

I use Cube code & Co. sometimes as a shortcut for peripheral initialization sequences - but still crosscheck with the RM.

The generated application framework and confiscation of system ressources (like SysTick) is - IMHO - questionable to say the least.

I discarded it at the first try. Good for a beginner's prototype, but that's it.

I believe the Cube coder team has trouble to keep up with the silicon designers. Adding new parts and peripherals to the code generator is more promising than bug fixes. Especially for a free software.

For a commercial project, I would drop any dependency on Cube.

Tesla DeLorean
Guru
October 13, 2017
Posted on October 13, 2017 at 21:22

Actually I though it meant not to look at it's teeth, and determine it is an old gift ready for the knackers yard.

Free horse, be happy what you paid for it.

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..