SparkCore Programming with Arduino IDE

Hello,
I am just starting with the Spark Core but I would like to program it via Arduino IDE. If I have not understood bad it is not possible. I have tried to do a sketch, put the device in dfu mode but in my laptop (windows 8.1) the driver seems not being installed properly because it appears with exclamation mark.

I have tried with the BUILD option in the spark cloud website but I cannot claim my node (I have tried putting my device ID) but it says “could not claim the core”. I received the device ID using PUTTY and writting “i”

How I can download my own sketches??

Please tell us more about your problem.

Like is it a new core and what colours are shown on the LED when you are connecting it to WiFi?

Arduino IDE cannot be used to program the :spark: core. You can use the WEB IDE or compile locally.

1 Like

The arduino IDE is currently not working with the :spark: as far as I know. There is however a nice tutorial for setting up Netbeans https://community.spark.io/t/how-to-video-for-compiling-locally-in-windows/2457

Here is a tutorial for installing the DFU drivers: https://community.spark.io/t/tutorial-installing-dfu-driver-on-windows/3518 which you might find useful if you’re planning on compiling/flashing locally.

Over here you can find more information about the CLI interface: https://github.com/spark/spark-cli/

How did you activate your Core, did you connect it using the spark app?

2 Likes

The problem was I had two accounts and with the Android phone I had the device associated to one account and when I try tu develop the Firmware I was using other account :frowning:

Now I can develop the code, and I have discovered how to add libraries to my code.

I have tested the Blink example and it works perfect!! Thank you very much.

2 Likes

Thanks, now I am going to install everything as it is shown in the video and I will try to flash a code into the device using Netbeans development environment.

2 Likes

I would not call that “SOLVED”. I think i would be nice to use the Arduino IDE, but i cant see how it should be done.

1 Like

simoher, you should consider the Spark to be arduino “familiar” and not arduino “compatible”. The arduino IDE is very much biased to the Atmel family of processor whereas the Spark uses an STMicroelectronics processor. As such, the Spark Team and the Community are working hard to port arduino libraries to the Spark. Furthermore, a key missing feature from arduino, mainly libraries, is being worked on by the Spark Team. So libraries ported over will be available in the web IDE and for local compiles. You should see this feature in the next few weeks.

I doubt the Spark will ever work with the Arduino IDE but this is no different than the PIC or the Parallax or many other processors available on the market. For a different IDE experience, consider using Eclipse or the Spark CLI. :smile:

While it is true, that Arduino is Atmel biased this doesn’t mean the Arduino IDE were incapable of targeting the :spark: Core.

As mentioned in one of my earliest posts tapping this topic, Paul Stoffregen from www.pjrc.com has managed to provide an add-on (Teensyduino) for the Arduino IDE to target his Teensy 3.x boards which are based on a Freescale ARM Cortex M4 MK20DX* and LeafLabs has branched the Arduino IDE (http://github.com/leaflabs/maple-ide) to target its Maple board which is based on the same STM32F103 as the Core (may be a good starting point for libs worth porting :wink: ).
So it would be possible - but maybe not necessary, since the tools already available do their job quite well and there are more features to come.

On the other hand setting up my Eclipse to propperly work with the Core repos was far more nerve-recking than installing Arduino IDE plus Teensyduino :wink:

ScruffR, good stuff! I should know better since I use teensy3s! Each uses a software abstraction layer to emulate arduino “compatibility”. However, I think you you pegged it. It may be possible but is it necessary. Even with the abstraction layers, arduino libraries need to be tweaked to work on the non-atmel platforms, just like the Arduino Due.

The Arduino IDE itself is not exactly a great development platform like Eclipse. I think what it has that Spark is presently missing (and sorely lacking) is the stock libraries and the ability to easily add libraries. The good news however, is that these features will soon be coming to a Spark near you. :smile:

@peekay123, you are soooo right.
No end of times I pulled out my hair with some of the quirks of the Arduino IDE - especially how slow it responds at times (but Eclipse made it no easier for me :wink: )
But one thing I really miss with the Core and that IS the abundance of readily available libraries and the ease to just pop them into the libraries directory and just use them.

On the other hand all the Arduino libs and features were not there from the word go and :spark: Spark and this community do an awesome job in catching up on them.

1 Like

I’ve dug into the CLI internals. The structure of the libraries — core-firmware, core-common-lib and core-communication-lib —raises some concerns to have it supported by an Arduino-like IDE or other IDE.

  • There’s no framework single entry like Arduino.h, or Spark.h
  • Main had a header file main.h
  • Ditto for application with application.h
  • Header and code files are in separate folders
  • Libraries have circular includes

My goal is to add support for the Spark on embedXcode, a template for Xcode, the Apple official IDE for Mac OS X.

2 Likes

I’m with you here. Whether or not what the OP would like is possible is just not the point. The issue is not “solved”. I already knew it was not currently possible to use the Arduino IDE, but the “solved” made me think there was some breakthrough and so I eagerly read the thread. :frowning:

Hi @rei_vilo,

Cool! Please feel free to reach out to me directly if I can help answer questions about getting that wired up! Our build farm and API, as well as the local build setup is all meant to encourage integration into other editors. :slight_smile:

Thanks!
David

I didn’t know you could add support for teensy3, thats nice. I know the boards are different and that it may not be easy/plausible, but its still not "SOLVED. I see the lack of libraries, as a lack of a very basic and needed feature, when the programming gets a little more complicated than blinking a led. I’m glad that the feature will be there soon, but i can’t understand why i has been so long under its way, maybe it’s the Git compatibility you are working on to get out at the same time?
I’m already using the NetBeans IDE, but i can’t figure how to add libraries in a reasonable way, and how to manage them. I just end up putting all the libraries in core-firmware and makes like one big collection of all my libraries… I know I’m missing something very basic…
To go OT a little more, NetBeans gives me errors that my function “was not declared in this scope” even if it’s declared later in the scope. Is it just good programming manner to declare all functions in the beginning? The is no need to do that in the Arduino IDE.

It’s standard C that a function must either appear, or it must be declared, higher up in the code than where it is used. I know what we program in is not called C but that’s what it is. There could do with being a formal language definition. If Func appears below where it is called declare it first thus:

int Func( char *);

void Loop()
{
.
.
i = Func( "asciiz");
.
.
}

int Func( char *p)
{
  return 7;
}

The reason why you don’t have to write a prototype in Arduino IDE - and just the same in Sparkulator Web IDE - is that these go through some preprocessing which adds these prototypes.

Normally you do have a lot of these prototypes in your header files (*.h) already and since the #include statement sits at the top of your code files the compiler knows all about the function decoration and will not complain - only if you don’t want to have a function exposed in the headers you’d publish along with your prebuilt library you put the prototypes somewhere in your code file before any first call to it.

That was what i thought… Can i make the NetBeans IDE prototype for me too? It makes it difficult to “port” some libraries from one IDE to another, when something could have worked right away.

ScruffR, I try and decorate my functions all the time! :wink:

1 Like

Simon (@simohe), you will find that it does not make it more difficult, since this is alreay the way e.g. Arduino libraries are made up anyhow.
If you have a look at any of the Arduino libraries you will find that there alreay are all the function prototypes needed for a library in its respective header (*.h) file, were the actual code is in the code (*.c/*.cpp) file which #includes the header prototypes.
And when you want to use the features of a library you do the same - #include the library header.
So there is no difference between Arduino IDE and NetBeans or Eclipse IDE.

The only difference is in the way how the (in Arduino so-called) sketches are treated. They undergo - as mentioned before - some preprocessing, much the same way as the :spark: Sparkulator Web IDE does. But you would not actually port a library the way you would write a sketch.
You might start of porting as a sketch (hence the name) writing the header portion (with all the required prototypes and vars) and the code portion in one big file, but once you are done, you will splitt this one file into two the <library>.h and the <library>.c[pp] and there you are again - just like any other Arduino library.

On the other hand, sure you could add some sort of external preprocessing yourself NetBeans and Eclipse are quite capable tools - open to adaption -, but I would not see the need for that.

Oops :blush:, @peekay123!

I obviously got a bit muddled up with my terms.

What I (obviously ;-)) meant was the function signature and some way or the other the URL decoration squeezed itself into the tele-typing-chamber

(greetings from The Fly)

2 Likes