Add uStepper S board

If it is possible, I would like to add the uStepper S board to PlatformIO.
I found this thread [How do I set up PlatformIO to use a 'uStepper'?]
It is a bit old.
Is there a better, newer, smarter way to do it ?

Thanks in advance.
Jens.

No, you still have to download their Arduino core (as listed here, ustepper_hardware_2.2.2.zip), copy the variants/ustepperS folder into your C:\Users\<user>\.platformio\packages\framework-arduino-avr\variants folder, and use the board JSON file you already linked above, but use "variant": "ustepperS" instead (if your board is the uStepper S instead of uStepper).

I do something wrong with the .json file !!!
I got this error:
Could not load boards list
PIO Core Call Error: " Error: Please specify name, url and vendor fields for C:\Users\JJ\.platformio\platforms\atmelavr\boards\uStepper.json"

I have copied the text in the linked .json file, pasted it into Notepad and saved it as uStepper.json

Removed the first line in the file, my file now look like this:

{
   "build": {
        "core": "arduino",
        "extra_flags": "-DARDUINO_ARCH_AVR -DAVR_USTEPPER",
        "f_cpu": "16000000L",
        "mcu": "atmega328pb",
        "variant": "ustepperS"
    },
    "frameworks": ["arduino"],
    "name": "uStepper",
    "platform": "atmelavr",
    "upload": {
        "maximum_ram_size": 2048,
        "maximum_size": 32256,
        "protocol": "arduino",
        "require_upload_port" : true,
        "speed": 115200
    },
    "url": "https://www.ustepper.com",
    "vendor": "uStepper"
}

Now I can select the board.

I then copy the Continous example to the main.cpp, but an error pops up:
uStepperS.h uStepper_Test1 * .pio\libdeps\ustepper\uStepper S\src
#error directive: !!This library only supports the uStepper S board!!

Has anyone some experience on how to get the uStepper S boards running on PlatformIO ?

Thanks in advance.
Jens

You need the identifying macro too…

"extra_flags": "-DARDUINO_ARCH_AVR -DAVR_USTEPPER_S",

Don’t make any difference.
I tryed to make a new project:
The platformio.ini look like this:
[env:ustepper]
platform = atmelavr
board = ustepper
framework = arduino

lib_deps =
ustepper/uStepper S @ ^2.3.0

In the main.cpp I only added #include <uStepperS.h> and the error “This library only supports uStepper S board” pops up. Like the compiler thinks I’m running a uStepper and not the uStepper S version.

My bad, didn’t look into the platform.txt, the macro there must be prependet with ARDUINO_, so -DARDUINO_AVR_USTEPPER_S.

You can also take advantage of the build script capability to set a custom folder location for the variant, so no copying of the uStepperS folder into PlatformIO-internal package folders is needed.

Working ref project: GitHub - maxgerhardt/pio-usteppers: uStepper-S Demo with PlatformIO

I think it is working now.
I deleted the hole project, and started a new one.
I made a small change to the .json file, it now look like this:

{    
            "build": {
            "core": "arduino",
            "extra_flags": "-DARDUINO_ARCH_AVR -DARDUINO_AVR_USTEPPER_S",
            "f_cpu": "16000000L",
            "mcu": "atmega328pb",
            "variant": "ustepperS"
        },
        "frameworks": ["arduino"],
        "name": "uStepper",
        "platform": "atmelavr",
        "upload": {
            "maximum_ram_size": 2048,
            "maximum_size": 32256,
            "protocol": "arduino",
            "require_upload_port" : true,
            "speed": 115200
        },
        "url": "https://www.ustepper.com",
        "vendor": "uStepper" 
 }

One of the other errors I had was because of a missing #include <EEPROM.h>

Yes, this is the critical part that makes it work.

Hi Max.
But you have made a file for the hole package of uSteppers, that is really GREAT.
I will copy it to my libraries.
Thanks for your great help, without I would never had a chance to get it working.
I’m impressed by your overview.
Does PlatformIO have a support link ?
Thanks
Jens.

There is https://platformio.org/donate, but I’m not PlatformIO staff, just a volunteer :slight_smile: