SparkCore Development

I’m trying to clarify my understanding of the SparkCore with consideration for a future project.

  • Is the STM processor effectively uncommitted and available solely for User applications or does it run some wireless code?
  • I understand that you can put the wireless chip to sleep and also the STM. Do you have a figure for current consumption of the SparkCore board as a whole when in deep sleep i.e. including regulator current?
  • I presume the STM can be woken up from pin interrupts etc?
  • Is the STM normally programmed with a boot loader that allows loading of Arduino code?
  • If you wanted to debug / program the STM directly presumably you would use the JTAG adapter?
  • If using the JTAG, do you have any recommendations for development tools / toolchains?

I’m hoping / assuming from confirmation of the questions above that it is possible to construct an application which uses the STM to run the code, using sleep modes to reduce the duty cycle of the runtime and reduce overall power consumption.

In my particular case the application would be event driven - waking from sleep, performing it’s task, collecting data, then sleeping again. The data would then be dumped on demand over the wireless link when back at a base, only firing up the wireless part at this point and powering it down the rest of the time. Does that use case fit with the SparkCore?

To answer your questions:

  1. The STM32 processor does handle incoming messages; however other than the initial handshake (which has a large memory footprint) it is mostly unencumbered. We will also be implementing FreeRTOS (not currently part of the project) to ensure that our code doesn’t compete with the user application for resources.
  2. We haven’t done measurements on things like this yet, but we will be doing testing shortly after delivery to fill out the Spark Core’s own datasheet.
  3. The STM32 can be woken up from pin interrupts, yes.
  4. Yes, the STM32 has a bootloader, but it’s not a matter of dropping the Arduino code directly into application space; rather, it needs our own set of libraries, which the Arduino code will rely upon in the context of this micro-controller.
  5. Yes you would use a JTAG programmer to do gdb.
  6. We use an ST-Link/v2 programmer along with the stlink command line tool: https://github.com/texane/stlink

Your use case absolutely fits with the Spark Core, and should be very straightforward to implement.

Zach,

Thanks for the reply. A few more for you:

  • if the STM32 is running code to handle incoming messages, how logistically do we load and run code on the STM32 either Arduino or bare metal code? Are we linking to a library? Presumably its different for Arduino vs bare metal.
  • You mention FreeRTOS and competing for resources, does this mean that we may struggle to guarantee time critical sections of code e.g 1-wire comms or driving LED chains?
  • Is there any particular compiler you recommend for the bare metal stuff or will any STM32 one do?

There are a few ways to load our code.

  1. We have a web IDE that you can use to program the Core wirelessly; it functions the same way as the Arduino IDE (automatically linking all of our libraries), and compiles in the cloud
  2. You can write the code locally on your own machine, linking in the libraries yourself; we’ll provide a command-line interface for facilitating this
  3. You can download our libraries from our github repository and do your own compiling

Re: FreeRTOS, interrupt-driven time-critical applications should be fine, but applications assuming that the loop fires regularly can’t be guaranteed, because our functions do need time to run. This is something that we plan to improve over time, and we hope that we will soon be able to provide solutions for any time-critical application. We could definitely use some help here just due to bandwidth constraints, so if you’re particularly interested in this, we would definitely appreciate contributions to the source code once it’s published.

We use arm-none-eabi-gcc as our compiler:
https://launchpad.net/gcc-arm-embedded/+download

Our instructions for compiling your own code will include downloading and installing arm-none-eabi-gcc.

I’m loving this! I can’t wait to get my cores in a couple of weeks.

For my application, I’m going to have a couple of sensors and will be feeding information as needed to my own servers, using libraries that communicate to those servers.

The application is similar to above, in that it will sleep until the sensors go off, at which time I’ll simply be monitoring events until they’re quiet for a few seconds, at which time I’ll upload the results and then go back to sleep.

In this case, would it be better for me to use my own source code (since this is so simple) or would it make more sense to use the libs the you provide?

I really like being in total control of the ARM core myself, but I certainly don’t want to throw away valuable tools you’re already providing. I do want to be able to run in as low-power a mode as possible. Most of the time, the unit will be in a low-power state, only running as needed, and I’m wondering what kind of control the Core lets me have over power consumption.

THANKS!!!

Thanks Zach,

I will try and provide any help I can, :wink:

In this particular application, I think all the time critical stuff will go on when the CC3K is asleep. I presume when the CC3k is asleep there will be no software functions that will need to run on the STM32?

Looking forward to getting my SparkCore soon.