Get STM32 blue pill to run



  • I struggle since 2 days to get a node based on STM32 to run. It is my first test with STM32. I installed the arduino libs. I can upload "blink" and this works, serial output also.
    But when I include <MySensors.h> the STM seems not to start/run. LED doesn't blink, no output on serial. I would expect some some lib prints on serial, but nothing.
    Compile and upload is with no error.
    It doesn't matter if radio is connected or not.
    Any special things need to be considered for STM32?

    #define MY_DEBUG            //MYSENSOR Lib
    
    #define   MY_TRANSPORT_WAIT_READY_MS   100
    
    #define MY_NODE_ID 49 // id of the node
    //#define MY_PARENT_NODE_ID 55
    //#define MY_PARENT_NODE_IS_STATIC
    
    
    
    // ++++++++++++++ NRF24 +++++++++++++++++
    #define MY_RADIO_NRF24
    
    // This is needed if you use an STM32 board:
    #define MY_RF24_CE_PIN PB0
    
    
    #define MY_DEBUGDEVICE Serial1
    
    #include "MySensors.h"
    #include <SPI.h>
    
    
    /////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ///////////////////////////////// BEFORE ////////////////////////////////////////////////////////////////////
    /////////////////////////////////////////////////////////////////////////////////////////////////////////////
    
    void before()
    {
      Serial1.begin(115200);
      Serial1.print("before");
    }
    
    /////////////////////////////////////////////////////////////////////////////////////////////////////////////
    /////////////////////////////////////// SETUP ///////////////////////////////////////////////////////////////
    /////////////////////////////////////////////////////////////////////////////////////////////////////////////
    
    void setup()
    {
      Serial1.begin(115200);
      Serial1.print("setup");
      
      pinMode(PC13, OUTPUT);
    }
    
    /////////////////////////////////////////////////////////////////////////////////////////////////////////////
    /////////////////////////////////////// LOOP ////////////////////////////////////////////////////////////////
    /////////////////////////////////////////////////////////////////////////////////////////////////////////////
    
    void loop()
    {
    
      digitalWrite(PC13, HIGH);   // turn the LED on (HIGH is the voltage level)
      delay(1000);              // wait for a second
      digitalWrite(PC13, LOW);    // turn the LED off by making the voltage LOW
      delay(1000);              // wait for a second
    
    
    }
    


  • Hi,
    I wasn't aware of a MY_DEBUGDEVICE, so I was courious and found this thread:
    https://forum.mysensors.org/topic/9381/no-my_debugdevice-begin
    It basically says you should add MY_DEBUGDEVICE.begin ( baud ) in preHwInit(), then wait until ready...



  • This helped a lot! Got the serial to work. But...

    13:29:37.828 ->  __  __       ____
    13:29:37.828 -> |  \/  |_   _/ ___|  ___ _ __  ___  ___  _ __ ___
    13:29:37.862 -> | |\/| | | | \___ \ / _ \ `_ \/ __|/ _ \| `__/ __|
    13:29:37.862 -> | |  | | |_| |___| |  __/ | | \__ \  _  | |  \__ \
    13:29:37.862 -> |_|  |_|\__, |____/ \___|_| |_|___/\___/|_|  |___/
    13:29:37.862 ->         |___/                      2.4.0-alpha
    13:29:37.862 -> 
    13:29:37.862 -> 18 MCO:BGN:INIT NODE,CP=RNNNM---,FQ=72,REL=0,VER=2.4.0-alpha
    13:29:37.862 -> 29 !MCO:BGN:HW ERR
    

    Looks like these cheap blue pills have some issue with EEPROM?

    I later connected a Maple Mini board, which goes straight to "loop" as expected.



  • STM32F1, like SAMD, has no EEPROM as far as I know.



  • Yes, no real EERPOM, but emulation in flash. EEPROM failure was the first finding when checking for this error message. Maybe somthing else...
    Now complete sketch is ported from AVR ProMini to STM32 and is runnig fine 👍


Log in to reply
 

Suggested Topics

  • 87
  • 5
  • 7
  • 10
  • 8
  • 2

60
Online

11.4k
Users

11.1k
Topics

112.7k
Posts