Pages: [1] 2 3   Go Down
Author Topic: Problem with 0017, Firmata 2.1 on Duemilanove  (Read 2993 times)
0 Members and 1 Guest are viewing this topic.
Minneapolis, MN USA
Offline Offline
Full Member
***
Karma: 2
Posts: 162
Never catch a falling soldering iron...
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I recently upgraded to Arduino 0017 which includes Firmata 2.1, and my projects that use Standard Firmata no longer work.  I believe I have found the problem but wanted to see what people thought.

I'm using the Processing Arduino library to interface with Standard Firmata, and the first thing I had to do was change the serial speed from 115200 to 57600 since this is the new default speed in Firmata 2.1.  Digital outputs began to work but digital and analog inputs still did not.

I finally found that the StandardFirmata.pde sketch now calls Firmata.begin(57600) instead of calling Firmata.begin().  This seems fine except that these two implementations of the begin method in Firmata.cpp are different.  This difference is causing digital and analog input to not work on my Duemilanove.
Code:
/* begin method for overriding default serial bitrate */
void FirmataClass::begin(void)
{
  Serial.begin(57600);
  blinkVersion();
  delay(300);
  printVersion();
}

/* begin method for overriding default serial bitrate */
void FirmataClass::begin(long speed)
{
  blinkVersion();
#if defined(__AVR_ATmega128__)  // Wiring                                                                    
  Serial.begin((uint32_t)speed);
#else
  Serial.begin(speed);
#endif
  delay(300);
  printVersion();
  printFirmwareVersion();
}

Note that in the no-arg version of begin(), the call to Serial.begin(57600) precedes blinkVersion().  But in the begin method that takes a speed argument, blinkVersion() is called before the call to Serial.begin(speed).  This causes my Arduino to never send any inputs over the Serial line.  There must be a timing issue here.  When I change the order so that blinkVersion() occurs after Serial.begin(speed), everything works fine.

Short story: this can be fixed by reordering the Firmata.begin methods to make them consistent or to have the examples call the no-arg version of Firmata.begin().

Has anyone else had issues with using Firmata 2.1 included in Arduino 0017?  I would think that anyone using any of the examples like StandardFirmata would have found them not to work...
Logged

Forum Administrator
Cambridge, MA
Offline Offline
Faraday Member
*****
Karma: 9
Posts: 3538
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks. I reported this on the Firmata development list so we should be able to get it fixed.  I'll give the Standard Firmata a try with the Processing Arduino library.
Logged

Brooklyn, NY, USA
Offline Offline
Full Member
***
Karma: 0
Posts: 115
arduino for all
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for your thorough bug report, I checked in a fix into the Firmata SVN.  It would be great if you could test it.  Either check out the whole thing:

svn co https://firmata.svn.sourceforge.net/svnroot/firmata/arduino/trunk

Or just download the file and copy it into place:

http://firmata.svn.sourceforge.net/viewvc/firmata/arduino/trunk/Firmata/Firmata.cpp
Logged

Minneapolis, MN USA
Offline Offline
Full Member
***
Karma: 2
Posts: 162
Never catch a falling soldering iron...
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I tested your fix to Firmata.cpp and it works fine.  I also tested the entire trunk, and no problems.  Thanks much.  Hopefully an updated Firmata can make it into Arduino 0018...
Logged

Collegno, Turin
Offline Offline
Newbie
*
Karma: 0
Posts: 37
Arduino lovers
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

hi i've tried to change the firmata.ccp but nothing still works

i use an arduino mega with firmata 2.1 beta 3 and pduino 0.5 beta2

in the arduino 0017 of course
Logged

Enschede - The Netherlands
Offline Offline
Jr. Member
**
Karma: 0
Posts: 75
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I use as3glue with Firmata 2.1 Changing the serialspeed ( in serproxy ) worked out good ( thanks for the tip ) and I have connection.

However I have also problems with the analog inputs. They don't give a range from 0-1023 anymore ( over a even range of 0-5V with a potmeter ). This is a software problem, because with Firmata 2.0 it works good.

Changing the firmata.cpp and firmata.h in the Arduino 17 library's folder didn't work either.

In the forum someone made his on changes :
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1253735359/0

Those work, but the serialspeed is different.

Since I use it in an educational situation it would be good that a standard becomes kind of a standard. I hope Arduino 18 can come with a stable version.
Logged

Brooklyn, NY, USA
Offline Offline
Full Member
***
Karma: 0
Posts: 115
arduino for all
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


The StandardFirmata in 0017 turned out to be kind of buggy, unfortunately.  We have things mostly fixed in SVN, but would love to have more testing and bug reports!  So here's a new release.  I fixed all bugs that I knew about, including the one where analog pins sometimes acted like they had a log curve on them.

http://at.or.at/hans/pd/objects.html#pduino

I tested this on a Diecimila, I hear there are troubles with the Arduino Pro and others, but I only have the older ones, so testing and bug reports on those are very helpful.

.hc

Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 4
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Is there still a problem with the latest firmware (i.e., svn trunk or your download link)? Owning a Mega, I'm still having the problem described above...

As stated by others, I can see the communication LEDs working, but running the blink example inside Processing, pin 13 doesn't blink.

Help? smiley
Logged

Brooklyn, NY, USA
Offline Offline
Full Member
***
Karma: 0
Posts: 115
arduino for all
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Unfortunately, the Arduino Mega support is spotty right now.  There are some pins that work, and some that are mismapped (i.e. pin 13 is actually something like pin 20).  My advice if you want to try to use Firmata on the Mega is try all the pins. For example:

  • turn on all analog pins and look to see which one your pot is hooked up to
  • turn on all pins to Output then hook up LEDs to all of them then test
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 4
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ok I will try those options and will come back here with some more info.

Does this mean that there should be a specific StandardFirmata for the Mega, or is it just a matter of fixing some bugs?

How can I help on this? I am proficient with programming languages (C and C++ included), but have little experience with the details of Firmata and Arduino.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 22
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Had the same problem with the 0017, Firmata 2.1 not working with the Arduino 328.

I went back to the Firmata 2 I was using before AND had to change the 57600 in serproxy.cfg and initial testing looks good.

My application needs to support both boards so I'll need to write a routine in to change the serproxy.cfg dynamically if the board is a 168 vs. 328 as the Arduino 168 don't work on 57600 in serproxy.cfg (I'm using as3glue with a flash app)

I would be curious to know why the same version of firmata only runs on the 168 board with serproxy.cfg at 115200 and at 57600 on the 328 board and if there is any way to fix that going forward?

On a side note, my app requires a reset of the board before running which I was doing with the command line on the 168 boards with this command

"C:\Program Files\DIY Magic Mirror\utils\arduino-0017\hardware\tools\avr\bin\avrdude.exe" -C "C:\Program Files\DIY Magic Mirror\utils\arduino-0017\hardware\tools\avr\etc\avrdude.conf" -pm168 -cstk500v1 -P\\.\%1 -b19200 -U hfuse:r:high.txt:s -U lfuse:r:low.txt:s

with the 328 board, a few changes and this works now too

"C:\Program Files (x86)\DIY Magic Mirror\utils\arduino-0017\hardware\tools\avr\bin\avrdude.exe" -C "C:\Program Files (x86)\DIY Magic Mirror\utils\arduino-0017\hardware\tools\avr\etc\avrdude.conf" -pm328p -cstk500v1 -P\\.\%1 -b57600 -U hfuse:r:high.txt:s -U lfuse:r:low.txt:s
Logged

Brooklyn, NY, USA
Offline Offline
Full Member
***
Karma: 0
Posts: 115
arduino for all
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I don't have a 328-based board, so I would greatly appreciate you testing this latest test release.  On my boards, I fixed all of the bugs.

http://at.or.at/hans/pd/objects.html#firmata

If it doesn't work for you, I'll try to get my hands on a 328 board.
Logged

Brooklyn, NY, USA
Offline Offline
Full Member
***
Karma: 0
Posts: 115
arduino for all
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I don't have a 328-based board, so I would greatly appreciate you testing this latest test release.  On my boards, I fixed all of the bugs.

http://at.or.at/hans/pd/objects.html#firmata

If it doesn't work for you, I'll try to get my hands on a 328 board.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 4
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Regarding the Mega, pin 13 is (wrongly) mapped to 15. I haven't been able to test the rest, since I'm still waiting for a led/pots kit to arrive by mail.

Any thoughts about the other questions on my previous post?

Thanks!
Logged

Brooklyn, NY, USA
Offline Offline
Full Member
***
Karma: 0
Posts: 115
arduino for all
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I don't have a 328-based board, so I would greatly appreciate you testing this latest test release.  On my boards, I fixed all of the bugs.

http://at.or.at/hans/pd/objects.html#firmata

If it doesn't work for you, I'll try to get my hands on a 328 board.
Logged

Pages: [1] 2 3   Go Up
Jump to: