Skip to content
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. General Discussion
  3. STM32?
  • Getting Started
  • Controller
  • Build
  • Hardware
  • Download/API
  • Forum
  • Store

STM32?

Scheduled Pinned Locked Moved General Discussion
82 Posts 19 Posters 34.4k Views 19 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • gohanG gohan

    but for a battery powered sleeping node it is better a mini pro that hasn't the usb chip that drains power, right?

    V Offline
    V Offline
    VaZso
    wrote on last edited by VaZso
    #15

    @gohan Regarding of battery powered system...

    From STM32CubeMX power consumption calculator, it has the following current requirements:

    In RUN mode:

    • at 72MHz bus frequency, it needs 27 mA
    • at 16MHz and HSI PLL, it needs 6.8 mA
    • at 8 MHz and HSI, it needs 4 mA
    • at 1 MHz and HSI, it needs 900 μA
    • at 125 kHz and HSI, it needs 480 μA

    In STANDBY mode with all clocks off, it needs 2 μA


    In SLEEP mode:

    • at 125 kHz bus frequency and HSI, it needs 410 μA
    • at 1 MHz bus freq. and HSI, it needs 440 uA
    • at 8 MHz, it needs 600 μA

    Enabling the following peripherals, additional consumptions are (as for example):

    • GPIOA needs 833.75 nA
    • GPIOD needs 816.25 nA
    • I2C needs 1.25 μA
    • SPI1 needs 590 nA
    • TIMER1 needs 2.92 μA
    • TIMER2 needs 4.06 μA
    • TIMER4 needs 3.99 μA
    • USART1 needs 1.49 μA
    • USART3 needs 1.53 μA
    • USB needs 2.22 μA
    • Window watchdog needs 312.5 nA
    • Independent watchdog needs 1.71 μA
    • ADC1 needs 162.19 μA

    These are just some examples, not all possibilities and frequencies are listed here...

    There are also lower power STM32 series anyway.

    1 Reply Last reply
    2
    • gohanG Offline
      gohanG Offline
      gohan
      Mod
      wrote on last edited by
      #16

      I'm curious because I saw these boards few months ago but I figured that community support was still in the early stages so I kind of didn't pay much attention to them and I preferred old but tested technology 😁

      1 Reply Last reply
      0
      • alowhumA Offline
        alowhumA Offline
        alowhum
        Plugin Developer
        wrote on last edited by
        #17

        The patch has just been added to the Mysensors Development branch, so it's easier to try out.

        I've created a guide on how to get started on the SMT32Duino forum.

        1 Reply Last reply
        1
        • alowhumA Offline
          alowhumA Offline
          alowhum
          Plugin Developer
          wrote on last edited by
          #18

          Heh, the STM32 doesn't have a digital pin 2 it seems. Where is the NRF supposed to connect to instead?

          mfalkviddM 1 Reply Last reply
          0
          • alowhumA alowhum

            Heh, the STM32 doesn't have a digital pin 2 it seems. Where is the NRF supposed to connect to instead?

            mfalkviddM Online
            mfalkviddM Online
            mfalkvidd
            Mod
            wrote on last edited by
            #19

            @alowhum looks like PA3: https://github.com/mysensors/MySensors/pull/795/commits/ac432acca3d7c58eb7c8f569dc562860605ea09f#diff-58c572256858a37808c4ebd0922b4060R50

            1 Reply Last reply
            0
            • alowhumA Offline
              alowhumA Offline
              alowhum
              Plugin Developer
              wrote on last edited by alowhum
              #20

              That's odd. I thought I had it just figured out. I'm about to test this at the top of a sketch:

              #define MY_RF24_CE_PIN PB0
              #define MY_RF24_CS_PIN PA4
              #define MY_RF24_MOSI_PIN PA7
              #define MY_RF24_MISO_PIN PA6
              #define MY_RF24_SCK_PIN PA5
              #define MY_RF24_IRQ_PIN PB10

              The fun thing is all the pins are almost in a row. Almost. And if the IRQ is A3, then one more pin would line up..

              According to this image the IRQ is pin PB10 though:
              http://wiki.stm32duino.com/images/a/ae/Bluepillpinout.gif

              mfalkviddM 1 Reply Last reply
              0
              • alowhumA alowhum

                That's odd. I thought I had it just figured out. I'm about to test this at the top of a sketch:

                #define MY_RF24_CE_PIN PB0
                #define MY_RF24_CS_PIN PA4
                #define MY_RF24_MOSI_PIN PA7
                #define MY_RF24_MISO_PIN PA6
                #define MY_RF24_SCK_PIN PA5
                #define MY_RF24_IRQ_PIN PB10

                The fun thing is all the pins are almost in a row. Almost. And if the IRQ is A3, then one more pin would line up..

                According to this image the IRQ is pin PB10 though:
                http://wiki.stm32duino.com/images/a/ae/Bluepillpinout.gif

                mfalkviddM Online
                mfalkviddM Online
                mfalkvidd
                Mod
                wrote on last edited by
                #21

                @alowhum sorry I misread your question. Don't know why, but I didn't see that you were talking about the NRF.

                IRQ is not used for the NRF on Arduino, so I supposed it is not used for STM32 either. There is nothing about IRQ in https://github.com/mysensors/MySensors/pull/795/commits/ac432acca3d7c58eb7c8f569dc562860605ea09f#diff-cf14b6301beb3a4dbaded9b95bb190feR487

                1 Reply Last reply
                0
                • alowhumA Offline
                  alowhumA Offline
                  alowhum
                  Plugin Developer
                  wrote on last edited by
                  #22

                  Really? On the Arduino nano I'm always connecting it to pin 2. It says to do so in the guide?

                  Anyway, I haven't been able to get it to work. Perhaps some of the developers van shed some light on how it's supposed to work?

                  tekkaT mfalkviddM 2 Replies Last reply
                  0
                  • tbowmoT Offline
                    tbowmoT Offline
                    tbowmo
                    Admin
                    wrote on last edited by
                    #23

                    @alowhum

                    Its first in recent (develop branch?) that interrupt usage with nRF24L01 have been enabled, and only in certain scenarios.

                    1 Reply Last reply
                    0
                    • alowhumA alowhum

                      Really? On the Arduino nano I'm always connecting it to pin 2. It says to do so in the guide?

                      Anyway, I haven't been able to get it to work. Perhaps some of the developers van shed some light on how it's supposed to work?

                      tekkaT Offline
                      tekkaT Offline
                      tekka
                      Admin
                      wrote on last edited by tekka
                      #24

                      @alowhum The MySensors RF24 driver is a polling driver (unless RX queuing is enabled), hence no IRQ required.

                      I've successfully tested the RF24 radio with this wiring on a BluePill board using MySensors 2.2.0-beta:

                      CLK -> PA5
                      MISO -> PA6
                      MOSI ->PA7
                      CSN -> PA4
                      CE -> PB0

                      do not forget to set:

                      #define MY_RF24_CE_PIN PB0
                      
                      gohanG 1 Reply Last reply
                      0
                      • alowhumA Offline
                        alowhumA Offline
                        alowhum
                        Plugin Developer
                        wrote on last edited by alowhum
                        #25

                        Hmm, that's pretty much what I had.

                        Could you perhaps share your example sketch?

                        // It's working now! Turns out I had to set the radio to low power..

                        tekkaT 1 Reply Last reply
                        0
                        • alowhumA alowhum

                          Really? On the Arduino nano I'm always connecting it to pin 2. It says to do so in the guide?

                          Anyway, I haven't been able to get it to work. Perhaps some of the developers van shed some light on how it's supposed to work?

                          mfalkviddM Online
                          mfalkviddM Online
                          mfalkvidd
                          Mod
                          wrote on last edited by
                          #26

                          @alowhum said in STM32?:

                          Really? On the Arduino nano I'm always connecting it to pin 2. It says to do so in the guide?

                          Well the guide also says "The IRQ is currently not used by the MySensors library so it can be left un-connected."

                          1 Reply Last reply
                          2
                          • alowhumA alowhum

                            Hmm, that's pretty much what I had.

                            Could you perhaps share your example sketch?

                            // It's working now! Turns out I had to set the radio to low power..

                            tekkaT Offline
                            tekkaT Offline
                            tekka
                            Admin
                            wrote on last edited by
                            #27

                            @alowhum Perfect!

                            1 Reply Last reply
                            1
                            • PhracturedBlueP Offline
                              PhracturedBlueP Offline
                              PhracturedBlue
                              wrote on last edited by
                              #28

                              FYI, I didn't check the work done by tekka, but I didn't file a pull request for my 'sleep' code. I have support for using low power mode (reduce current from ~40mA to 4mA during sleep) but I had issues with reliable wakeup, so I've just switched my code to all using delay loops.

                              Initially I was using these boards for my sensors, but there is very little benefit compared to a 3.,3V pro-mini for my usage cases, and the power is 10x more when running (and 100x more when idle without my sleep patches that don't work)

                              I don't have any sensors that need the extra horsepower of the STM32 personally. The one benefit I did realize is having a USB serial port which removes the need for USB->TTL.

                              F 1 Reply Last reply
                              0
                              • F Offline
                                F Offline
                                freynder
                                wrote on last edited by freynder
                                #29

                                Exactly what I was looking for, thank you!

                                I can't seem to get it to work though. I'll report my findings here in case it helps:

                                Platforms tested: platformio and arduino ide, I mainly use platformio
                                Hardware: blue pill with RFM69HW connected like this:
                                NSS <-> PA4
                                MOSI <-> PA7
                                MISO <-> PA6
                                SCK <-> PA5
                                DIO0 <-> PA3

                                Issues encountered:

                                1. undeclared values while compiling. I used the following workaround:
                                // Workaround for STM32 support
                                #define ADC_CR2_TSVREFE  (1 << 23) // from libopencm3
                                #define digitalPinToInterrupt(x) (x)
                                
                                1. examples/SecurityPersonalizer does not seem to work. I use it to write the AES encryption key to EEPROM. However, I do not see any output when running the sketch. As a workaround I created a minimal sketch to write the key to EEPROM which seemed to work.
                                  Update: Looks like I was using an old sketch. Works correctly with updated sketch.

                                2. stm32 sensor is unable to connect to gateway:

                                22898 TSM:FAIL:RE-INIT
                                22898 TSM:INIT
                                22900 TSM:INIT:TSP OK
                                22901 TSM:FPAR
                                24120 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
                                26121 !TSM:FPAR:NO REPLY
                                
                                F 1 Reply Last reply
                                0
                                • F freynder

                                  Exactly what I was looking for, thank you!

                                  I can't seem to get it to work though. I'll report my findings here in case it helps:

                                  Platforms tested: platformio and arduino ide, I mainly use platformio
                                  Hardware: blue pill with RFM69HW connected like this:
                                  NSS <-> PA4
                                  MOSI <-> PA7
                                  MISO <-> PA6
                                  SCK <-> PA5
                                  DIO0 <-> PA3

                                  Issues encountered:

                                  1. undeclared values while compiling. I used the following workaround:
                                  // Workaround for STM32 support
                                  #define ADC_CR2_TSVREFE  (1 << 23) // from libopencm3
                                  #define digitalPinToInterrupt(x) (x)
                                  
                                  1. examples/SecurityPersonalizer does not seem to work. I use it to write the AES encryption key to EEPROM. However, I do not see any output when running the sketch. As a workaround I created a minimal sketch to write the key to EEPROM which seemed to work.
                                    Update: Looks like I was using an old sketch. Works correctly with updated sketch.

                                  2. stm32 sensor is unable to connect to gateway:

                                  22898 TSM:FAIL:RE-INIT
                                  22898 TSM:INIT
                                  22900 TSM:INIT:TSP OK
                                  22901 TSM:FPAR
                                  24120 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
                                  26121 !TSM:FPAR:NO REPLY
                                  
                                  F Offline
                                  F Offline
                                  freynder
                                  wrote on last edited by
                                  #30

                                  @freynder said in STM32?:

                                  stm32 sensor is unable to connect to gateway:

                                  After further testing, this seems to work now. I'm not exactly sure why unfortunately. I'm now using the new RFM69 library. I noticed that communication seems to fail after uploading the sketch over stlink, even when clicking the reset button. When disconnecting/reconnecting the usb power all works well. Maybe that was the issue previously as well.

                                  F 1 Reply Last reply
                                  0
                                  • PhracturedBlueP PhracturedBlue

                                    FYI, I didn't check the work done by tekka, but I didn't file a pull request for my 'sleep' code. I have support for using low power mode (reduce current from ~40mA to 4mA during sleep) but I had issues with reliable wakeup, so I've just switched my code to all using delay loops.

                                    Initially I was using these boards for my sensors, but there is very little benefit compared to a 3.,3V pro-mini for my usage cases, and the power is 10x more when running (and 100x more when idle without my sleep patches that don't work)

                                    I don't have any sensors that need the extra horsepower of the STM32 personally. The one benefit I did realize is having a USB serial port which removes the need for USB->TTL.

                                    F Offline
                                    F Offline
                                    freynder
                                    wrote on last edited by
                                    #31

                                    @PhracturedBlue What hardware were you using? Did it include a power led and voltage regulator? According to http://www.stm32duino.com/viewtopic.php?f=3&t=658&start=40 it should be possible to put the Blue Pill in stop mode using 13µA while sleeping when eliminating these.

                                    I'm also interested in using the blue pill for the included RTC to periodically send data (RSSI, battery level, etc). I understand that with the current MySensors API this is not supported. E.g. combining a 24 hour sleep with a light switch: when the light switch is triggered, the 24 hour sleep is interrupted and starts again from scratch, so it is impossible to combine external interrupts with time interrupts, unless I am missing something. I am hoping RTC alarms could provide a solution here.

                                    1 Reply Last reply
                                    0
                                    • tekkaT tekka

                                      @alowhum The MySensors RF24 driver is a polling driver (unless RX queuing is enabled), hence no IRQ required.

                                      I've successfully tested the RF24 radio with this wiring on a BluePill board using MySensors 2.2.0-beta:

                                      CLK -> PA5
                                      MISO -> PA6
                                      MOSI ->PA7
                                      CSN -> PA4
                                      CE -> PB0

                                      do not forget to set:

                                      #define MY_RF24_CE_PIN PB0
                                      
                                      gohanG Offline
                                      gohanG Offline
                                      gohan
                                      Mod
                                      wrote on last edited by gohan
                                      #32

                                      @tekka do you think stm32 is sufficiently stable running mysensors or should I stick to the "old" pro mini for battery powered sensors? (Also considering the ota updates support)

                                      F tekkaT 2 Replies Last reply
                                      0
                                      • gohanG gohan

                                        @tekka do you think stm32 is sufficiently stable running mysensors or should I stick to the "old" pro mini for battery powered sensors? (Also considering the ota updates support)

                                        F Offline
                                        F Offline
                                        freynder
                                        wrote on last edited by
                                        #33

                                        @gohan There is no support yet for sleep, so battery powered out of the box will not work. I've been testing custom sleep function (STOP mode, external interrupts) and so far was able to run a blue pill + RFM69 with MySensors between 0.01 and 0.20 mA (inconsistent results, not sure yet why). A sketch with just blue pill ran consistently at 0.01 mA. Unfortunately my multimeter does not allow more accurate measurements.

                                        1 Reply Last reply
                                        1
                                        • gohanG gohan

                                          @tekka do you think stm32 is sufficiently stable running mysensors or should I stick to the "old" pro mini for battery powered sensors? (Also considering the ota updates support)

                                          tekkaT Offline
                                          tekkaT Offline
                                          tekka
                                          Admin
                                          wrote on last edited by
                                          #34

                                          @gohan As @freynder pointed out, sleeping and low power modes are currently not implemented - if you do not need the higher speed & additional features that come along with the stm32 I'd stick (for the moment) to at328p for battery-powered sensors.

                                          1 Reply Last reply
                                          1
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          8

                                          Online

                                          11.7k

                                          Users

                                          11.2k

                                          Topics

                                          113.0k

                                          Posts


                                          Copyright 2019 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • OpenHardware.io
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular