cancel
Showing results for 
Search instead for 
Did you mean: 

How do I update the HAL on an existing STM32G0 project?

KiptonM
Lead

I have a Nucleo-32 STM32G031K8.

STMCubeIDE was installed around March 1.

I have been trying to debug and getting slave code working to respond to HAL_I2C_Mem_Read_DMA() and HAL_I2C_Mem_Write_DMA() commands from another STM32G032K8.

When I looked at the U2319 (Rev 2 October 2020) documentation it says that the HAL_I2C_Mem_Read_DMA() had a timeout variable, but the documentation did not specify what units the timeout was. I am guessing milliseconds like the tick counter.

So I searched for the code, and discovered my code in the HAL file stm32g0xx.hal_i2c.c did NOT have a timeout variable.

So I went to the internet and grabbed another UM2319 from a Google search, and it was different, and the HAL_I2C_Mem_Read_DMA() did not have a timeout variable.

I looked at the Rev and it was Rev 1 October 2018. So either the documentation is wrong or somehow I have an old version of the HAL on my computer.

I looked on the ST website and there is a Patch to 1.4.1 and and 1.5.0.

First I do not know what was loaded onto this computer. I did not load it, our IT department loaded it as I just started work here March 1.

Second, the STM32CubeIDE says there are no updates. I just checked. So I am guessing it does not check or download the HAL.

Third, so assuming I download 1.5.0 because I cannot tell or know how to tell what version I have (it is not mentioned in the STM32G0xx_hal_i2c.c file).. How do I use it in my two projects? (One for the Master I2C, and one for the Slave I2C). I have them in two different workspaces because I am running two instances of the STM32CubeIDE on one PC.

Are there step by step instructions how to update the HAL on an existing project? If so where are they?

1 ACCEPTED SOLUTION

Accepted Solutions
TDK
Guru

> When I looked at the U2319 (Rev 2 October 2020) documentation it says that the HAL_I2C_Mem_Read_DMA() had a timeout variable

> It does NOT have the timeout like the UM2319 Rev 2 October 2020 says it does. 

Where are you seeing that it says there is a timeout parameter?

0693W00000Lw3BWQAZ.png

If you feel a post has answered your question, please click "Accept as Solution".

View solution in original post

5 REPLIES 5
TDK
Guru

Download the pack (Help -> Manage Embedded Software Packages), set the IOC file to use the new version, and regenerate the code.

If your project is not compatible with the code regeneration (e.g. code outside of USER CODE blocks), you'll need to replace files manually.

I don't think HAL_I2C_Mem_Read_DMA ever had a timeout, but could be wrong. More likely to be a documentation error.

HAL driver version is defined in stm32g0xx_hal.c file. Here it is for the F4:

/**
  * @brief STM32F4xx HAL Driver version number V1.7.8
  */
#define __STM32F4xx_HAL_VERSION_MAIN   (0x01U) /*!< [31:24] main version */
#define __STM32F4xx_HAL_VERSION_SUB1   (0x07U) /*!< [23:16] sub1 version */
#define __STM32F4xx_HAL_VERSION_SUB2   (0x08U) /*!< [15:8]  sub2 version */
#define __STM32F4xx_HAL_VERSION_RC     (0x00U) /*!< [7:0]  release candidate */ 
#define __STM32F4xx_HAL_VERSION         ((__STM32F4xx_HAL_VERSION_MAIN << 24U)\
                                        |(__STM32F4xx_HAL_VERSION_SUB1 << 16U)\
                                        |(__STM32F4xx_HAL_VERSION_SUB2 << 8U )\
                                        |(__STM32F4xx_HAL_VERSION_RC))

If you feel a post has answered your question, please click "Accept as Solution".
KiptonM
Lead

While I was waiting for an answer I downloaded the latest version of STMCubeG0. It says 1.5.0

Just for grins I searched for HAL_I2C_Mem_Read_DMA() function.

HAL_StatusTypeDef HAL_I2C_Mem_Read_DMA(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint16_t MemAddress,

                    uint16_t MemAddSize, uint8_t *pData, uint16_t Size)

It does NOT have the timeout like the UM2319 Rev 2 October 2020 says it does. I just wasted a half day searching for a problem that does not exist. Because the DOCUMENTATION was WRONG!

You guys need to get the documentation act together.

Besides having problems with Documentation, I can't get your chips.

Microchip's documentation is better and I can order chips without a 53 week lead time.

Pavel A.
Evangelist III

The earliest version of this driver on github is dated January 2020. No timeout parameter there, since 2020.

TDK
Guru

> When I looked at the U2319 (Rev 2 October 2020) documentation it says that the HAL_I2C_Mem_Read_DMA() had a timeout variable

> It does NOT have the timeout like the UM2319 Rev 2 October 2020 says it does. 

Where are you seeing that it says there is a timeout parameter?

0693W00000Lw3BWQAZ.png

If you feel a post has answered your question, please click "Accept as Solution".
KiptonM
Lead

Sorry I screwed up. I thought I was looking at HAL_I2C_Mem_Read_DMA() in the documentation

And I was reading HAL_I2C_Mem_Read(), It is amazing what you can find after a good night's sleep.

Sorry for the false alarm. I have found so many documentation errors I was sure it was another one. This time it was not.