2015-12-23 04:07 AM
Hello,
I started to develop a device with STM32F411RET6, working on battery.I saw, that the current consumption, varies with 0.8mA depending of code size or code alignment in MCU flash.Does anyone know something about this?I made a simple test:MCU, 8MHz, HSI divided by 2, prefetch and cache enabled.I work in MikroPascal, Mikroelektronika.code, first test, current 3.5mAbegin while true do // 3.5 mA begin// nop; nop;nop; nop;nop; nop;nop; nop;nop; nop;nop; nop;nop; nop;nop; end;end.ASM:;Spera.mpas, 102 :: begin0x05DC 0xF7FFFE4C BL 6320x05E0 0xF7FFFE22 BL 5520x05E4 0xF000F812 BL 15480x05E8 0xF7FFFE34 BL 596;Spera.mpas, 103 :: while true doL__main2:;Spera.mpas, 106 :: nop;nop;0x05EC 0xBF00 NOP0x05EE 0xBF00 NOP;Spera.mpas, 107 :: nop;nop;0x05F0 0xBF00 NOP0x05F2 0xBF00 NOP;Spera.mpas, 108 :: nop;nop;0x05F4 0xBF00 NOP0x05F6 0xBF00 NOP;Spera.mpas, 109 :: nop;nop;0x05F8 0xBF00 NOP0x05FA 0xBF00 NOP;Spera.mpas, 110 :: nop;nop;0x05FC 0xBF00 NOP0x05FE 0xBF00 NOP;Spera.mpas, 111 :: nop;nop;0x0600 0xBF00 NOP0x0602 0xBF00 NOP;Spera.mpas, 112 :: nop;nop;0x0604 0xBF00 NOP0x0606 0xBF00 NOP;Spera.mpas, 113 :: end;0x0608 0xE7F0 B L__main2;Spera.mpas, 114 :: end.L_end_main:L__main_end_loop:0x060A 0xE7FE B L__main_end_loop; end of _maincode, second test, 4.2mAbegin while true do // 4.2 mA begin nop; nop;nop; nop;nop; nop;nop; nop;nop; nop;nop; nop;nop; nop;nop; end;end.ASM:_main:;Spera.mpas, 102 :: begin0x05DC 0xF7FFFE4C BL 6320x05E0 0xF7FFFE22 BL 5520x05E4 0xF000F814 BL 15520x05E8 0xF7FFFE34 BL 596;Spera.mpas, 103 :: while true do // 4.2 mAL__main2:;Spera.mpas, 105 :: nop;0x05EC 0xBF00 NOP;Spera.mpas, 106 :: nop;nop;0x05EE 0xBF00 NOP0x05F0 0xBF00 NOP;Spera.mpas, 107 :: nop;nop;0x05F2 0xBF00 NOP0x05F4 0xBF00 NOP;Spera.mpas, 108 :: nop;nop;0x05F6 0xBF00 NOP0x05F8 0xBF00 NOP;Spera.mpas, 109 :: nop;nop;0x05FA 0xBF00 NOP0x05FC 0xBF00 NOP;Spera.mpas, 110 :: nop;nop;0x05FE 0xBF00 NOP0x0600 0xBF00 NOP;Spera.mpas, 111 :: nop;nop;0x0602 0xBF00 NOP0x0604 0xBF00 NOP;Spera.mpas, 112 :: nop;nop;0x0606 0xBF00 NOP0x0608 0xBF00 NOP;Spera.mpas, 113 :: end;0x060A 0xE7EF B L__main2;Spera.mpas, 114 :: end.L_end_main:L__main_end_loop:0x060C 0xE7FE B L__main_end_loopThanks in advance.Best regards,Florin.2015-12-23 04:45 AM
The flash lines are quite wide, do you see the same variability if you run from SRAM?
Do you configure the flash, wait states, and prefetch before running this code?2015-12-23 12:30 PM
Thanks for reply.
I investigate more and seems to be a problem with BRANCH (B) instruction.If instruction are in sector0, depending of the instruction address (position on flash), the current consumption will grow...I moved all the code, to start from sector1 and problem disappear...Maybe ST team can investigate more.Thanks.2015-12-23 04:43 PM
Maybe ST team can investigate more.
For that kind of thing to happen you'll have to provide significantly more complete test cases rather expect them to recreate your exact conditions. Understand this is a User Forum, ST does not heavily participate here, so you might do better discussing your issue directly with an FAE.