Skip to content

I would like PIO support. #70

@nopnop2002

Description

@nopnop2002

My Envitonment

STM32F103(8MHz Xtal) + platformIO

Platform Manager
================
Platform ststm32
--------
Checking platformio/ststm32                   15.2.0                             [Up-to-date]
Checking platformio/toolchain-gccarmnoneeabi  1.70201.0 @ >=1.60301.0,<1.80000.0 [Up-to-date]
Checking platformio/framework-arduinoststm32  4.20100.211028 @ ~4.20100.0        [Up-to-date]
Checking platformio/framework-arduinoststm32-maple 3.10000.201129 @ ~3.10000.0        [Up-to-date]
Checking platformio/tool-stm32duino           1.0.1 @ ~1.0.1                     [Up-to-date]
Checking platformio/tool-openocd              2.1100.211028 @ ~2.1100.0          [Up-to-date]
Checking platformio/tool-dfuutil              1.9.200310 @ ~1.9.190708           [Up-to-date]

My config

[platformio]
default_envs = blackpill_f103c8

[env:blackpill_f103c8]
platform = ststm32
board = blackpill_f103c8
framework = arduino
lib_deps =
  https://github.com/stm32duino/STM32LowPower
  https://github.com/stm32duino/STM32RTC

My code

#include <Arduino.h>
#include "STM32LowPower.h"

void setup() {
  LowPower.begin();
  Serial.begin(115200);
  Serial.println("serial (same as 1)");
  Serial.println("*****");
}

void loop() {
  unsigned long nowMillis = millis();
  Serial.println(nowMillis);
  Serial.println("serial printing");
  Serial.flush();
  for(int i=0;i<20;i++) LowPower.deepSleep(1000);
  //for(int i=0;i<10;i++) LowPower.sleep(1000);
  //for(int i=0;i<5;i++) LowPower.idle(1000);
  //delay(1000);
}

Problem

My understanding is that the above code sleeps 1000ms 20 times.

However, it actually sleeps only 250 milliseconds.
Standard output scrolls up at a high speed.

Is the frequency of the crystal involved?

Screen Shot

LowPower-2

Metadata

Metadata

Assignees

No one assigned

    Labels

    invalidThis doesn't seem right

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions