What steps will reproduce the problem? 1. Windows 7 home premium 2. Connect to serial source 3. Poll device with data in an interval base 4. After some time it dies.
Same code works in mac osx without any issue
What is the expected output? What do you see instead?
AS3 calls INVENTORY function every second. UART always reply to message.
trace output:
INVENTORY -> sends:05000100ae74 OK:04000e2cb3 INVENTORY -> sends:05000100ae74 OK:04000e2cb3 INVENTORY -> sends:05000100ae74 OK:04000e2cb3 INVENTORY -> sends:05000100ae74 INVENTORY -> sends:05000100ae74 INVENTORY -> sends:05000100ae74 INVENTORY -> sends:05000100ae74 INVENTORY -> sends:05000100ae74
What version of the product are you using? On what operating system?
version 1.0.0 Windows 7 home premium on both virtual and native shows the same issue
Please provide any additional information below.
Code:
RFID = new ArduinoConnector(); RFID.addEventListener(Event.ACTIVATE, onConnected); RFID.addEventListener("socketData", onRFIDData); RFID.connect("COM3",19200);
function onConnected(event:Event):void{ var x:Timer = new Timer(1000,1); x.addEventListener(TimerEvent.TIMER_COMPLETE, function():void{ inventory(); }); x.start(); }
function onRFIDData(event:ArduinoConnectorEvent):void{ var str:String = ""; var data:Array = RFID.readBytesAsArray(); for(var i:Number = 0 ; i < data.length ; i++) data[i] = data[i].charCodeAt(0); trace(data); }
Comment #1
Posted on Mar 25, 2012 by Happy BearUnable to reproduce. May be related to Issue 12, but unsure. May need to do a hardware debug.
Comment #2
Posted on May 16, 2012 by Swift Lionyou can try adding else if(sentEvent==1) { multiplatformSleep(500); sentEvent=0; } after if ((sentEvent == 0) && (((prevCollection == 0) && (bufferSize > 0)) || (bufferSize > 1024))) { FREDispatchStatusEventAsync(dllContext, (uint8_t*) "bufferHasData", (const uint8_t*) "INFO"); sentEvent = 1; } it clears the data automatically if the flag sentEvent is set. If sentEvent is set to true, but for some reason you didn't get the event (and thus the appliaction is unable to read from the buffer, because it doesn't know, that there is any data), you won't receive any more events (because they only fire if sentEvent is set).
Comment #3
Posted on May 17, 2012 by Helpful MonkeyHaving the same problem, but I don't see where that code goes. I assume I would need the source code to make that change?
Thx, Les
Comment #4
Posted on May 18, 2012 by Swift Lionyep, here is the original source: http://code.google.com/p/as3-arduino-connector/source/browse/trunk/native-extension/Windows-x86/SerialANE.c
Comment #5
Posted on May 18, 2012 by Grumpy HorseSimilar problem here, under windows and mac though much more likely to happen on windows. my arduino just does serial.println (5_character_string) every 500ms or so, after an indeterminate though short (normally from 5 seconds to a minute) the socketData event stops firing, though I can see from the LED on my usb/ttl converter that data is still being sent, and if I reconnect to as3-arduino-connector the data is then received again (up until the next failure). No errors are raised - I can work around this for the moment by reconnecting if data is not received for a few seconds. Any ideas/advice welcomed.
Comment #6
Posted on Jul 8, 2012 by Swift BearDescription Resource Path Location Type
undefined reference to __imp__pthread_cancel' SerialANE.c /ArduinoConnector C/C++ Problem
undefined reference to
__imp__pthread_create' SerialANE.c /ArduinoConnector C/C++ Problem
undefined reference to __imp__pthread_mutex_lock' SerialANE.c /ArduinoConnector C/C++ Problem
undefined reference to
__imp__pthread_mutex_unlock' SerialANE.c /ArduinoConnector C/C++ Problem
windows 7 64 bit, flash builder 4.6, flex sdk 4.6, air sdk 3.3, CDT+MinGW
Comment #7
Posted on Sep 17, 2012 by Helpful BirdSame issue happens. This functionality is very important in my opinion. Providing more reliable data exchange in both directions would made serial connector just brilliant! Are there any plans to publish ANE update?
Comment #8
Posted on Sep 24, 2012 by Helpful BirdTesting on Windows XP, confirm the problem. Are being correctly written to the port, no data to read detected. More often it happens, when the data block to process is bigger thean usual 30-50 bytes.
Has anybody scanned the sources for defect of that kind?
Comment #9
Posted on Nov 12, 2012 by Grumpy Pandasame issue here: win 7 64-bit
my arduino has an endlessloop than continously sends something to serialport to my program and also receives something from it: after some time this stops working -> For me it seems to be after the second time i send something to arduino.
Here is a more detailed description:
- arduino continually sends something in an endlessloop
- i send something to arduino
- arduino still sends something in an endlessloop
- i send something to arduino again
- arduino doesn't send anything in an endlessloop anymmore (as it should!)
So the problem is: There are no more ArduinoConnectorEvents fired after the second "send" from client to arduino. It seems to me it's a problem with bidirectional communication.
Would be great if this issue could be resolved in the next version! Thanks in advance!
Comment #10
Posted on Nov 12, 2012 by Happy HorseI had to stop using this ane because of this afraid.
Comment #11
Posted on Nov 12, 2012 by Helpful BirdHad anyone found any better ANE? I'm thinking of forking the project, naming it "as3-serial-connector"
Comment #12
Posted on Nov 12, 2012 by Happy BearSorry about the long delays guys. I've been out on other projects that didn't really relate to this, so I didn't get a chance to spend much time with this.
I am now able to reproduce it. I think I have a fix, but I haven't written it yet. Additionally, I have some other patches that people have submitted that will help with some other things people have pointed out (allowing you to connect to multiple serial ports at the same time).
That being said, if anybody wants to take a stab at it, I will be more than happy to give committer rights. Or if you email me a patch I will merge it in and make an updated version. I have a pretty extensive test suite setup now that also catches this bug (it didn't catch it before, but it's pretty good at catching others).
Comment #13
Posted on Nov 13, 2012 by Happy BearIf somebody could check out this patched file to see if it fixes the issue. This would be for Windows. You will need to open up the ANE file (it is a zip file), and replace this DLL. If it does fix it, I will repackage the ANE to include the fix for Mac along with some of the other bug fixes I've found over the last month.
- libSerialANE.dll 55.58KB
Comment #14
Posted on Nov 13, 2012 by Grumpy PandaThank you very much!!!
At least for me it fixes the issue!
Comment #15
Posted on Nov 14, 2012 by Massive MonkeyWill try tomorrow morning and let you know :) cannot wait for the mac version as well, it have been stable for a bit longer, but eventually stops too.
Regards
Mirza Ceyzar
Comment #16
Posted on Nov 18, 2012 by Massive MonkeyHi, sorry for taking so long to reply, anyway here is my findings:
with original DLL : Fails after 5 calls with the new DLL : Fails after about 120 calls
here is the code for flash builder:
private var i:int = 0;
private var arduino:ArduinoConnector = new ArduinoConnector();
private function onInit():void{
arduino = new ArduinoConnector();
arduino.addEventListener(Event.ACTIVATE, onConnected);
arduino.addEventListener("socketData", onRFIDData);
arduino.connect("COM7",9600);
}
private function onConnected(event:Event):void{
var x:Timer = new Timer(100,0);
x.addEventListener(TimerEvent.TIMER, function():void{
arduino.writeString("Hello");
arduino.flush();
});
x.start();
}
private function onRFIDData(event:ArduinoConnectorEvent):void{
ta.appendText("\n" + (i++) + ":" +arduino.readBytesAsString());
}
]]>
</fx:Script>
<s:TextArea id="ta" left="0" right="0" top="0" bottom="0"/>
here is the code for the arduino/PIC:
void main() { while (1) { if (UART1_Data_Ready()) { UART1_Write(UART1_Read(); } }
}
the pic is working perfectly as when i close the air and reopen it resumes where it left off. And also i tried with UART terminal from mikroC application and left it overnight still works in the morning.
but the ArduinoConnector fails under 5 seconds with the old DLL and with the new DLL fails under 40 seconds with 100ms read/write interval.
I hope this helps.
Comment #17
Posted on Dec 8, 2012 by Happy DogSame problem. My arduino send an endless stream. After few seconds the extension stops working. Tried with several computers all with Windows x64
Comment #18
Posted on Jan 23, 2013 by Helpful LionHi dudes, Help me out of the issue i am facing,
After call the dispose and close methods, When i un-plug the device and plug it again,application goes hang state.
Message shows "[ArduinoConnector] Initalizing ANE...". after that application hangs.
Note:- I called the ardunio methods correctly, it executes perfect till the device un-plugged and plugged after that the above things happenings.
Comment #19
Posted on Jan 28, 2013 by Helpful LionHurray!!! Hope, Our team got solution. Found the Hang state(end less loop). Go to SerialANE.c file and change the code, declare one variable after "int sentEvent"; we did like "int dispose;" initialize as dispose=0 in "setupPort" function() and make it dispose=1 in "closePort" function(). The main problem occurs on "pollForData()" it is going end less loop, so have to control this. we write a code while(dispose==0) instead of while(1) then see the magic. Hope so, endless stream comes to end.
Comment #20
Posted on Feb 22, 2013 by Helpful Horse@ beeraham...
Can you supply the fixed dll? I tried to incorporate your changes in the downloaded trunk from Arduino Connector, but can't get it to compile as DLL...getting some dependecy and "unknown resource" errors in Eclipse/FB with pthread. Although the .dll and/or the .h files are linked.
It would be cool, but if you can't cause it was a paid project and the customer won't allow such handling of files, it's also OK.
Just wanted to ask before I gotta switch from the totally cool AC to the old serproxy method for a project.
Thanks very much, Leo
Comment #21
Posted on Feb 25, 2013 by Helpful BirdComment deleted
Comment #22
Posted on Feb 25, 2013 by Helpful BirdIf anybody has a working solution for the problem, please commit it or do the fork, put the link here.
The requested feauture is terribly nedeed!
Comment #23
Posted on Mar 4, 2013 by Helpful LionAdd these *.dll files and make the .ane file then check it.Hope, It may solve the hanging issue.
- libSerialANE.dll 38KB
- pthreadGC2.dll 117.08KB
- pthreadVC2.dll 54.5KB
Comment #24
Posted on Mar 12, 2013 by Helpful Horse@ beeraham...
Thank you for supplying these dlls. I hope I get the chance to check them out this week. Will report as soon as I got the chance to.
Cheers!
Comment #25
Posted on Apr 8, 2013 by Helpful Bear@beeraham
I implemented your files into my ANE but now I recieve this error
VerifyError: Error #1014: Class com.quetwo.Arduino::ArduinoConnector could not be found.
Before this I was using the latest update by Nicholas in 12 Nov and was facing the same problem as beeraham with reconnecting to the device. Thanks
Comment #26
Posted on Apr 17, 2013 by Helpful HorseNow I finally got the time to get back to my project which I'd like to use ArduinoConnector for.
I added the .dlls to my .ane and linked it the compiler of Flash. While compiling I get this error message, maybe someone can find a solution for this problem:
/* ArgumentError: Error #3500: The extension context does not have a method with the name setupPort. at flash.external::ExtensionContext/_call() at flash.external::ExtensionContext/call() at com.quetwo.Arduino::ArduinoConnector/connect()[C:\Users\Nicholas Kwiatkowski\Adobe Flash Builder 4.6\SerialANELib\src\com\quetwo\Arduino\ArduinoConnector.as:83] ...
*/
Thanks a lot, Leo
Comment #27
Posted on Apr 19, 2013 by Helpful HorseOK, I got the .ane to work with the supplied .dlls. Thanks a lot, beeraham! I also had some time for further testing. With the original and the new .ane.
I've also tried two differend Arduino Unos out. And now it get's interessting:
I get the disconnect rather frequent when I use my normal Arduino Uno, an Arduino Uno SMD. When I use an Arduino Uno Rev 3 with the big replacable chip I can't provoke the disconnect. Rather strange, isn't it?
Has anyone the possibility to try the same? Or what kind of boards are you using?
Cheerswell everyone, Leo
Comment #28
Posted on Apr 23, 2013 by Happy BearThis should be fixed with version 1.5.0.
The "hanging" issue that beerahamedkhan included will be fixed in 2.0. I am re-writing some of the code to allow for multiple devices to be used at once -- the re-write will fix that issue.
Comment #29
Posted on Apr 30, 2014 by Swift HorseWas that also fixed for Mac OS X? I'm experiencing the same problem. (It's stuck at "OpenComport")
Comment #30
Posted on Dec 14, 2014 by Helpful BirdHi Everyone, I got the same error as Leo #26 /* ArgumentError: Error #3500: The extension context does not have a method with the name setupPort. at flash.external::ExtensionContext/_call() at flash.external::ExtensionContext/call() at com.quetwo.Arduino::ArduinoConnector/connect()[C:\Users\Nicholas Kwiatkowski\Adobe Flash Builder 4.6\SerialANELib\src\com\quetwo\Arduino\ArduinoConnector.as:83] ...
*/ Has anyone already found a fix? Thanks
Status: Fixed
Labels:
Type-Defect
Priority-Critical
Component-Logic