AnsweredAssumed Answered

Bug: Cube v4.17.0 / STM32Cube FW_F0 V1.6.0; DMA Initialisation

Question asked by Goodman.Stephen.001 on Oct 24, 2016
Latest reply on Oct 26, 2016 by fauvarque.daniel
I have just updated to Cube v4.17.0 which I also think updated the firmware package for the chip I am using (STM32F030RCTx).  There is a bug in the initialisation code for the DMA that causes the project not to be compiled at all.

Pre-update:
__HAL_DMA1_REMAP(HAL_DMA1_CH3_SPI1_TX);

Post-update:
if (__HAL_DMA1_REMAP(HAL_DMA1_CH3_SPI1_TX) != HAL_OK)
{
  Error_Handler();
}

The macro __HAL_DMA1_REMAP is defined as:
#define __HAL_DMA1_REMAP(__REQUEST__)  \
do { assert_param(IS_HAL_DMA1_REMAP(__REQUEST__)); \
DMA1->CSELR &= ~((uint32_t)0x0F << (uint32_t)(((__REQUEST__) >> 28) * 4)); \
DMA1->CSELR |= (uint32_t)((__REQUEST__) & 0x0FFFFFFF); \
}while(0)

It's easy to see why this will not work in an if statement.  I am having to edit the code manually every time I generate the code.

Outcomes