STM32F103RCT6 on li-ion for a week
Posted: Sat Apr 11, 2020 12:46 pm
Hello, this is my first post here.
I was using the arduino mega until recently but want to switch to the STM32F103RC because of the 5 serial ports.
The project has to run on li-ion 18650 cell for a week, so I have to reduce the clock from 72MHz down to 8MHz.
I have found that in the \stm32duino\hardware\STM32F1\2020.3.13\boards.txt file, if I edit the line 607 so it becomes:
"genericSTM32F103R.menu.cpu_speed.speed_48mhz.build.f_cpu=16000000L" instead of
"genericSTM32F103R.menu.cpu_speed.speed_48mhz.build.f_cpu=48000000L"
The MCU clock is changed to 16MHz and current consumption for a simple blinky sketch drops from 44mA at 72MHz to 17mA at 16MHz.
But still the 17mA is too much because I have other sensors that are powered by the same li-ion cell and I need to further reduce the MCU clock.
However. In the datasheet, the PLL multiplier cannot be set lower than 2, so if the external crystal is 8MHz, then with the current external crystal, the minimum frequency is 16MHz.
The question is, if I replace the external crystal with a 4MHz one, what files do I need to modify in the stm32duino folder to tell the IDE that the frequency is 8MHz now, so all the timings are correct?
I was using the arduino mega until recently but want to switch to the STM32F103RC because of the 5 serial ports.
The project has to run on li-ion 18650 cell for a week, so I have to reduce the clock from 72MHz down to 8MHz.
I have found that in the \stm32duino\hardware\STM32F1\2020.3.13\boards.txt file, if I edit the line 607 so it becomes:
"genericSTM32F103R.menu.cpu_speed.speed_48mhz.build.f_cpu=16000000L" instead of
"genericSTM32F103R.menu.cpu_speed.speed_48mhz.build.f_cpu=48000000L"
The MCU clock is changed to 16MHz and current consumption for a simple blinky sketch drops from 44mA at 72MHz to 17mA at 16MHz.
But still the 17mA is too much because I have other sensors that are powered by the same li-ion cell and I need to further reduce the MCU clock.
However. In the datasheet, the PLL multiplier cannot be set lower than 2, so if the external crystal is 8MHz, then with the current external crystal, the minimum frequency is 16MHz.
The question is, if I replace the external crystal with a 4MHz one, what files do I need to modify in the stm32duino folder to tell the IDE that the frequency is 8MHz now, so all the timings are correct?