2017-09-03 05:20 PM
Hi Guys,
I am running a STM32L452 on a custom board using the STM32Cube HAL. I am putting the uC into standby mode and am configuring some of the pins to pull up/down using the functions in the stm32l4xx_hal_pwr_ex.c library. One of pins I want to pull down is PA15 but unfortunately the HAL seems to make it so that you cannot enable standby pulldowns on this pin.
HAL_StatusTypeDef HAL_PWREx_EnableGPIOPullDown(uint32_t GPIO, uint32_t GPIONumber)
{ assert_param(IS_PWR_GPIO(GPIO)); assert_param(IS_PWR_GPIO_BIT_NUMBER(GPIONumber));switch (GPIO)
{ case PWR_GPIO_A: SET_BIT(PWR->PDCRA, (GPIONumber & (~(PWR_GPIO_BIT_13|PWR_GPIO_BIT_15
)))); CLEAR_BIT(PWR->PUCRA, (GPIONumber & (~(PWR_GPIO_BIT_14)))); break;In the RM0394 Reference manual it says:
Power Port A pull-down control register (PWR_PDCRA)
Address offset: 0x24.Reset value: 0x0000 0000. This register is not reset when exiting Standby modes and withPWRRST bit in the RCC_APB1RSTR1 register.Bits 31:15 Reserved, must be kept at reset value.
I know it is not good practice but before reading the reference manual I set PWR_PDCRA Bit 15 high to see what would happen. The pull down was enabled and I haven't seen any issues at all in my testing. I am interested if there is a more detailed explanation on why this pin should not be set to pulldown on standby.
It seems that the default setting is for it to pull up on standby and this is turning an LED on the board on. The result is that standby is not so low power. The PCB design is also very tight with few spare pins and any changes would be fairly difficult so I would like to avoid this if possible.
Any thoughts would be great,
Chris
Note: I Tried posting this last week and it got stuck in drafts with the message '
Please note: your content was added successfully, but a moderator needs to approve it before it can be posted.' I tried posting it again today and it worked with no issues. Anyone know what that's about?
2017-09-03 07:25 PM
Could this relate to protecting the debug interface so the connection doesn't drop?
Modify the code, see if it helps. I usually fix bugs myself and push upstream if it seems appropriate.
The 'Syntax Highlighter' has typically caused all content into moderation, short posts or ones full of links or forbidden keywords can also result in being placed into moderation. Sometimes things are approved quickly, other times it takes days, sometimes editing things it might object to also remediates problems.
2017-09-03 08:12 PM
If you are correct in your thoughts Clive then it would be a simple fix of adding a check on what debug method you are using. If SWI is enabled then you should be free to use standby pull-ups and pull-downs on PA15 and PB4. I fear it may be more complicated then that otherwise why the blanket 'Power Port A pull-down control register (PWR_PDCRA) Bit 15 Reserved, must be kept at reset value.' PA15 is also pulled high when programming the uC and I would imagine that there may be some internal connection modifying the code might mess with. I would love to modify the code as it would save a board redesign I just want to make sure I am not possibly shorting anything or causing future problems for myself.
2017-09-03 10:44 PM
After doing some more testing I have found that the PA15 pin is pulled up when the reset line is connected to the ST-LINK/v2-1. When I remove the jumper to the st-link and run the code PA15 floats in standby without setting
PDCRA Bit 15. I think I can work with this as it will only require a large pull-down on the pin rather then a full PCB redesign.