OTE with W5500 and Blue/Blackpill

Hi
I've been experimenting with updating my server code OTE but have had little success.
I have a W5500 adapter and Blue/Blackpills available.

I have the basic server code (without OTE updating) running nicely on a Nucleo 64 STM32F401 and am now attempting to port it over to a Bluepill - I have some Blackpills coming as I suspect the Bluepill 32k of flash isn't enough to support even the most basic of OTE / server,

I know how to load blinky using my ST-Link/V2 programmer and I expect to use that to load my OTE code in the target 'pill' - although currently I'm a little confused about boot loaders and usb port on the pill.

I've tried Juraj's most excellenent libraries and they worked great for OTE on my Mega2560. However in 'myboards' I don't see an option for the Blackpill F411.

I've googled but not found a solution - maybe someone here can point me in the right direction for an example or starting opoint ?

Thanks Tim

After a bit more searching I came across this thread
which got me going and can now see an IP being allocated.
Still need to make sure it's working ok and have the boot jumpers on the right place etc., but at least it now has a 'pulse'.

ArduinoOTA works with BlackPill without special a my_boards variant.
https://github.com/JAndrassy/ArduinoOTA#installation

For Uno R4, RP2040, nRF5 and STM32 boards, platform.local.txt from extras folder has to be copied into boards package installation folder.

Hi Juraj

thanks for taking the time to reply - much appreciated.

I have a simple websever with OTE running ok, but am having a problem finding where to place your new platform.local.txt file.

I'm running windows 10 and I have two versions of the IDE installed 1.8 and 2.2 but now only use 2.2 which starts in C:\Users\tim\AppData\Local\Programs\arduino-ide\ with "C:\Users\tim\AppData\Local\Programs\arduino-ide\Arduino IDE.exe" but doesn't have a packages folder. So I'm not sure where version looks for its folders etc.

Any ideas ?

Thanks Tim

Where version 1.8 starts in "C:\Program Files (x86)\Arduino\arduino.exe" and holds all the usual IDE folders

Everything works fine for the mega2560 version of the code - including OTE updates with password

in IDE 1, open Preferences and there open the preferences.txt file. It is next to packages folder

Hi, thanks for the quick reply and sorry for being a pest but still not sure where to insert the platform.local.txt file / information.

One quick question to clarify.....

Under users/tim/appdata/local/Arduino15 I see folders for :
cache
libraries
logs
packages
staging
temp

along with files for:

preferences.txt

and others.

Question, should I add platform.local.txt here alongside preferences.txt or embed the contents of it within preferences.txt ?

Regards Tim

Edit

I suspect the above is related to Vewrsion 1.8 of the ide and not 2.2 so I figure I need to find where IDE 2.2 is drawing its in formation from

the packages are shared. both IDE use them.

on Windows it is
C:\Users\juraj\AppData\Local\Arduino15\packages\STM32\hardware\stm32\1.9.0

Ok, Ive done as suggested above and also added an entry into programmers.txt - but the board still does not show as a programming port - whereas my Mega2560 does.

Using Wireshark I can see my Mega2560 doing its MDNS thing but the bluepill doesn't appear to be advertising its port using MDNS. Maybe I have a library issue ?

Edit it is doing MSDS, just not very often

Here's the code I'm using - I flash a LED to make sure it's running and to detect if it's been updated as I chnaged the speed of the flash.

// generic stm32F1 series
#include <SPI.h>
#include <Ethernet.h>
//#define NO_OTA_PORT
#include <ArduinoOTA.h>

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xBB, 0x06 };

int reqCount = 0;                // number of requests received

EthernetServer server(80);

void setup() {
  //Initialize serial:
  Serial.begin(9600);
  while (!Serial);

  // start the Ethernet connection:
  Serial.println("Initialize Ethernet with DHCP:");
  if (Ethernet.begin(mac) == 0) {
    Serial.println("Failed to configure Ethernet using DHCP");
  } else {
    Serial.print("  DHCP assigned IP ");
    Serial.println(Ethernet.localIP());
  }

  // start the OTEthernet library with internal (flash) based storage
  ArduinoOTA.begin(Ethernet.localIP(), "Arduino", "password", InternalStorage);

  pinMode(LED_BUILTIN, OUTPUT);
}

void loop() {
  // check for updates
  ArduinoOTA.poll();

 digitalWrite(LED_BUILTIN, HIGH);  // turn the LED on (HIGH is the voltage level)
  delay(1000);                      // wait for a second
  digitalWrite(LED_BUILTIN, LOW);   // turn the LED off by making the voltage LOW
  delay(1000);                      // wait for a second

  // add your normal loop code below ...

  EthernetClient client = server.available();

  if (client)
  {
    Serial.println(F("New client"));
    // an http request ends with a blank line
    bool currentLineIsBlank = true;

    while (client.connected())
    {
      if (client.available())
      {
        char c = client.read();
        
        if (c == '\n' && currentLineIsBlank)
        {
          Serial.println(F("Sending response"));

          
          client.print(
            "HTTP/1.1 200 OK\r\n"
            "Content-Type: text/html\r\n"
            "Connection: close\r\n"  // the connection will be closed after completion of the response
            "Refresh: 20\r\n"        // refresh the page automatically every 20 sec
            "\r\n");
          client.print("<!DOCTYPE HTML>\r\n");
          client.print("<html>\r\n");
          client.print("<h2>Hello World from ");
          client.print(BOARD_NAME);
          client.print("!</h2>\r\n");
          client.print("Requests received: ");
          client.print(++reqCount);
          client.print("<br>\r\n");
          client.print("Analog input A0: ");
          client.print(analogRead(0));
          client.print("<br>\r\n");
          client.print("</html>\r\n");
          break;
        }

        if (c == '\n')
        {
          // you're starting a new line
          currentLineIsBlank = true;
        }
        else if (c != '\r')
        {
          // you've gotten a character on the current line
          currentLineIsBlank = false;
        }
      }
    }

    // give the web browser time to receive the data
    delay(10);

    // close the connection:
    client.stop();
    Serial.println(F("Client disconnected"));
  }
} 

for programmer.ttx reload, IDE 1 needs restart.
in IDE 2 the programmers.txt is cached forever. stop the IDE and delete .arduinoIDE in your home folder

Thanks again -

I did as you suggested, but still no port showing for the Bluepill within the IDE - but I do see ports for my other ota devices (two atmega2560 and a ESP8266 wifi node)

I've obviously messed up, interestingly when I do an IP scan the bluepill shows as having a HTTP server available (which works fine) but the other OTA devices which also run servers do not show as being available even though they work fine.

I'll work on this little more by myself and report back if I manage to sort it out.

programmers adds a programmer. it doesn't help with network port

Thanks for that info - I've disabled the serial port just for good measure and when I came to upload the code it asked for a password for the first time before uploading via ST-link but still no port showing in the ide.

I think I'll start over tomorrow with a brand new blackpill having deleted the .ide in my home directory first.

I guess you've probably got more important stuff to do than helping a newbie like me, so only asking as a last resort - enjoy your coffee :wink:

Regards Tim

Just to close this off - I started a fresh and rebuilt the code making sure it was aimed at the right board and since then everything has been fine !
Thanks Juraj for your time and great libraries !

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.