Show Posts
Pages: [1] 2 3 ... 31
1  Development / Other Software Development / Re: IDE 1.0.5 v 1.5.7 - Instantiating a class causes program to reset (using 1.5.7) on: September 21, 2014, 12:37:23 pm
Hi Mark. If I understand you correctly you consider this to be a compiler error in Arduino 1.5.7 beta? If that is the case you should isolate the error and report it to the GCC avr team. The Ardunio team will not be able to help you more than confirm the compiler error and endorse your report. Best regards..
2  Development / Other Software Development / Re: Cosa: An Object-Oriented Platform for Arduino programming on: September 16, 2014, 07:30:27 am
The latest Cosa update contains a refactoring of the MQTT support class. The example sketch CosaMQTTtemperature demonstrates how to push temperature readings from DS18B20 to an MQTT server. The sketch can be configured for a number of MQTT servers. The default server is q.m2m.io.
https://github.com/mikaelpatel/Cosa/blob/master/examples/IoT/MQTT/CosaMQTTtemperature/CosaMQTTtemperature.ino

Below is a screen shot from MQTTInspector on Apple iPad. A MQTT topic is used for the client name and an additional three topics for the digital thermometers (indoors, outdoors and basement).  



A standard web-browser can also be used to view data published on MQTT servers. Below is a screen shot from 2lemetry MQTT Client, www.mqtt.io.



Last, the example sketch also demonstrates some of the new features in C++11.
Code:
// One-wire pin and connected DS18B20 device
OWI owi(Board::D7);
DS18B20 outdoors(&owi);
DS18B20 indoors(&owi);
DS18B20 basement(&owi);
DS18B20* thermometer[] = {
  &outdoors,
  &indoors,
  &basement
};
...
void setup()
{
  ...
  uint8_t i = 0;
  for (auto sensor : thermometer) {
    sensor->connect(i++);
    sensor->set_resolution(10);
    sensor->write_scratchpad();
   }
  ...
C++11 allow more advanced for-loop constructions with auto type definition. http://en.wikipedia.org/wiki/C%2B%2B11#Range-based_for_loop

Cheers!
3  International / India / Re: MULTITHREADING POSSIBLE IN ARDUINO BOARD on: September 14, 2014, 07:42:15 am
No problems with this!

There are actually a few RTOS around that work on the Arduino Boards. Checkout fat16lib's porting of for instance ChibiOS. https://github.com/greiman?tab=repositories

But first let us step back and look at the hardware. In a broader sense multi-tasking is already going on even in the Arduino core. The AVR MCUs contain a number of hardware modules that can be run concurrently with the processor. Some examples; ADC, UART, SPI, TWI, Watchdog, Timer, etc.

In Cosa I have implemented several methods of achieving multi-threading; periodic functions, state-machines, proto-threads and coroutines. Below are links to example sketches;

https://github.com/mikaelpatel/Cosa/blob/master/examples/Blink/CosaBlinkPeriodic/CosaBlinkPeriodic.ino
https://github.com/mikaelpatel/Cosa/blob/master/examples/Blink/CosaBlinkFSM/CosaBlinkFSM.ino
https://github.com/mikaelpatel/Cosa/blob/master/examples/Blink/CosaBlinkProtoThread/CosaBlinkProtoThread.ino
https://github.com/mikaelpatel/Cosa/blob/master/examples/Blink/CosaBlinkThread/CosaBlinkThread.ino

The Cosa Nucleo (multi-threading) Blink example sketch uses three threads; LED that does the blink, Controller that changes the blink frequency, and the main thread that performs low-power sleep while waiting to the next time event. The sketch is possible to run on an ATtiny84 with only 512 bytes of SRAM.

Cheers!

Ref. http://forum.arduino.cc/index.php?topic=150299.0
4  Development / Other Software Development / Re: programming the flash in runtime on: September 12, 2014, 07:54:03 am
I looked at this a while back to allow a forth like language with a token threaded interpreter for Cosa. The problem is that most bootloaders have embedded the flash programming section and there is no entry point to that. It is nested in a lot of getch(), conditions and control structures.

The simplest solution is to add the function(s) last in a bootloader and do a simple function pointer based wrapper to call it from the application area.

Cheers!

5  Using Arduino / Microcontrollers / Re: arduino ADC and FFT on: September 12, 2014, 02:46:41 am
Let us do the numbers!

1. The ADC takes 112 us to convert 10 bit sample (approx 10 K samples per second @ 16 MHz F_CPU). Selecting a lower resolution gives higher sample rate; 56 us at 9 bit (20 K). 30 us at 8 bit.

2. The processor can work in parallel with the ADC. That gives approx 1800 instructions (@ 10 bits per sample) to do ISR, incremental filter calculation, send data, and other background tasks.

3. Send data (UART) is also in parallel with the processor but you need to have the corresponding baud-rate. Converting to text will take at least 100-200 us so that is not an option. Two bytes raw data per sample over UART will require at least a baud-rate of 200 Kbps for 10 K, 10 bit samples. Simple compression can reduce this by 1.5-2.5.

4. Buffering data to SD or Flash is also an option but this depends on the application logic.

Cheers!
6  Development / Other Software Development / Re: Cosa: An Object-Oriented Platform for Arduino programming on: September 11, 2014, 02:07:02 pm
@Graynomad

Last time I used a logic analyzer was back in the late 80'ies/beginning of 90'ies.

The quantum leap for me this time around was the ability to capture several seconds of data (at medium high speed) and then being able to zoom. The high level patterns became easier to see. A bit like FFT but on trace/probe data. This gave a lead on possible high and low level optimizations. I have not had tooling before that allow this size of capture and not zooming between 10 s to 10 ns level so fast and seamlessly.    

BTW, did you get one of the new Saleaes or is that a Logic8/16?
I was avoiding marketing as there must be a lot of these tools out there but lets say it pure logic levels (no analog), 8 channels @ 24 MHz. Nothing fancy.

It would be great to put together some kind of "firmware programmers handbook" (or even teaching material) where the focus would be on using logic analyzers for verification and optimization. There seems to be a lot of knowledge out there and this could be combined with software architecture, design patterns and optimization techniques. Device driver programming for embedded systems is a growing area with M2M and IoT coming along.

Next stop will be a closer look at the Cosa Wireless device drivers and improving them.

Cheers!
7  Development / Other Software Development / Re: Cosa: An Object-Oriented Platform for Arduino programming on: September 11, 2014, 09:14:51 am
I recently got hold of a logic analyzer and could start optimizing code on a whole new level. This might not seem necessary as Cosa is already X3-X7 faster than the Arduino core but still important to get performance out of SD, Ethernet, Flash, etc, and use more parallelism.

The first usage of the analyzer was to verify the many protocols in Cosa (I2C, SPI, 1-Wire, and others) and push some of the limits.

1. Cosa OWI (1-Wire) Verification


2. Cosa TWI (I2C) Verification


3. Cosa DS1302 RTC Verification and Optimization
More interesting is the visualization of a protocol and then optimization. After verifying the DS1302 RTC device driver it was possible to improve performance (transfer rate) with X3-X5. Below is a screen-shot and a link to the update:

Improvements: https://github.com/mikaelpatel/Cosa/commit/b8213f2c8de1d37939c8020be2427745528eb8f8

A simple method of capturing a trace is to simply trigger on UART TX activity and then record. The tool I used allows more or less seamless zoom from a window of 1-10 seconds all the way down to 10-100 ns. This allows interleaving, parallelism, congestion, etc, to be detected. For instance, it is interesting to actually see how the sketch is delayed when the UART TX buffer is full and how the UART baud-rate or the output string length can be changed to avoid this congestion.

4. SD device driver bug-fix and optimization
The optimization to the Cosa SD device driver is an excellent example of how a logic analyzer can be used. There was also an initialization bug in the driver that could be detected and fixed.
Improvements: https://github.com/mikaelpatel/Cosa/commit/1c5808195cd2c6be9d052638e40dc7b72f58bdea
Bug fix: https://github.com/mikaelpatel/Cosa/commit/8f019c301dc09f85dac9f39bb5676821f34b7ad7

Cheers!
8  Using Arduino / Networking, Protocols, and Devices / Re: how-to-make-a-simple-arduino-wireless-shield on: September 10, 2014, 11:41:20 am
Please Modify your post and replace the picture with something a lot smaller, like 1000 wide vs humongous. I can't even see enough at one time to tell what that is.
The picture is actually a link to the original page. Anyway now it is the link instead of embedded as a picture.

The thing is obvious; use an ethernet cable between the wi-fi bridge and the ethernet shield.

Cheers!
9  Development / Other Software Development / Re: Opensource Arduinu menu library on: September 10, 2014, 09:12:19 am
opensource on github.. i, do not intend to replace github, just seeking the right channel and process to introduce this to the group.
Is this the right channel?
Hi. I think you have been through this procedure before on the Developer group site (Google). https://groups.google.com/a/arduino.cc/forum/#!topic/developers/g3IqPZ2wB5k

That time you wanted to add a new virtual pin to the Arduino core. Both your menu system and virtual pins I think are interesting ideas.

Now there are very many levels of "introducing" this to the group. The hardest is getting new functionality into the Arduino Core library. This is a process that might take over a year even for simplest of things. And you need to work hard to convince the "core team" of the added value. It is the nature of the process of an open source community. The easiest is just, as posted as an answer, zip your files and post here.

Now the difficult part; What is your intention? Maintain a library for the Arduino community? Post and forget? Become one of the Arduino maintainers? Start an on-line business and sell some special hardware that uses the library?

Last but not least; I think it is very important to remember that this is a commercial based forum site even though it looks like an open source community. The forum is a way of reducing the cost of customer service for the Arduino products. It is a marketing strategy - and a very good one. With that said it become obvious that marketing of other "products" is not allowed.

I leave the rest as homework.

Cheers!
10  Using Arduino / Interfacing w/ Software on the Computer / Re: Serial monitor data be seen in website, real time on: September 10, 2014, 08:34:12 am
Do you want to push or pull data from the Arduino? Do you want the Arduino to be "stand-alone" (no PC etc)?

1. Push data from the Arduino
a. Stand-alone: Use an Ethernet Shield. Read sensor data and send over socket. Use a protocol that works for the receiver; TFTP, FTP, HTTP/POST, MQTT, etc.
b. Host: Use serial port and send sensor data to host. Host performs the rest.

2. Pull data from the Arduino
a. Stand-alone: Again use an Ethernet Shield. Read sensor data and store on Arduino (SRAM or SD). Use a protocol so that the client can get data from the Arduino (SNMP Agent or HTTP directly on the Arduino and link the real-time data into the web-page). Other protocols are ThingSpeak (and a bunch of commercial IoT protocols and clouds).
b. Host: Use serial port (again) but send commands to read sensor data either from storage or from sensors. Depends on sample rate and amount of data.

These are some of the alternatives and the rest is details :-)

Cheers!
11  Using Arduino / Networking, Protocols, and Devices / Re: how-to-make-a-simple-arduino-wireless-shield on: September 10, 2014, 07:22:56 am
The picture tells you everything you need to know.
http://hackanerd.files.wordpress.com/2013/07/img_0161.jpg
Cheers!
12  Development / Other Software Development / Re: arduino output to text file on: September 10, 2014, 06:57:02 am
These are some of the tools I use in Linux (Ubuntu) as a complement to CUT-PASTE.

1. Log serial data to a file
GtkTerm - log to file
PuTTY - session logging
miniterm.py > file

2. Get serial data directly into editor
jEdit - console
GNU Emacs - M-X compile/M-X shell

Cheers!
13  Development / Other Software Development / Re: Code size with different versions and -flto optimization on: September 07, 2014, 07:32:53 am
Recently I wrote a build script for Cosa (an object-oriented framework for the Arduino). This allows scripting build of all the Cosa example sketched (over 150) and collecting size statistics.

Cosa can be built with both 1.5.7 and 1.0.5. Below are links to the log from the respective build.
https://github.com/mikaelpatel/Cosa/blob/master/build/arduino-1.0.5.log
https://github.com/mikaelpatel/Cosa/blob/master/build/arduino-1.5.7.log

The scripts are in the Cosa/build directory and named "cosa" and "tutto".
https://github.com/mikaelpatel/Cosa/blob/master/build/cosa
https://github.com/mikaelpatel/Cosa/blob/master/build/tutto

Cheers!
14  Development / Other Software Development / Re: Cosa: An Object-Oriented Platform for Arduino programming on: August 31, 2014, 01:12:26 pm
Interesting stuff going on here! I just stumbled upon Cosa and it looks very nice.
...
Good news first: It worked more or less on first try. As it is a IOStream::Device it actually executes inside the interrupt where the new characters are received and works completely in the background. Perfect!
Thanks for your interest in Cosa. I am happy to learn that you could port your NMEA parser library and got it working. Good job!

Any ideas why this could happen? Why do I get every NMEA message without problems but it just kinda skips the UBX messages? NMEA is only using 7bit ASCII and UBX messages start with a 0xB5 byte. Is there some kind of 8bit mode I have to activate first?
I would need to see some more details to say what is the problem. How did you set up the SoftUART? There might be a problem with 7-bit mode.

Update: I checked the SoftUART putchar() code and it could return a negative value and cause higher functions to think it was EOF or an error. There is an update that fixes this. https://github.com/mikaelpatel/Cosa/commit/d26d0d46eecd6b10e5d27f288bfd72a31a4692a1

Is there a place where there are some How-To's regarding Cosa? I found the blog on blogspot but it doesn't look complete at all. Sure, the API is documented but for me this is not enough to understand the concepts and ideas behind the whole library (Events, Multi-Threading, ...).
Yes, the blog is old stuff. Nearly a year of development has gone by without any updates to the blog. Hopefully I will get time to come back to that. Most of the concepts in Cosa are standard Computer Science and Software Engineering adapted for small scale Embedded Systems. There are over 150+ example sketches that show different aspects of Cosa and how to use the different classes.

The Cosa "blue-prints" and teaching material are unfortunately not yet open-source.

Cheers!
15  Using Arduino / Microcontrollers / Re: attiny 85, any pointers?/ on: August 27, 2014, 03:24:45 pm
You should check the ATtinyX4 documentation. MISO/MOSI are the programming mode names. They are called D0/DI and reversed in "application mode".
https://github.com/mikaelpatel/Cosa/blob/master/cores/cosa/Cosa/Board/Arduino/ATtinyX4.hh#L40

Cheers!
Pages: [1] 2 3 ... 31