Topics

naive beginner question - How to compile OnStep on Arduino IDE


Dan Sawyer
 

This is a naive beginner question. I am in the process of building a STM32 based onstep. I have some experience using Arduino IDE and have loaded the onstep extensions and STM32 shows up in available H/W options.

The question is: How do I test compile the onstep software? I am using LInux and have the following files loaded:

Arduino-Libs-master/  Arduino-Libs-master.zip  linux-tools/ linux-tools.tar.gz  OnStep-release-2.22  OnStep-release-2.22.zip

My first question is: How do I load and compile 2.22 in Arduino IDE?

I apologize for the simplicity of this question.

Dan


Khalid Baheyeldin
 

On Sun, Dec 15, 2019 at 11:57 AM, Dan Sawyer wrote:
My first question is: How do I load and compile 2.22 in Arduino IDE?
Did you read the Wiki, particularly this and this ?


Dan Sawyer
 

Thank you. That was a help. I am now stuck on HAL_STM32F1.h finding digitalWriteFast.h, see error below. This file is in the Arduino-Libs-master.zip file. I unzipped the file and tried every which way I could to have IDE find it. I tried including the zip as a library but it said it was not a valid library fie. (are .h file libraries or simply includes? ) I tried copying digitalWriteFast.h into the directories where HAL was located but that did not work. I am probably missing context regarding IDE sketch library and path scope. 
Arduino: 1.8.5 (Linux), Board: "Generic STM32F103C series, STM32F103C8 (20k RAM. 64k Flash), STM32duino bootloader, 72Mhz (Normal), Smallest (default)"
 
In file included from sketch/src/HAL/HAL.h:56:0,
                 from /home/dan/My_Documents/telescope/onstep/OnStep/OnStep.ino:54:
sketch/src/HAL/HAL_STM32F1/HAL_STM32F1.h:15:30: fatal error: digitalWriteFast.h: No such file or directory
 #include <digitalWriteFast.h>
                              ^
compilation terminated.
exit status 1
Error compiling for board Generic STM32F103C series.
 
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
 


Khalid Baheyeldin
 

In the second link I sent you, there is a section titled: Installing Arduino IDE.
At the end of that section, there are instructions and links on how to get digitalWriteFast.


Dan Sawyer
 

Thank you again. The issue was a copying issue. I copied the whole directory instead of the single digitalWriteFast directory. 

OnStep now compiles, however it is getting an image too large error. I used the online configuration tool to generate the Config file. 

Arduino: 1.8.5 (Linux), Board: "Generic STM32F103C series, STM32F103C8 (20k RAM. 64k Flash), STM32duino bootloader, 72Mhz (Normal), Smallest (default)"
Sketch uses 117960 bytes (179%) of program storage space. Maximum is 65536 bytes. 
Global variables use 13160 bytes (64%) of dynamic memory, leaving 7320 bytes for local variables. Maximum is 20480 bytes.
Sketch too big; see http://www.arduino.cc/en/Guide/Troubleshooting#size for tips on reducing it.
Error compiling for board Generic STM32F103C series.
 
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
 


Khalid Baheyeldin
 

On Sun, Dec 15, 2019 at 07:42 PM, Dan Sawyer wrote:
Sketch uses 117960 bytes (179%) of program storage space. Maximum is 65536 bytes. 
This is covered in the documentation too, second link.

Please read the second link under "Flashing OnStep to the STM32"


Dan Sawyer
 

Thank you. The instructions now make sense:

Use the following parameters when flashing OnStep to the board:
     Board: Generic STM32F103C8
     Variant: STM32F103CB (20K RAM, 128K Flash)
     Upload method: Serial

I apologize for my slowness; I appreciate the patience. The hardware kit is due to arrive tomorrow. That will be a whole new endeavor. 


gvpaddy@...
 

I (too) am trying this loading into an arduino board first time. Got the OnStep code unzipped into my windows folder, renamed the folder to OnStep. Updated config.h. Now flashing/uploading the Onstep into the board, few naive questions:

- Connect the MKS L gen board into Arduino. Configure the board through board manager.
- Then I chose Onstep file from my folder in the IDE. It opened many tabs; one of them was OnStep
- Then I did Upload. After a min it said upload done.

Naive questions:
- Is this all done now ?
- Should I upload every file (tab) that was opened when I opened the OnStep or are they all dependent ones, so automatically everything got uploaded into the board ?

The wiki 'Uploading Firmware' shows below; the last step says <<You can now upload the firmware using the button on the Arduino IDE toolbar.>>. This could be expanded to say how do we do this in the IDE and whether we need to choose one file/all files, etc., for beginners like me:

Uploading the Firmware

After you have done the above, proceed with the configuration:

  • In the Arduino IDE select the correct serial port and board.
    • For a Teensy3.2 I select 72MHz operation though this isn't required.
    • For any Teensy3.x I select Optimize: "Faster".
    • For a STM32 Blue Pill I select the STM32F103C, Optimize "Smallest", and Variant: "128KB". Upload method must be "Serial".
    • For a ESP32S (MaxESP2/3) I select the ESP32 Dev Module with its default settings.
    • For a Mega2560 simply select the board with its default settings.
  • You can now upload the firmware using the button on the Arduino IDE toolbar.


Khalid Baheyeldin
 

On Sat, Sep 12, 2020 at 11:30 AM, <gvpaddy@...> wrote:
Naive questions:
- Is this all done now ?
Yes. That is all you need to do.

- Should I upload every file (tab) that was opened when I opened the OnStep or are they all dependent ones, so automatically everything got uploaded into the board ?
No. You should not do any of that.

Now to verify that your board already has OnStep on it, open Serial Monitor in the Arduino IDE, set the baud to 9600, then enter the following:

:GU#

If you get a response, OnStep is already working on your board, and responding to commands.


gvpaddy@...
 

Thanks a lot. The response was nNpHz/Eo260#. Hope this is fine.

Thanks and Regards.


Khalid Baheyeldin
 

On Sat, Sep 12, 2020 at 12:11 PM, <gvpaddy@...> wrote:
Thanks a lot. The response was nNpHz/Eo260#. Hope this is fine.
Yes, that is perfectly fine.
Working as expected.


gvpaddy@...
 

Thanks Khalid. Now to the most interesting and crucial part of next steps:

I have MKS Gen v2.1, which I would like to connect to 2 TMC2130 drivers, which will then connect to the 2 NEMA17 motors for RA and DEC.

Is there a wiring/connection diagram for this configuration ?

In the WIKI I see the pinmap for MKS Gen V2.0; I guess I need to plug the 2 TMC2130 drivers into the  pin slots above  XUART and YUART for Axis1 (RA) and Axis2 (DEC). But not sure about which direction/what pins in the driver go to which slot. There are 4 pins facing upward in the TMC2130 - are those the ones that go to stepper motor ? 

Any help please..

Thanks and Regards


Khalid Baheyeldin
 

I don't use an MKS Gen-L myself, but I understand that for v2, you just plug the
drivers into the X and Y motor slots, and set the jumpers underneath them for
SPI mode (per MKS Gen-L wiki).

If the driver pins have a black side and coloured side, then the black is towards
the motor pins.

Hopefully someone who uses the Gen-L can reply with more info.