cancel
Showing results for 
Search instead for 
Did you mean: 

STM32CubeMX possible bug

Eugene S.
Associate III
Posted on October 30, 2016 at 18:46

I use STM32CubeMX v 4.0 to configure CMSIS SPI Driver. I believe I do right DMA configuration:

0690X00000604swQAA.png But after code generation file MX_Device.h hasn't defines to enable DMA for SPI.

/* DMA Configuration */
/* DMA SPI2_TX */
/* DMA SPI2_RX */

So, I have to modify it to enable DMA:

/* DMA Configuration */
/* DMA SPI2_TX */
#define MX_SPI2_TX_DMA_Instance DMA1_Stream4
/* DMA SPI2_RX */
#define MX_SPI2_RX_DMA_Instance DMA1_Stream3

#stm32cubemx #dma #bug
6 REPLIES 6
slimen
Senior
Posted on October 31, 2016 at 15:05

Hello,

Please share your .ioc to check this case.

In which folder is defined MX_Device.h ?

Regards
Eugene S.
Associate III
Posted on October 31, 2016 at 22:38

Hi,

I used the example project CMSIS-RTOS Blinky (STM32F4-Discovery) in Keil MDK-ARM 5. And then configured SPI1 via STM32CubeMX. After the code generating I got same problem. The MX_device.his in \MDK\Boards\ST\STM32F4-Discovery\Blinky\RTE\Device\STM32F407VGTx\ folder.

.ioc file attached

Hello,

Please share your .ioc to check this case.

In which folder is defined MX_Device.h ?

Regards

________________

Attachments :

STCubeGenerated.ioc : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HzQK&d=%2Fa%2F0X0000000bLh%2FfkVWr4EErP3E6IyvRsyVo2t4cacLVCQTshR3kFnIkC0&asPdf=false
Sirma Siang
ST Employee
Posted on November 07, 2016 at 11:29

Hello Eugene,

I want to thank you for your bug report, this is helpfull for us to improve our SW offers.

I try to locate the file and reproduce your issue.

I download latest uVision tool - V5.21.1.0

I install the latest Keil pack version for ST F4 family - 2.10.0

it has been installed, on my windows machine, here C:\Keil_v5\ARM\PACK\Keil\STM32F4xx_DFP\2.10.0

Can you check which version do you have installed on your machine ?

The pack version can be obtain, as well, into Project->Manage->Pack Installer : right side -> Packs tab, select ''Device Specific'', and expand ''Keil::STM32F4xx_DFP''.

The file you mentionned does not exist in that version, howether a file named RTE_Device.h does.

It has all SPI DMA definition (in a slightly different writing) has you describe in your post.

I guess here that this project example has been updated by ARM.

The header of this file indicate that this is provided ''as is'' by ARM.

As far as I know, this file is not generated by CubeMX.

Kind Regards

Sirma

Eugene S.
Associate III
Posted on November 08, 2016 at 10:11

Hello,

I have the exact same versions. MX_Device.h was generated by STM32CubeMX. So, first you have to configure your project to use STM32CubeMX: http://www.keil.com/pack/doc/STM32Cube/General/html/cubemx_proj.html After you click ''Project - Generate Code'' in STM32CubeMX you'll get you MX_Device.h file. This is mine:

/******************************************************************************
* File Name : MX_Device.h
* Date : 31/10/2016 23:11:36
* Description : STM32Cube MX parameter definitions
* Note : This file is generated by STM32CubeMX (DO NOT EDIT!)
******************************************************************************/
#ifndef __MX_DEVICE_H
#define __MX_DEVICE_H
/*---------------------------- Clock Configuration ---------------------------*/
#define MX_LSI_VALUE 32000
#define MX_LSE_VALUE 32768
#define MX_HSI_VALUE 16000000
#define MX_HSE_VALUE 25000000
#define MX_EXTERNAL_CLOCK_VALUE 12288000
#define MX_PLLCLKFreq_Value 96000000
#define MX_SYSCLKFreq_VALUE 16000000
#define MX_HCLKFreq_Value 16000000
#define MX_FCLKCortexFreq_Value 16000000
#define MX_CortexFreq_Value 16000000
#define MX_AHBFreq_Value 16000000
#define MX_APB1Freq_Value 16000000
#define MX_APB2Freq_Value 16000000
#define MX_APB1TimFreq_Value 16000000
#define MX_APB2TimFreq_Value 16000000
#define MX_48MHZClocksFreq_Value 48000000
#define MX_EthernetFreq_Value 16000000
#define MX_I2SClocksFreq_Value 96000000
#define MX_RTCFreq_Value 32000
#define MX_WatchDogFreq_Value 32000
#define MX_MCO1PinFreq_Value 16000000
#define MX_MCO2PinFreq_Value 16000000
/*-------------------------------- DMA --------------------------------*/
#define MX_DMA 1
/* NVIC Configuration */
/* NVIC DMA2_Stream3_IRQn */
#define MX_DMA2_Stream3_IRQn_interruptPremptionPriority 0
#define MX_DMA2_Stream3_IRQn_PriorityGroup NVIC_PRIORITYGROUP_4
#define MX_DMA2_Stream3_IRQn_Subriority 0
/* NVIC DMA2_Stream0_IRQn */
#define MX_DMA2_Stream0_IRQn_interruptPremptionPriority 0
#define MX_DMA2_Stream0_IRQn_PriorityGroup NVIC_PRIORITYGROUP_4
#define MX_DMA2_Stream0_IRQn_Subriority 0
/*-------------------------------- SPI1 --------------------------------*/
#define MX_SPI1 1
/* GPIO Configuration */
/* Pin PA6 */
#define MX_SPI1_MISO_GPIO_Speed GPIO_SPEED_FREQ_VERY_HIGH
#define MX_SPI1_MISO_Pin PA6
#define MX_SPI1_MISO_GPIOx GPIOA
#define MX_SPI1_MISO_GPIO_PuPd GPIO_NOPULL
#define MX_SPI1_MISO_GPIO_Pin GPIO_PIN_6
#define MX_SPI1_MISO_GPIO_AF GPIO_AF5_SPI1
#define MX_SPI1_MISO_GPIO_Mode GPIO_MODE_AF_PP
/* Pin PA7 */
#define MX_SPI1_MOSI_GPIO_Speed GPIO_SPEED_FREQ_VERY_HIGH
#define MX_SPI1_MOSI_Pin PA7
#define MX_SPI1_MOSI_GPIOx GPIOA
#define MX_SPI1_MOSI_GPIO_PuPd GPIO_NOPULL
#define MX_SPI1_MOSI_GPIO_Pin GPIO_PIN_7
#define MX_SPI1_MOSI_GPIO_AF GPIO_AF5_SPI1
#define MX_SPI1_MOSI_GPIO_Mode GPIO_MODE_AF_PP
/* Pin PA5 */
#define MX_SPI1_SCK_GPIO_Speed GPIO_SPEED_FREQ_VERY_HIGH
#define MX_SPI1_SCK_Pin PA5
#define MX_SPI1_SCK_GPIOx GPIOA
#define MX_SPI1_SCK_GPIO_PuPd GPIO_NOPULL
#define MX_SPI1_SCK_GPIO_Pin GPIO_PIN_5
#define MX_SPI1_SCK_GPIO_AF GPIO_AF5_SPI1
#define MX_SPI1_SCK_GPIO_Mode GPIO_MODE_AF_PP
/* DMA Configuration */
/* DMA SPI1_RX */
/* DMA SPI1_TX */
/*-------------------------------- SYS --------------------------------*/
#define MX_SYS 1
/* GPIO Configuration */
/*-------------------------------- NVIC --------------------------------*/
#define MX_NVIC 1
/*-------------------------------- GPIO --------------------------------*/
#define MX_GPIO 1
/* GPIO Configuration */
#endif /* __MX_DEVICE_H */

Sirma Siang
ST Employee
Posted on November 08, 2016 at 16:21

HEllo Eugene,

Thanks you for all your inputs.

By loading your ioc in CubeMX, this file is not generated, but by launching CubeMX from Keil (as it is describe in your link) then much files are generated, including this file.

As this is out of my knowledge, I forward this bug to the relevant team.

Kind Regards

Sirma

Sirma Siang
ST Employee
Posted on January 20, 2017 at 10:49

Hello Eugene,

I would like to thank you for your inputs.

I can confirm you that this will be fixed in release 4.19.

Kind Regards

Sirma