Skip to main content
mkx
Associate II
March 30, 2026
Solved

How to override AGC and use manual attenuation values?

  • March 30, 2026
  • 2 replies
  • 194 views

I want to disable the AGC and use supply manual attenuation values.
Disabling the AGC is pretty straight forward, I just set the AGC_EN bit in AGC0CTRL to zero.
This works fine, but the gain/attenuation is fixed at the reset value and I'd like to use a custom value.

To set manual attenuation values, I suppose I need to write them to the AGC_ANA_ENG register.

However, i noticed something weird: This AGC_ANA_ENG register is not present in the driver files. Its not mentioned anywhere and in the MRSUBG register definitions it is listed as "Reserved". The "Description of STM32WL3 HAL and LL drivers" pdf (UM3438) even lists a couple of LL-functions to modify it, such as LL_MRSubG_SetAgcForceGains, but they exist nowhere in the driver files.

Why is this register not mentioned in the official driver files and why dont the LL-methods exist?

Best answer by Imen.D

Hello @mkx ,

The API is located in: Drivers\STM32WL3x_HAL_Driver\Inc\stm32wl3x_ll_mrsubg.h as LL_MRSUBG_SetAgcForceGains. 

 

2 replies

Imen.DBest answer
Technical Moderator
April 1, 2026

Hello @mkx ,

The API is located in: Drivers\STM32WL3x_HAL_Driver\Inc\stm32wl3x_ll_mrsubg.h as LL_MRSUBG_SetAgcForceGains. 

 

"When your question is answered, please close this topic by clicking ""Accept as Solution"".ThanksImen"
mkx
mkxAuthor
Associate II
April 8, 2026

Maybe I'm missing something here, but stm32wl3x_ll_mrsubg.h does not seem to contain LL_MRSUBG_SetAgcForceGains.

https://github.com/STMicroelectronics/stm32wl3x-hal-driver/blob/main/Inc/stm32wl3x_ll_mrsubg.h

I'm using the stm32wl3x-hal-driver repo on github, release 1.3.0. It does not contain LL_MRSUBG_SetAgcForceGains.

Technical Moderator
April 9, 2026

Hi @mkx ,

The API LL_MRSUBG_SetAgcForceGains is included in stm32wl3x_ll_mrsubg.h and is available on the ST web page starting from release 1.4.0STM32CubeWL3 | Product - STMicroelectronics

"When your question is answered, please close this topic by clicking ""Accept as Solution"".ThanksImen"
mkx
mkxAuthor
Associate II
April 9, 2026

Alright, looks like I was just using an outdated version then, thanks!

I wasn't aware you also offer the drivers directly on st.com and - somewhat confusingly - a newer version than in the github repos.