2025-09-22 1:31 PM
The goal of my program is to:
1. Set low power time that runs off HSI for 10 seconds
2. Enter stop2 WFI
3. Wake up from low-power interrupt
4. Advertise for 5 seconds
5. Stop advertising
6. Repeat Steps
During stop2 at the beginning of program my system is using ~ 74uA (which seems high but is reasonable), and when I wake up to start advertising and call aci_gap_set_discoverable(). This raises the current to ~3.4mA while advertising but when I call aci_gap_set_non_discoverable() it only lowers the current draw to ~3mA.
I would expect the system to go back to the ~74uA it was drawing before advertising was turned on but it is not.
I am able to connect to the chip over bluetooth successfully just want to know what needs to be done to get the power draw where I would expect
Any help would be greatly appreciated!
Thank you.
Solved! Go to Solution.
2025-10-02 7:35 AM
After a lot of debugging and scrubbing through old forum posts found a suggestion to use the HSI48 for the RNG peripheral rather then the LSI and this in conjuction with staying awake during advertising periods solved the issues I was having.
2025-09-25 6:12 AM
@aidant wrote:The goal of my program is to:
1. Set low power time that runs off HSI for 10 seconds
2. Enter stop2 WFI3. Wake up from low-power interrupt
4. Advertise for 5 seconds
5. Stop advertising
6. Repeat Steps
During stop2 at the beginning of program my system is using ~ 74uA (which seems high but is reasonable), and when I wake up to start advertising and call aci_gap_set_discoverable(). This raises the current to ~3.4mA while advertising but when I call aci_gap_set_non_discoverable() it only lowers the current draw to ~3mA.
I would expect the system to go back to the ~74uA it was drawing before advertising was turned on but it is not.
I am able to connect to the chip over bluetooth successfully just want to know what needs to be done to get the power draw where I would expect
Any help would be greatly appreciated!
Thank you.
After some more debugging (using aGpioConfigList for cpu2 debugging ) I have seen that when `aci_gap_set_discoverable()` is called, the RNG_PROCESS is constantly toggling for the rest of the runtime of the application even when I call `aci_gap_set_non_discoverable()`.
From the datasheet I know that the TRNG independent clock domain should use 3.80 uA / Mhz however I have seen through testing when I keep my logic the exact same (for the advertising on a period as described in the original post) and only comment out `MX_RNG_Init();` in main.c that my system will advertise and after advertisement go back to the expected idle current (which is the desired behavior I want).
This is not perfect though, due to the system not initializing the RNG peripheral each advertisement request will only send out a single advertisement rather then advertising (between min and max retry) until the timeout elapses. Because of this, I know that this temporary fix is not a permanent solution. I have tried to enable/disable the peripheral from cpu1 depending on if the system is advertising however ran into the issue where after cpu1 boots up cpu2 (by setting `PWR_CR4_C2BOOT` I appear to no longer have access to the peripheral (the RNG handle `hrng` instance struct becomes 0x0 for each member and in the SFRs the same is seen). The system will also crash when attempting to clear the bits in `HAL_RNG_DeInit()`. The code I was using to disable is below and this is called in adv_cancel which is generated by CubeMX.
```
while( LL_HSEM_1StepLock( HSEM, CFG_HW_RNG_SEMID ) );
HAL_RNG_DeInit(&hrng); //Switch off RNG IP
__HAL_RCC_RNG_CLK_DISABLE(); //Switch off RNG clock
LL_HSEM_ReleaseLock( HSEM, CFG_HW_RNG_SEMID, 0 );
```
Any help to determine the problem I am having or steps to relieve the issue would be greatly appreciated, thank you!
2025-10-02 7:35 AM
After a lot of debugging and scrubbing through old forum posts found a suggestion to use the HSI48 for the RNG peripheral rather then the LSI and this in conjuction with staying awake during advertising periods solved the issues I was having.